@snagset/server 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +7 -5
  2. package/dist/bin.js +3 -1
  3. package/dist/bin.js.map +1 -1
  4. package/dist/db/connect.js +68 -31
  5. package/dist/db/connect.js.map +1 -1
  6. package/dist/db/migrate.js +144 -81
  7. package/dist/db/migrate.js.map +1 -1
  8. package/dist/db/rls.js +5 -4
  9. package/dist/db/rls.js.map +1 -1
  10. package/dist/explain.js +1 -1
  11. package/dist/explain.js.map +1 -1
  12. package/dist/platform.js +5 -1
  13. package/dist/platform.js.map +1 -1
  14. package/dist/serverless.js +1 -1
  15. package/dist/serverless.js.map +1 -1
  16. package/package.json +1 -1
  17. package/static/dashboard/assets/{CompositeItem-DooiJvYh.js → CompositeItem-B5AtyrD6.js} +1 -1
  18. package/static/dashboard/assets/ConfirmDialog-ClUMXHe1.js +1 -0
  19. package/static/dashboard/assets/{CopyButton-BX1ldjjz.js → CopyButton-DCsj-LZV.js} +1 -1
  20. package/static/dashboard/assets/{FieldItemContext-DkOlIwHg.js → FieldItemContext-DVEWRsEB.js} +1 -1
  21. package/static/dashboard/assets/{InstallTag-DahspVU0.js → InstallTag-B_qg9P2r.js} +1 -1
  22. package/static/dashboard/assets/SaveState-B-6cG0nU.js +1 -0
  23. package/static/dashboard/assets/{_app-CRQzX614.js → _app-DKjbkrkj.js} +2 -2
  24. package/static/dashboard/assets/{_app-Cd9_WR6L.js → _app-DQfqCcnn.js} +1 -1
  25. package/static/dashboard/assets/{activity-B-59HYua.js → activity-D8OAqMBy.js} +1 -1
  26. package/static/dashboard/assets/{arrow-left-aeWIKOlS.js → arrow-left-D2obUiWw.js} +1 -1
  27. package/static/dashboard/assets/{avatar-KLKmXBKs.js → avatar-DlHbKa1H.js} +1 -1
  28. package/static/dashboard/assets/{badge-Dly0Vqky.js → badge-CQoGgFU8.js} +1 -1
  29. package/static/dashboard/assets/{card-D3S4369l.js → card-YnwmM74t.js} +1 -1
  30. package/static/dashboard/assets/{check-CjehM7M4.js → check-CLHnIgiu.js} +1 -1
  31. package/static/dashboard/assets/{chevron-right-CtWPB3ox.js → chevron-right-BX_QQNXH.js} +1 -1
  32. package/static/dashboard/assets/{copy-DbrG17rp.js → copy-ZOZ0pLVD.js} +1 -1
  33. package/static/dashboard/assets/{dialog-GyPeOagK.js → dialog-BO8bYmy1.js} +2 -2
  34. package/static/dashboard/assets/{dropdown-menu-BOoXJZ3W.js → dropdown-menu-NLHjhAUe.js} +3 -3
  35. package/static/dashboard/assets/{image-off-BYE-vNh9.js → image-off-Dg9jTwH7.js} +1 -1
  36. package/static/dashboard/assets/index-B7_Oj3hr.js +169 -0
  37. package/static/dashboard/assets/{label-BGuYH_Ll.js → label-Dpq7t35_.js} +1 -1
  38. package/static/dashboard/assets/{layout-grid-DJ_OjGVc.js → layout-grid-Bf2WS_DV.js} +1 -1
  39. package/static/dashboard/assets/me-DoCJgtG9.js +1 -0
  40. package/static/dashboard/assets/{parts-DJaBw8EG.js → parts-C1QjM02Y.js} +1 -1
  41. package/static/dashboard/assets/{plus-x0wkLget.js → plus-D247LXUb.js} +1 -1
  42. package/static/dashboard/assets/s._site-BDWAQaIb.js +1 -0
  43. package/static/dashboard/assets/{s._site.comments-Bt0AsQ8j.js → s._site.comments-DEzj9S7b.js} +9 -9
  44. package/static/dashboard/assets/s._site.reviewers-DZ5GqGMU.js +1 -0
  45. package/static/dashboard/assets/s._site.settings-BIjpyBsc.js +1 -0
  46. package/static/dashboard/assets/{setup-DTi8FBnt.js → setup-ONHVc5kM.js} +1 -1
  47. package/static/dashboard/assets/sign-in-H0jNzIrs.js +1 -0
  48. package/static/dashboard/assets/{sign-up-CfU4RCfo.js → sign-up-DyiLEKht.js} +1 -1
  49. package/static/dashboard/assets/sites-Dnmo-2Me.js +1 -0
  50. package/static/dashboard/assets/studio-DxOnhxuB.js +1 -0
  51. package/static/dashboard/assets/studio-enyabWEx.js +1 -0
  52. package/static/dashboard/assets/studio.index-nkeq6PME.js +1 -0
  53. package/static/dashboard/assets/studio.integrations-BWPo36fJ.js +1 -0
  54. package/static/dashboard/assets/studio.members-DXS5CJK_.js +1 -0
  55. package/static/dashboard/assets/{sun-BLhaKyhb.js → sun-BzkBukC4.js} +1 -1
  56. package/static/dashboard/assets/{switch-En3PhTzh.js → switch-ElcxbE6-.js} +1 -1
  57. package/static/dashboard/assets/{table-DuU_ZP-u.js → table-DdjoxL3-.js} +1 -1
  58. package/static/dashboard/assets/{useAriaLabelledBy-C3DXCwhM.js → useAriaLabelledBy-BNUj3f_d.js} +1 -1
  59. package/static/dashboard/assets/{useBaseQuery-B_iu1J2b.js → useBaseQuery-yj7uWlSz.js} +1 -1
  60. package/static/dashboard/assets/useQuery-CBgK187B.js +1 -0
  61. package/static/dashboard/assets/useRender-BHlMpPxr.js +1 -0
  62. package/static/dashboard/assets/{useValueChanged-BwMBSSVy.js → useValueChanged-DQ0Iea1L.js} +1 -1
  63. package/static/dashboard/assets/{users-c6wDSgLD.js → users-DDrXwrCG.js} +1 -1
  64. package/static/dashboard/assets/welcome-Dg1oA1uA.js +11 -0
  65. package/static/dashboard/assets/you-CP3bZ82A.js +1 -0
  66. package/static/dashboard/assets/{zod-CBoGbUzv.js → zod-BUdBrC5l.js} +1 -1
  67. package/static/dashboard/index.html +1 -1
  68. package/vercel.json +10 -5
  69. package/static/dashboard/assets/ConfirmDialog-B5Kq--VU.js +0 -1
  70. package/static/dashboard/assets/SaveState-Q9xJjbqL.js +0 -6
  71. package/static/dashboard/assets/createLucideIcon-CJO80vPf.js +0 -36
  72. package/static/dashboard/assets/index-D4yHhKPM.js +0 -129
  73. package/static/dashboard/assets/me-B-0XXdLF.js +0 -1
  74. package/static/dashboard/assets/s._site-s4IRnE6u.js +0 -1
  75. package/static/dashboard/assets/s._site.reviewers-BzJsotII.js +0 -1
  76. package/static/dashboard/assets/s._site.settings-C6ei77kQ.js +0 -1
  77. package/static/dashboard/assets/sign-in-CGOMDkYg.js +0 -1
  78. package/static/dashboard/assets/sites-zZ5gTDCZ.js +0 -1
  79. package/static/dashboard/assets/studio-DaMq1jOg.js +0 -1
  80. package/static/dashboard/assets/studio-r6xIIciH.js +0 -1
  81. package/static/dashboard/assets/studio.index-CsF3xaoh.js +0 -1
  82. package/static/dashboard/assets/studio.integrations-BnPEkEA3.js +0 -1
  83. package/static/dashboard/assets/studio.members-DegH-I8c.js +0 -1
  84. package/static/dashboard/assets/useQuery-yeUPHKKg.js +0 -1
  85. package/static/dashboard/assets/useRender-Bl1M9SFS.js +0 -1
  86. package/static/dashboard/assets/welcome-Ddm5B8Xh.js +0 -11
  87. package/static/dashboard/assets/you-BmjZYMtz.js +0 -1
@@ -1 +1 @@
1
- import{r as o,W as l,f as H,E as V,aE as J,U as A,d as M,c as v,i as X,az as Q,h as Z,j as T,e as _}from"./index-D4yHhKPM.js";function ee(t){return t?.ownerDocument||document}const te={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ne={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},se={disabled:!1,...ne},ae={valid(t){return t===null?null:t?{"data-valid":""}:{"data-invalid":""}}},re={invalid:void 0,name:void 0,validityData:{state:te,errors:[],error:"",value:"",initialValue:null},setValidityData:l,disabled:void 0,setTouched:l,setDirty:l,setFilled:l,setFocused:l,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:se,registerFieldControl:l,validation:{getValidationProps:(t,e=V)=>e,inputRef:{current:null},registeredInputs:new Map,registerInput:l,getInputControl:()=>null,commit:async()=>{},change:l}},oe=o.createContext(re);function N(t=!0){const e=o.useContext(oe);if(e.setValidityData===l&&!t)throw new Error(H(28));return e}const ie=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:l,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function le(){return o.useContext(ie)}let S=0;function ue(t,e="mui"){const[n,s]=o.useState(t),u=t||n;return o.useEffect(()=>{n==null&&(S+=1,s(`${e}-${S}`))},[n,e]),u}const L=J.useId;function de(t,e){if(L!==void 0){const n=L();return t??(e?`${e}-${n}`:n)}return ue(t,e)}function ce(t){return de(t,"base-ui")}const fe=o.createContext({controlId:void 0,registerControlId:l,labelId:void 0,setLabelId:l,messageIds:[],setMessageIds:l,getDescriptionProps:t=>t});function U(){return o.useContext(fe)}function ge(t={}){const{id:e,implicit:n=!1,controlRef:s}=t,{controlId:u,registerControlId:i}=U(),a=ce(e),r=n?u:void 0,c=A(()=>Symbol()),p=o.useRef(!1),b=o.useRef(e!=null),f=M(()=>{!p.current||i===l||(p.current=!1,i(c.current,void 0))});return v(()=>{if(i===l)return;let m;if(n){const I=s?.current;X(I)&&I.closest("label")!=null?m=e??null:m=r??a}else if(e!=null)b.current=!0,m=e;else if(b.current)m=a;else{f();return}if(m===void 0){f();return}p.current=!0,i(c.current,m)},[e,s,r,i,n,a,c,f]),o.useEffect(()=>f,[f]),u??a}function pe(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function he(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&Q(n)){let s=e;for(;s;){if(t===s)return!0;s=s.parentNode||s.host}}return!1}function Te(t){return"composedPath"in t?t.composedPath()[0]:t.target}function me({controlled:t,default:e,name:n,state:s="value"}){const{current:u}=o.useRef(t!==void 0),[i,a]=o.useState(e),r=u?t:i,c=o.useCallback(p=>{u||a(p)},[]);return[r,c]}function be(t,e,n,s,u=!0,i){const{registerFieldControl:a}=N(),r=A(()=>Symbol());v(()=>{const c=r.current;if(!u){a(c,void 0);return}a(c,{controlRef:t,getValue:s,id:e,name:i,value:n})},[t,u,s,e,i,a,r,n]),v(()=>{const c=r.current;return()=>{a(c,void 0)}},[a,r])}const ve="none",we="trigger-press",ye="trigger-hover",Fe="trigger-focus",De="outside-press",Pe="item-press",Se="close-press",Le="focus-out",Ve="escape-key",Ae="list-navigation",Me="cancel-open",_e="sibling-open",Ne="disabled",Ue="imperative-action";function Ie(t,e,n,s){let u=!1,i=!1;const a=s??V;return{reason:t,event:e??new Event("base-ui"),cancel(){u=!0},allowPropagation(){i=!0},get isCanceled(){return u},get isPropagationAllowed(){return i},trigger:n,...a}}const Ee=o.forwardRef(function(e,n){const{render:s,className:u,id:i,name:a,value:r,disabled:c=!1,onValueChange:p,defaultValue:b,autoFocus:f=!1,style:m,...I}=e,{state:O,name:k,disabled:j,setTouched:w,setDirty:B,validityData:$,setFocused:E,setFilled:R,validationMode:z,validation:g}=N(),{clearErrors:K}=le(),C=j||c,y=k??a,W={...O,disabled:C},{labelId:Y}=U(),F=ge({id:i});v(()=>{const d=r!=null;g.inputRef.current?.value||d&&r!==""?R(!0):d&&r===""&&R(!1)},[g.inputRef,R,r]);const h=o.useRef(null);v(()=>{f&&h.current===pe(ee(h.current))&&E(!0)},[f,E]);const[q]=me({controlled:r,default:b,name:"FieldControl",state:"value"}),D=r!==void 0,P=D?q:void 0,G=M(()=>g.inputRef.current?.value);return be(g.inputRef,F,P,G,!C,a),Z("input",e,{ref:[n,h],state:W,props:[{id:F,disabled:C,name:y,ref:g.inputRef,"aria-labelledby":Y,autoFocus:f,...D?{value:P}:{defaultValue:b},onChange(d){const x=d.currentTarget.value;p?.(x,Ie(ve,d.nativeEvent)),B(x!==($.initialValue??"")),R(x!==""),d.nativeEvent.defaultPrevented||(K(y),g.change(x))},onFocus(){E(!0)},onBlur(d){w(!0),E(!1),z==="onBlur"&&g.commit(d.currentTarget.value)},onKeyDown(d){d.currentTarget.tagName==="INPUT"&&d.key==="Enter"&&(w(!0),g.commit(d.currentTarget.value))}},I,d=>g.getValidationProps(C,d)],stateAttributesMapping:ae})}),Re=o.forwardRef(function(e,n){return T.jsx(Ee,{ref:n,...e})});function Oe({className:t,type:e,...n}){return T.jsx(Re,{type:e,"data-slot":"input",className:_("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none 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",t),...n})}function ke({className:t,...e}){return T.jsx("label",{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}export{ge as A,Se as B,Oe as I,ke as L,he as a,ye as b,Ie as c,Ne as d,le as e,ae as f,Te as g,N as h,Ue as i,U as j,me as k,be as l,pe as m,ve as n,ee as o,Fe as p,Ve as q,Ae as r,Le as s,we as t,ce as u,Pe as v,De as w,_e as x,de as y,Me as z};
1
+ import{r as o,X as l,h as H,E as L,aG as J,V as A,e as M,d as v,k as W,aB as Q,i as Z,j as T,f as _}from"./index-B7_Oj3hr.js";function ee(t){return t?.ownerDocument||document}const te={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ne={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},se={disabled:!1,...ne},ae={valid(t){return t===null?null:t?{"data-valid":""}:{"data-invalid":""}}},re={invalid:void 0,name:void 0,validityData:{state:te,errors:[],error:"",value:"",initialValue:null},setValidityData:l,disabled:void 0,setTouched:l,setDirty:l,setFilled:l,setFocused:l,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:se,registerFieldControl:l,validation:{getValidationProps:(t,e=L)=>e,inputRef:{current:null},registeredInputs:new Map,registerInput:l,getInputControl:()=>null,commit:async()=>{},change:l}},oe=o.createContext(re);function N(t=!0){const e=o.useContext(oe);if(e.setValidityData===l&&!t)throw new Error(H(28));return e}const ie=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:l,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function le(){return o.useContext(ie)}let S=0;function ue(t,e="mui"){const[n,s]=o.useState(t),u=t||n;return o.useEffect(()=>{n==null&&(S+=1,s(`${e}-${S}`))},[n,e]),u}const V=J.useId;function de(t,e){if(V!==void 0){const n=V();return t??(e?`${e}-${n}`:n)}return ue(t,e)}function ce(t){return de(t,"base-ui")}const fe=o.createContext({controlId:void 0,registerControlId:l,labelId:void 0,setLabelId:l,messageIds:[],setMessageIds:l,getDescriptionProps:t=>t});function U(){return o.useContext(fe)}function ge(t={}){const{id:e,implicit:n=!1,controlRef:s}=t,{controlId:u,registerControlId:i}=U(),a=ce(e),r=n?u:void 0,c=A(()=>Symbol()),p=o.useRef(!1),b=o.useRef(e!=null),f=M(()=>{!p.current||i===l||(p.current=!1,i(c.current,void 0))});return v(()=>{if(i===l)return;let m;if(n){const I=s?.current;W(I)&&I.closest("label")!=null?m=e??null:m=r??a}else if(e!=null)b.current=!0,m=e;else if(b.current)m=a;else{f();return}if(m===void 0){f();return}p.current=!0,i(c.current,m)},[e,s,r,i,n,a,c,f]),o.useEffect(()=>f,[f]),u??a}function pe(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function he(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&Q(n)){let s=e;for(;s;){if(t===s)return!0;s=s.parentNode||s.host}}return!1}function Te(t){return"composedPath"in t?t.composedPath()[0]:t.target}function me({controlled:t,default:e,name:n,state:s="value"}){const{current:u}=o.useRef(t!==void 0),[i,a]=o.useState(e),r=u?t:i,c=o.useCallback(p=>{u||a(p)},[]);return[r,c]}function be(t,e,n,s,u=!0,i){const{registerFieldControl:a}=N(),r=A(()=>Symbol());v(()=>{const c=r.current;if(!u){a(c,void 0);return}a(c,{controlRef:t,getValue:s,id:e,name:i,value:n})},[t,u,s,e,i,a,r,n]),v(()=>{const c=r.current;return()=>{a(c,void 0)}},[a,r])}const ve="none",we="trigger-press",ye="trigger-hover",Fe="trigger-focus",De="outside-press",Pe="item-press",Se="close-press",Ve="focus-out",Le="escape-key",Ae="list-navigation",Me="cancel-open",_e="sibling-open",Ne="disabled",Ue="imperative-action";function Ie(t,e,n,s){let u=!1,i=!1;const a=s??L;return{reason:t,event:e??new Event("base-ui"),cancel(){u=!0},allowPropagation(){i=!0},get isCanceled(){return u},get isPropagationAllowed(){return i},trigger:n,...a}}const Ee=o.forwardRef(function(e,n){const{render:s,className:u,id:i,name:a,value:r,disabled:c=!1,onValueChange:p,defaultValue:b,autoFocus:f=!1,style:m,...I}=e,{state:k,name:O,disabled:B,setTouched:w,setDirty:j,validityData:$,setFocused:E,setFilled:R,validationMode:G,validation:g}=N(),{clearErrors:K}=le(),C=B||c,y=O??a,X={...k,disabled:C},{labelId:Y}=U(),F=ge({id:i});v(()=>{const d=r!=null;g.inputRef.current?.value||d&&r!==""?R(!0):d&&r===""&&R(!1)},[g.inputRef,R,r]);const h=o.useRef(null);v(()=>{f&&h.current===pe(ee(h.current))&&E(!0)},[f,E]);const[q]=me({controlled:r,default:b,name:"FieldControl",state:"value"}),D=r!==void 0,P=D?q:void 0,z=M(()=>g.inputRef.current?.value);return be(g.inputRef,F,P,z,!C,a),Z("input",e,{ref:[n,h],state:X,props:[{id:F,disabled:C,name:y,ref:g.inputRef,"aria-labelledby":Y,autoFocus:f,...D?{value:P}:{defaultValue:b},onChange(d){const x=d.currentTarget.value;p?.(x,Ie(ve,d.nativeEvent)),j(x!==($.initialValue??"")),R(x!==""),d.nativeEvent.defaultPrevented||(K(y),g.change(x))},onFocus(){E(!0)},onBlur(d){w(!0),E(!1),G==="onBlur"&&g.commit(d.currentTarget.value)},onKeyDown(d){d.currentTarget.tagName==="INPUT"&&d.key==="Enter"&&(w(!0),g.commit(d.currentTarget.value))}},I,d=>g.getValidationProps(C,d)],stateAttributesMapping:ae})}),Re=o.forwardRef(function(e,n){return T.jsx(Ee,{ref:n,...e})});function ke({className:t,type:e,...n}){return T.jsx(Re,{type:e,"data-slot":"input",className:_("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none 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",t),...n})}function Oe({className:t,...e}){return T.jsx("label",{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}export{ge as A,Se as B,ke as I,Oe as L,he as a,ye as b,Ie as c,Ne as d,le as e,ae as f,Te as g,N as h,Ue as i,U as j,me as k,be as l,pe as m,ve as n,ee as o,Fe as p,Le as q,Ae as r,Ve as s,we as t,ce as u,Pe as v,De as w,_e as x,de as y,Me as z};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./createLucideIcon-CJO80vPf.js";/**
1
+ import{c as t}from"./index-B7_Oj3hr.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{u as r,Q as u,d as s}from"./useBaseQuery-yj7uWlSz.js";import{y as t}from"./index-B7_Oj3hr.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 +1 @@
1
- import{j as e,e as r}from"./index-D4yHhKPM.js";import{C as x}from"./card-D3S4369l.js";import{S as m,d as l,i as d}from"./labels--UUyt9uB.js";function p({title:t,sub:s,actions:a}){return e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:t}),s&&e.jsx("p",{className:"m-0 text-muted-foreground",children:s}),e.jsx("div",{className:"flex-1"}),a]})}function u({title:t,description:s,children:a,danger:n,cardClassName:i}){return e.jsxs("section",{className:"grid max-w-[1040px] grid-cols-1 gap-4 lg:grid-cols-[minmax(220px,1fr)_2fr] lg:gap-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:r("m-0 mb-1.5 text-[15.5px] font-semibold tracking-tight",n&&"text-destructive"),children:t}),s&&e.jsx("p",{className:"m-0 text-[13px] leading-normal text-muted-foreground",children:s})]}),e.jsx(x,{className:r("flex max-w-[640px] flex-col gap-4 p-5",n&&"border-destructive",i),children:a})]})}function g({icon:t,title:s,children:a,action:n,className:i}){return e.jsxs("div",{className:r("flex flex-col items-center gap-2 px-6 py-16 text-center",i),children:[t&&e.jsx("div",{className:"mb-1.5 flex size-11 items-center justify-center rounded-[10px] bg-muted text-ink-soft",children:t}),e.jsx("h3",{className:"m-0 text-[15px] font-semibold",children:s}),a&&e.jsx("div",{className:"m-0 max-w-[360px] text-muted-foreground",children:a}),n&&e.jsx("div",{className:"mt-2",children:n})]})}function j({status:t,className:s}){const a=d(t);return e.jsx("span",{className:r("inline-flex h-5 items-center whitespace-nowrap rounded-full px-2 text-[11.5px] font-medium leading-none",a?l[t]:"bg-muted text-muted-foreground",s),children:a?m[t]:t})}function h({children:t}){return e.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-muted-foreground",children:t})}export{g as E,p as P,j as S,u as a,h as b};
1
+ import{j as e,f as r}from"./index-B7_Oj3hr.js";import{C as x}from"./card-YnwmM74t.js";import{S as m,d as l,i as d}from"./labels--UUyt9uB.js";function p({title:t,sub:s,actions:a}){return e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:t}),s&&e.jsx("p",{className:"m-0 text-muted-foreground",children:s}),e.jsx("div",{className:"flex-1"}),a]})}function u({title:t,description:s,children:a,danger:n,cardClassName:i}){return e.jsxs("section",{className:"grid max-w-[1040px] grid-cols-1 gap-4 lg:grid-cols-[minmax(220px,1fr)_2fr] lg:gap-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:r("m-0 mb-1.5 text-[15.5px] font-semibold tracking-tight",n&&"text-destructive"),children:t}),s&&e.jsx("p",{className:"m-0 text-[13px] leading-normal text-muted-foreground",children:s})]}),e.jsx(x,{className:r("flex max-w-[640px] flex-col gap-4 p-5",n&&"border-destructive",i),children:a})]})}function g({icon:t,title:s,children:a,action:n,className:i}){return e.jsxs("div",{className:r("flex flex-col items-center gap-2 px-6 py-16 text-center",i),children:[t&&e.jsx("div",{className:"mb-1.5 flex size-11 items-center justify-center rounded-[10px] bg-muted text-ink-soft",children:t}),e.jsx("h3",{className:"m-0 text-[15px] font-semibold",children:s}),a&&e.jsx("div",{className:"m-0 max-w-[360px] text-muted-foreground",children:a}),n&&e.jsx("div",{className:"mt-2",children:n})]})}function j({status:t,className:s}){const a=d(t);return e.jsx("span",{className:r("inline-flex h-5 items-center whitespace-nowrap rounded-full px-2 text-[11.5px] font-medium leading-none",a?l[t]:"bg-muted text-muted-foreground",s),children:a?m[t]:t})}function h({children:t}){return e.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-muted-foreground",children:t})}export{g as E,p as P,j as S,u as a,h as b};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./createLucideIcon-CJO80vPf.js";/**
1
+ import{c as e}from"./index-B7_Oj3hr.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-B7_Oj3hr.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1,39 +1,39 @@
1
- import{j as e,e as C,r as g,f as As,U as Ms,V as Rs,c as Ke,W as Ge,X as Ds,m as zs,E as Is,h as es,Y as Es,g as Ps,Z as ss,$ as Ts,T as He,B as R,Q as ts,A as Bs,a0 as Je,n as _s,a1 as Qe,a2 as Fs,a3 as Os,a4 as Ls,a5 as Vs,a6 as qs,a7 as Us,L as ns,z as Ws,_ as Xe,C as ie,a8 as Ks,x as he}from"./index-D4yHhKPM.js";import{u as le}from"./useQuery-yeUPHKKg.js";import{C as as}from"./check-CjehM7M4.js";import{f as Gs,e as Hs,h as Js,j as Qs,u as Ze,k as Xs,l as Zs,c as Ys,n as et,L as Te,I as je}from"./label-BGuYH_Ll.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-GyPeOagK.js";import{u as it}from"./FieldItemContext-DkOlIwHg.js";import{u as lt}from"./useAriaLabelledBy-C3DXCwhM.js";import{u as dt}from"./useValueChanged-BwMBSSVy.js";import{E as Ye,D as Y,i as ee,j as se,o as Be,p as X,k as ce,m as G,l as _e,n as us,S as ct}from"./dropdown-menu-BOoXJZ3W.js";import{A as te,a as ne}from"./avatar-KLKmXBKs.js";import{b as Fe,S as ms,E as Ee}from"./parts-DJaBw8EG.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-DbrG17rp.js";import{I as xt}from"./image-off-BYE-vNh9.js";import{c as Z}from"./createLucideIcon-CJO80vPf.js";import{C as pt}from"./chevron-right-CtWPB3ox.js";import{I as ht}from"./InstallTag-DahspVU0.js";import{u as ft}from"./me-B-0XXdLF.js";import{A as gt}from"./arrow-left-aeWIKOlS.js";import"./useBaseQuery-B_iu1J2b.js";import"./CompositeItem-DooiJvYh.js";import"./card-D3S4369l.js";/**
1
+ import{c as Q,j as e,f as C,r as g,h as As,V as Ms,W as Rs,d as Ke,X as Ge,Y as Ds,m as zs,E as Is,i as es,Z as Es,g as Ps,$ as ss,a0 as Ts,T as He,B as R,S as ts,A as Bs,a1 as Je,o as _s,a2 as Xe,a3 as Fs,a4 as Os,a5 as Ls,a6 as Vs,a7 as qs,a8 as Us,L as ns,C as Ws,_ as Ze,D as ie,a9 as Ks,y as he}from"./index-B7_Oj3hr.js";import{u as le}from"./useQuery-CBgK187B.js";import{C as as}from"./check-CLHnIgiu.js";import{f as Gs,e as Hs,h as Js,j as Xs,u as Qe,k as Zs,l as Qs,c as Ys,n as et,L as Te,I as je}from"./label-Dpq7t35_.js";import{L as st,M as tt,N as nt,A as at,O as rt,X as ot,E as rs,G as os,I as is,H as ls,J as ds,K as cs}from"./dialog-BO8bYmy1.js";import{u as it}from"./FieldItemContext-DVEWRsEB.js";import{u as lt}from"./useAriaLabelledBy-BNUj3f_d.js";import{u as dt}from"./useValueChanged-DQ0Iea1L.js";import{E as Ye,D as Y,i as ee,j as se,o as Be,p as Z,k as ce,m as G,l as _e,n as us,S as ct}from"./dropdown-menu-NLHjhAUe.js";import{A as te,a as ne}from"./avatar-DlHbKa1H.js";import{b as Fe,S as ms,E as Ee}from"./parts-C1QjM02Y.js";import{S as ae,i as ut,a as ue,b as ve,c as fe}from"./labels--UUyt9uB.js";import{C as mt}from"./copy-ZOZ0pLVD.js";import{I as xt}from"./image-off-Dg9jTwH7.js";import{C as pt}from"./chevron-right-BX_QQNXH.js";import{I as ht}from"./InstallTag-B_qg9P2r.js";import{u as ft}from"./me-DoCJgtG9.js";import{A as gt}from"./arrow-left-D2obUiWw.js";import"./useBaseQuery-yj7uWlSz.js";import"./CompositeItem-B5AtyrD6.js";import"./card-YnwmM74t.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const bt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ge=Z("chevron-down",bt);/**
6
+ */const bt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ge=Q("chevron-down",bt);/**
7
7
  * @license lucide-react v1.39.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const jt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],vt=Z("columns-2",jt);/**
11
+ */const jt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],vt=Q("columns-2",jt);/**
12
12
  * @license lucide-react v1.39.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const kt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],yt=Z("inbox",kt);/**
16
+ */const kt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],yt=Q("inbox",kt);/**
17
17
  * @license lucide-react v1.39.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const Nt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],wt=Z("list",Nt);/**
21
+ */const Nt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],wt=Q("list",Nt);/**
22
22
  * @license lucide-react v1.39.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const Ct=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],St=Z("rotate-cw",Ct);/**
26
+ */const Ct=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],St=Q("rotate-cw",Ct);/**
27
27
  * @license lucide-react v1.39.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const $t=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],At=Z("user-plus",$t);/**
31
+ */const $t=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],At=Q("user-plus",$t);/**
32
32
  * @license lucide-react v1.39.0 - ISC
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const Mt=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Rt=Z("user-round",Mt);function de({className:s,...t}){return e.jsx("div",{"data-slot":"skeleton",className:C("animate-pulse rounded-md bg-muted",s),...t})}function Dt(s){if(!s)return null;for(const t of s.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const c=t;if(c.type==="submit")return c}}return null}function xs(s){return{checked(t){return s.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...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}=Qs(),j=It(),T=j?.allValues===void 0?void 0:j.parent,L=T!==void 0,M=w||Ce.disabled||j?.disabled||k,q=p??f,z=N??q,Le=Ze(),Ve=Ze();let K=h||Se;L&&(r?K=Ve:z!==void 0?K=`${T.id}-${z}`:K||=Ve);let $e={};L&&(r?$e=T.getParentProps():z!==void 0&&($e=T.getChildProps(z)));const{checked:qe=c,indeterminate:fs=y,onCheckedChange:gs,...bs}=$e,Ae=j?.value,me=g.useRef(null),xe=Ms(()=>Symbol()),Me=g.useRef(!1),{getButtonProps:js,buttonRef:vs}=Rs({disabled:M,native:E}),re=j?.validation??we,[V,ks]=Xs({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]),Zs(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 Q=U?[...j.value,z]:j.value.filter(pe=>pe!==z);j.setValue(Q,J)}},onClick(b){b.stopPropagation()},onFocus(){me.current?.focus()}},N!==void 0?{value:(j?V&&N:N)||""}:Is,m,b=>re.getValidationProps(M,b));g.useEffect(()=>{if(!T||z===void 0)return;const b=T.disabledStatesRef.current;return b.set(z,M),()=>{b.delete(z)}},[T,M,z]);const De=g.useMemo(()=>({...A,checked:Re,disabled:M,readOnly:S,required:$,indeterminate:oe}),[A,Re,M,S,$,oe]),Ss=xs(De),$s=es("span",t,{state:De,ref:[vs,me,a],props:[{id:E?K??void 0:Le,role:"checkbox","aria-checked":oe?"mixed":Re,"aria-readonly":S||void 0,"aria-required":$||void 0,"aria-labelledby":ws,[Pt]:r?"":void 0,onFocus(){M||_(!0)},onBlur(){const b=H.current;b&&(ke(!0),_(!1),ye==="onBlur"&&re.commit(j?Ae:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const U=H.current?.form??null,J=b.currentTarget,Q=b.nativeEvent,pe=b.preventDefault,ze=Q.preventDefault;let Ie=!1;b.preventDefault=()=>{Ie=!0,pe.call(b)},Q.preventDefault=()=>{Ie=!0,ze.call(Q)},ze.call(Q),Ps(J).queueMicrotask(()=>{b.preventDefault=pe,Q.preventDefault=ze,Ie||Dt(U)?.click()})},onClick(b){if(S||M)return;b.preventDefault();const U=H.current;U&&Es(U,b)}},D,bs,js,m,b=>re.getValidationProps(M,b)],stateAttributesMapping:Ss});return e.jsxs(ps.Provider,{value:De,children:[$s,!V&&!j&&q&&!r&&I!==void 0&&e.jsx("input",{type:"hidden",form:d,name:q,value:I,disabled:M}),e.jsx("input",{...Cs,suppressHydrationWarning:!0})]})}),Bt=g.forwardRef(function(t,a){const{render:c,className:x,style:o,keepMounted:l=!1,...k}=t,d=Et(),h=d.checked||d.indeterminate,{mounted:y,transitionStatus:i,setMounted:f}=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(`
36
+ */const Mt=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Rt=Q("user-round",Mt);function de({className:s,...t}){return e.jsx("div",{"data-slot":"skeleton",className:C("animate-pulse rounded-md bg-muted",s),...t})}function Dt(s){if(!s)return null;for(const t of s.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const c=t;if(c.type==="submit")return c}}return null}function xs(s){return{checked(t){return s.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...Gs}}const zt=g.createContext(void 0);function It(){return g.useContext(zt)}const ps=g.createContext(void 0);function Et(){const s=g.useContext(ps);if(s===void 0)throw new Error(As(14));return s}const Pt="data-parent",Tt=g.forwardRef(function(t,a){const{checked:c,className:x,defaultChecked:o=!1,"aria-labelledby":l,disabled:k=!1,form:d,id:h,indeterminate:y=!1,inputRef:i,name:f,onCheckedChange:v,parent:r=!1,readOnly:S=!1,render:F,required:$=!1,uncheckedValue:I,value:N,nativeButton:E=!1,style:B,...D}=t,{clearErrors:u}=Hs(),{disabled:w,name:p,setDirty:O,setFilled:P,setFocused:_,setTouched:ke,state:A,validationMode:ye,validityData:Ne,validation:we}=Js(),Ce=it(),{labelId:W,controlId:Se,registerControlId:n,getDescriptionProps:m}=Xs(),j=It(),T=j?.allValues===void 0?void 0:j.parent,L=T!==void 0,M=w||Ce.disabled||j?.disabled||k,q=p??f,z=N??q,Le=Qe(),Ve=Qe();let K=h||Se;L&&(r?K=Ve:z!==void 0?K=`${T.id}-${z}`:K||=Ve);let $e={};L&&(r?$e=T.getParentProps():z!==void 0&&($e=T.getChildProps(z)));const{checked:qe=c,indeterminate:fs=y,onCheckedChange:gs,...bs}=$e,Ae=j?.value,me=g.useRef(null),xe=Ms(()=>Symbol()),Me=g.useRef(!1),{getButtonProps:js,buttonRef:vs}=Rs({disabled:M,native:E}),re=j?.validation??we,[V,ks]=Zs({controlled:z!==void 0&&Ae!==void 0&&!r?Ae.includes(z):qe,default:o,name:"Checkbox",state:"checked"}),Re=L?!!qe:V,oe=L&&fs||y;Ke(()=>{n!==Ge&&(Me.current=!0,n(xe.current,K))},[K,n,xe]),g.useEffect(()=>{const b=xe.current;return()=>{!Me.current||n===Ge||(Me.current=!1,n(b,void 0))}},[n,xe]),Qs(me,Le,V,void 0,!j&&!M,f);const H=g.useRef(null),Ue=re.registerInput,We=j?z:void 0,ys=g.useCallback(b=>Ue(b,{controlRef:me,value:We}),[Ue,We]),Ns=Ds(i,H,r?void 0:ys),ws=lt(l,W,H,!E,K??void 0);Ke(()=>{H.current&&(H.current.indeterminate=oe,V&&P(!0))},[V,oe,P]),dt(V,()=>{j||(u(q),P(V),O(V!==Ne.initialValue),re.change(V))});const Cs=zs({checked:V,disabled:M,form:d,name:r?void 0:q,id:E?void 0:K??void 0,required:$,ref:Ns,style:q?st:tt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(S){b.preventDefault();return}const U=b.currentTarget.checked,J=Ys(et,b.nativeEvent);if(v?.(U,J),!J.isCanceled&&(gs?.(U,J),!J.isCanceled&&(ks(U),z!==void 0&&j!==void 0&&!r&&!L))){const X=U?[...j.value,z]:j.value.filter(pe=>pe!==z);j.setValue(X,J)}},onClick(b){b.stopPropagation()},onFocus(){me.current?.focus()}},N!==void 0?{value:(j?V&&N:N)||""}:Is,m,b=>re.getValidationProps(M,b));g.useEffect(()=>{if(!T||z===void 0)return;const b=T.disabledStatesRef.current;return b.set(z,M),()=>{b.delete(z)}},[T,M,z]);const De=g.useMemo(()=>({...A,checked:Re,disabled:M,readOnly:S,required:$,indeterminate:oe}),[A,Re,M,S,$,oe]),Ss=xs(De),$s=es("span",t,{state:De,ref:[vs,me,a],props:[{id:E?K??void 0:Le,role:"checkbox","aria-checked":oe?"mixed":Re,"aria-readonly":S||void 0,"aria-required":$||void 0,"aria-labelledby":ws,[Pt]:r?"":void 0,onFocus(){M||_(!0)},onBlur(){const b=H.current;b&&(ke(!0),_(!1),ye==="onBlur"&&re.commit(j?Ae:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const U=H.current?.form??null,J=b.currentTarget,X=b.nativeEvent,pe=b.preventDefault,ze=X.preventDefault;let Ie=!1;b.preventDefault=()=>{Ie=!0,pe.call(b)},X.preventDefault=()=>{Ie=!0,ze.call(X)},ze.call(X),Ps(J).queueMicrotask(()=>{b.preventDefault=pe,X.preventDefault=ze,Ie||Dt(U)?.click()})},onClick(b){if(S||M)return;b.preventDefault();const U=H.current;U&&Es(U,b)}},D,bs,js,m,b=>re.getValidationProps(M,b)],stateAttributesMapping:Ss});return e.jsxs(ps.Provider,{value:De,children:[$s,!V&&!j&&q&&!r&&I!==void 0&&e.jsx("input",{type:"hidden",form:d,name:q,value:I,disabled:M}),e.jsx("input",{...Cs,suppressHydrationWarning:!0})]})}),Bt=g.forwardRef(function(t,a){const{render:c,className:x,style:o,keepMounted:l=!1,...k}=t,d=Et(),h=d.checked||d.indeterminate,{mounted:y,transitionStatus:i,setMounted:f}=nt(h),v=g.useRef(null),r={...d,transitionStatus:i};at({open:h,ref:v,onComplete(){h||f(!1)}});const F={...xs(d),...rt},$=l||y,I=es("span",t,{ref:[a,v],state:r,stateAttributesMapping:F,props:k});return $?I:null});function _t({className:s,...t}){return e.jsx(Tt,{"data-slot":"checkbox",className:C("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",s),...t,children:e.jsx(Bt,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(as,{})})})}function Ft({className:s,...t}){return e.jsx("textarea",{"data-slot":"textarea",className:C("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",s),...t})}const Ot={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"};function Lt(s,t,a={}){const c=a.fence??((u,w)=>w),x=a.statusLabel??(u=>Ot[u]??u),o=s.anchor??{},l=s.context??{},k=o.page,d=k?.route??s.route??"/",h=k?.origin??t.origin??"",y=k?.pathname??d,i=h?`${h}${y}`:y,f=typeof o.label=="string"?c("label",o.label):"",v=o.element??o,r=[];r.push(`# ${s.key}${f?` — ${f}`:""}`),r.push(""),r.push(`${t.name} · ${x(s.status)} · left by ${s.createdBy?.name?c("name",s.createdBy.name):"someone"} on ${s.createdAt.slice(0,10)}`+(s.assignee?` · assigned to ${c("name",s.assignee.name)}`:"")),r.push(""),r.push("## Where to look"),r.push(""),r.push(`- Page: ${i}`),h&&r.push(`- Open on the page: ${h}${y}?${ss("t")}=${encodeURIComponent(s.key)}`),f&&r.push(`- Element: ${f}`);const S=typeof o.css=="string"?o.css:typeof v.selector=="string"?v.selector:"";if(S&&r.push(`- Selector: \`${c("selector",S)}\``),typeof o.domid=="string"&&r.push(`- DOM id: \`#${c("selector",o.domid)}\``),typeof v.role=="string"){const u=typeof v.accessibleName=="string"?` “${c("label",v.accessibleName)}”`:"";r.push(`- Role: ${c("label",v.role)}${u}`)}typeof v.testId=="string"&&r.push(`- Test id: ${c("label",v.testId)}`);const F=o.text;F?.exact&&r.push(`- Text: “${c("label",F.exact)}”`),r.push(`- Anchor: ${s.anchorState??"unknown"}`),r.push(""),r.push("## What's wrong"),r.push("");const $=(s.comments??[]).filter(u=>u.body!==null);$.length===0&&r.push("> (no comment — a pin with no words)");for(const u of $){const w=u.author?.name?c("name",u.author.name):"Anonymous";r.push(`> **${w}${u.author?.kind==="agent"?" (agent)":""}** — ${u.createdAt.slice(0,16).replace("T"," ")}`);for(const p of c("body",String(u.body)).split(`
37
37
  `))r.push(`> ${p}`);r.push(">")}r[r.length-1]===">"&&r.pop(),r.push(""),r.push("## Environment"),r.push("");const I=l.derived,N=l.viewport;(I?.browser||I?.os)&&r.push(`- Browser: ${[I.browser,I.os,I.device].filter(Boolean).join(" · ")}`),N?.w&&r.push(`- Viewport: ${N.w} × ${N.h}${N.dpr?` @${Math.round(N.dpr*10)/10}x`:""}`),l.prefersColorScheme&&r.push(`- Colour scheme: ${l.prefersColorScheme}`),l.language&&r.push(`- Language: ${l.language}`),l.ua&&r.push(`- User agent: ${c("label",String(l.ua))}`);const E=l.build;E&&Object.keys(E).length&&r.push(`- Build: ${Object.entries(E).map(([u,w])=>`${u}=${c("label",String(w))}`).join(", ")}`),r.push("");const B=l.breadcrumbs;if(B?.length){r.push(`## Breadcrumbs (${B.length}, oldest first)`),r.push("");for(const u of B)r.push(`- \`${String(u.t).slice(11,19)}\` ${u.type}${u.level?`/${u.level}`:""}: ${c("breadcrumb",String(u.message))}`);r.push("")}const D=s.attachments?.find(u=>u.kind==="screenshot")??s.attachments?.[0];if(D){r.push("## Screenshot"),r.push(""),r.push("Examine this screenshot for visual context — it is the viewport at the moment of the click."),r.push("");const u=D.url.startsWith("http")?D.url:`${t.dashboardOrigin??""}${D.url}`;r.push(`![${s.key}${D.width?` at ${D.width}×${D.height}`:""}](${u})`),r.push("")}return r.join(`
38
38
  `).trimEnd()+`
39
- `}function Vt(s,t){return Lt(s,t,{statusLabel:a=>ut(a)?ae[a]:a})}function qt({thread:s,site:t,onStatus:a,onReply:c,replying:x,onClose:o,pool:l,onAssign:k,onAddPerson:d,trackers:h,onCreateIssue:y,creatingIssue:i}){const f=s.anchor??{},v=s.context??{},r=typeof f.label=="string"?f.label:"",S=f.page,F=S?.route??s.route??"/",$=S?.origin??t.origin,I=$?`${$}${S?.pathname??F}?${ss("t")}=${encodeURIComponent(s.key)}`:"",N=s.attachments?.find(p=>p.kind==="screenshot")??s.attachments?.[0],[E,B]=g.useState(""),[D,u]=g.useState(""),w=()=>{navigator.clipboard?.writeText(Vt(s,{name:t.name,...$?{origin:$}:{},dashboardOrigin:location.origin})),ts.success("Copied as a brief")};return e.jsxs("article",{className:"flex min-h-0 flex-col","aria-label":`${s.key} — ${r||"a comment"}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2.5",children:[e.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:s.key}),e.jsx(Ut,{status:s.status,onStatus:a}),e.jsx(Jt,{assignee:s.assignee??null,pool:l,onAssign:k,onAddPerson:d}),(h??[]).map(p=>{const O=s.refs?.find(P=>P.provider===p&&P.kind===Ts[p]&&P.status!=="detached");if(O){const P=p==="github"?`Issue #${O.externalId}`:p==="jira"?O.externalId:p==="slack"?"Slack message":/\/issue\/([A-Z][A-Z0-9]*-\d+)/.exec(O.url)?.[1]??`${He[p]} issue`;return e.jsxs(R,{variant:"ghost",size:"sm",render:e.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Ye,{}),P]},p)}return y?e.jsx(R,{variant:"ghost",size:"sm",disabled:!!i,onClick:()=>y(p),children:i===p?p==="slack"?"Posting…":"Creating…":p==="slack"?"Post to Slack":`Create ${He[p]} issue`},p):null}),e.jsx("div",{className:"flex-1"}),e.jsxs(R,{variant:"ghost",size:"sm",onClick:w,children:[e.jsx(mt,{}),"Copy as brief"]}),e.jsx(R,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:o,children:e.jsx(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(X,{value:a,children:ae[a]},a))})})]})}function Wt({state:s}){const t=s==="anchored"?"bg-ok-soft text-ok":s==="approximate"?"bg-muted text-ink-soft":"bg-warn-soft text-destructive",a=s==="anchored"?"Anchored":s==="approximate"?"Approximate":s==="orphaned"?"Orphaned":s;return e.jsx("span",{className:C("rounded-full px-2 py-0.5 text-[11.5px] font-medium",t),children:a})}function Kt({ctx:s}){const t=s.capture;if(!t)return null;const a=[];return t.screenshot&&t.screenshot!=="ok"&&a.push(`Screenshot ${t.screenshot}${t.reasons?.length?` — ${t.reasons.join("; ")}`:""}`),t.breadcrumbs&&t.breadcrumbs!=="ok"&&a.push(`Breadcrumbs ${t.breadcrumbs}`),t.blindSpots?.length&&a.push(`${t.blindSpots.length} blind spot${t.blindSpots.length===1?"":"s"}: ${t.blindSpots.join("; ")}`),t.droppedCategories?.length&&a.push(`Dropped: ${t.droppedCategories.join(", ")}`),a.length?e.jsx("ul",{className:"m-0 list-none p-0 text-[12px] text-caution",children:a.map(c=>e.jsx("li",{children:c},c))}):null}function Gt({ctx:s}){const t=s.derived,a=s.viewport,c=s.build,x=[];return t?.browser||t?.os?x.push(["Browser",[t.browser,t.os,t.device].filter(Boolean).join(" · ")]):s.ua&&x.push(["User agent",String(s.ua)]),a?.w&&x.push(["Viewport",`${a.w} × ${a.h}${a.dpr?` @${Math.round(a.dpr*10)/10}x`:""}`]),s.language&&x.push(["Language",String(s.language)]),c&&Object.keys(c).length&&x.push(["Build",Object.entries(c).map(([o,l])=>`${o} ${String(l)}`).join(" · ")]),x.length?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fe,{children:"Environment"}),e.jsx("button",{type:"button",className:"text-[11.5px] text-brand hover:underline",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(s,null,2)),ts.success("Copied the environment")},children:"copy as JSON"})]}),e.jsx("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:x.map(([o,l])=>e.jsxs("span",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:o}),e.jsx("dd",{className:C("m-0",o==="Build"&&"font-mono text-[12px] text-ink-soft"),children:l})]},o))})]}):null}function Ht({ctx:s}){const t=s.breadcrumbs,[a,c]=g.useState(!1);if(!t?.length)return null;const x=t.filter(o=>o.level==="error"||o.type==="error").length;return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":a,onClick:()=>c(!a),children:[e.jsx(pt,{className:C("size-3.5 text-muted-foreground transition-transform",a&&"rotate-90")}),t.length," breadcrumb",t.length===1?"":"s",x>0?` · ${x} error${x===1?"":"s"} before the click`:"",e.jsx("span",{className:"ml-auto text-[12px] text-muted-foreground",children:a?"hide":"show"})]}),a&&e.jsx("ol",{className:"m-0 flex list-none flex-col gap-1 p-0 font-mono text-[11.5px]",children:t.map((o,l)=>e.jsxs("li",{className:C("flex gap-2",(o.level==="error"||o.type==="error")&&"text-destructive"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:o.t.slice(11,19)}),e.jsxs("span",{className:"shrink-0 w-14 text-muted-foreground",children:[o.type,o.level?`/${o.level}`:""]}),e.jsx("span",{className:"min-w-0 break-words",children:o.message})]},l))})]})}function Jt({assignee:s,pool:t,onAssign:a,onAddPerson:c}){const[x,o]=g.useState(!1),l=t.find(i=>i.isMe),k=t.filter(i=>i.isTeam),d=t.filter(i=>!i.isTeam),h=i=>a({id:i.id,name:i.name,kind:i.kind,isTeam:i.isTeam}),y=i=>e.jsxs(G,{onClick:()=>h(i),children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",i.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(i.name,i.email)})}),e.jsx("span",{className:"truncate",children:i.isMe?`${i.name} (you)`:i.name}),s?.id===i.id&&e.jsx(as,{className:"ml-auto size-3.5"})]},i.id);return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx(R,{variant:"ghost",size:"sm","aria-label":s?`Assignee: ${s.name}`:"Assignee"}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",s.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.name)})}),e.jsx("span",{className:"max-w-[150px] truncate",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(Rt,{}),"Assign"]})}),e.jsxs(se,{align:"start",className:"min-w-56",children:[l&&s?.id!==l.id||s?e.jsxs(ce,{children:[l&&s?.id!==l.id&&e.jsx(G,{onClick:()=>h(l),children:"Assign to me"}),s&&e.jsx(G,{onClick:()=>a(null),children:"Unassign"})]}):null,k.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"The studio"}),k.map(y)]}),d.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"People who commented"}),d.map(y)]}),e.jsx(us,{}),e.jsx(ce,{children:e.jsxs(G,{onClick:()=>o(!0),children:[e.jsx(At,{}),"Add a person…"]})})]})]}),e.jsx(Qt,{open:x,onOpenChange:o,onAdd:async i=>{const f=await c(i);h(f)}})]})}function Qt({open:s,onOpenChange:t,onAdd:a}){const[c,x]=g.useState(""),[o,l]=g.useState(""),[k,d]=g.useState(!1),[h,y]=g.useState(""),i=async f=>{if(f.preventDefault(),!(!c.trim()||k)){d(!0),y("");try{await a({name:c.trim(),...o.trim()?{email:o.trim()}:{}}),x(""),l(""),t(!1)}catch(v){y(v instanceof Bs?v.message:"Could not add the person.")}finally{d(!1)}}};return e.jsx(rs,{open:s,onOpenChange:t,children:e.jsx(os,{children:e.jsxs("form",{onSubmit:f=>void i(f),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Add a person"}),e.jsx(ds,{children:"Somebody to assign comments to who has not commented yet — your client, before they have said anything. If they later open a review link with this email, their comments join up."})]}),h&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:h}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-name",children:"Name"}),e.jsx(je,{id:"person-name",placeholder:"Sofia",value:c,onChange:f=>x(f.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-email",children:"Email (optional)"}),e.jsx(je,{id:"person-email",type:"email",placeholder:"sofia@acme.com",value:o,onChange:f=>l(f.target.value)})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!c.trim()||k,children:k?"Adding…":"Add and assign"})]})]})})})}function Xt({rounds:s,active:t,onPick:a,onStart:c,starting:x}){const o=s.find(i=>i.number===t),l=(s[0]?.number??0)+1,[k,d]=g.useState(!1),[h,y]=g.useState("");return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-line-strong bg-muted px-2.5 text-[12.5px] font-semibold text-foreground","aria-label":"Round"}),children:[e.jsx(St,{className:"size-3.5"}),o?.name??`Round ${t}`,e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"start",className:"w-[260px]",children:[e.jsxs(ce,{children:[e.jsx(_e,{children:"Rounds"}),s.map(i=>e.jsxs(G,{onClick:()=>a(i.number),children:[e.jsx("span",{className:"truncate",children:i.name}),e.jsxs("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:[i.closed?"closed":"open",i.unresolved>0?` · ${i.unresolved} to go`:""]})]},i.id))]}),e.jsx(us,{}),e.jsxs(G,{onClick:()=>{y(`Round ${l}`),d(!0)},children:["Start a new round…",e.jsx("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:"closes this one"})]})]})]}),o&&e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.closed?"closed":"open",o.unresolved>0?` · ${o.unresolved} to go`:o.closed?"":" · all clear"]}),e.jsx(rs,{open:k,onOpenChange:d,children:e.jsx(os,{children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:i=>{i.preventDefault(),!(!h.trim()||x)&&(c(h.trim()),d(!1))},children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Start a new round"}),e.jsxs(ds,{children:["A round is one pass of feedback. Starting the next one closes ",o?.name??"the current one","; what is still open there stays counted, not carried over."]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"round-name",children:"Name"}),e.jsx(je,{id:"round-name",value:h,onChange:i=>y(i.target.value),autoFocus:!0})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!h.trim()||x,children:x?"Starting…":"Start the round"})]})]})})})]})}Ws({thread:ie().optional(),status:ie().optional(),page:ie().optional(),q:ie().optional(),sort:Xe(["newest","oldest"]).optional(),round:Ks().int().positive().optional(),assignee:ie().optional(),view:Xe(["board"]).optional()});const hs={open:"bg-status-open",progress:"bg-status-progress",review:"bg-status-review",resolved:"bg-status-resolved"};function Sn(){const{site:s}=Je.useParams(),t=Je.useSearch(),a=_s(),x=ft().projects.find(n=>n.uid===s),o=le(he.origins(s)),l=le(he.rounds(s)),k=le(he.assignees(s)),d=le(he.siteIntegrations(s)),h=k.data?.data??[],y=h.find(n=>n.isMe)?.id,i=t.round??l.data?.data[0]?.number,f=g.useMemo(()=>({...i!==void 0?{round:i}:{},...t.page?{route:t.page}:{},...t.q?{q:t.q}:{}}),[i,t.page,t.q]),v=le({...Qe(s,f),enabled:l.isSuccess}),r=Qe(s,f).queryKey,S=Fs(s,r),F=Os(r),$=Ls(s,r),I=Vs(s),N=qs(s,r),E=Us(s),[B,D]=g.useState(new Set),u=n=>void a({to:"/s/$site/comments",params:{site:s},search:m=>({...m,...n}),replace:!0}),w=v.data?.data??[],p=g.useMemo(()=>new Set((t.status??"").split(",").filter(Boolean)),[t.status]),O=g.useMemo(()=>{const n=new Map;for(const m of w)n.set(m.status,(n.get(m.status)??0)+1);return n},[w]),P=g.useMemo(()=>[...new Set(w.map(n=>Oe(n)))].sort(),[w]),_=g.useMemo(()=>{let n=p.size?w.filter(m=>p.has(m.status)):w;return t.assignee==="unassigned"?n=n.filter(m=>!m.assignee):t.assignee==="me"?n=n.filter(m=>!!y&&m.assignee?.id===y):t.assignee&&(n=n.filter(m=>m.assignee?.id===t.assignee)),t.sort==="oldest"&&(n=[...n].reverse()),n},[w,p,t.sort,t.assignee,y]),ke=g.useMemo(()=>{const n=new Map;for(const m of _){const j=Oe(m);n.has(j)||n.set(j,[]),n.get(j).push(m)}return[...n.entries()]},[_]),A=t.thread?w.find(n=>n.key===t.thread)??null:null,ye=p.size>0||!!t.page||!!t.q||!!t.assignee,Ne=(l.data?.data??[]).filter(n=>n.number!==i&&n.unresolved>0),we=n=>{const m=new Set(p);m.has(n)?m.delete(n):m.add(n),u({status:[...m].join(",")||void 0})},Ce=async n=>{const m=[...B];D(new Set);for(const j of m)await S.mutateAsync({id:j,status:n}).catch(()=>{})};g.useEffect(()=>{const n=m=>{if(m.metaKey||m.ctrlKey||m.altKey)return;const j=m.target;if(j&&(j.closest("input,textarea,select,[contenteditable]")||j.isContentEditable))return;const T=m.key.toLowerCase();if(T!=="j"&&T!=="k"&&T!=="e"||_.length===0)return;if(m.preventDefault(),T==="e"){if(!A)return;S.mutate({id:A.id,status:A.status==="resolved"?"open":"resolved"});return}const L=A?_.findIndex(z=>z.id===A.id):-1,M=T==="j"?Math.min(L+1,_.length-1):Math.max(L-1,0),q=_[L===-1?0:M];q&&u({thread:q.key})};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)});const W=t.view==="board",Se=g.useMemo(()=>fe.map(n=>({status:n,items:_.filter(m=>m.status===n)})),[_]);return e.jsxs("div",{className:"flex h-[calc(100dvh-3rem)] min-h-0 flex-col",children:[e.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-4 py-2",children:B.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[13px] font-medium",children:[B.size," selected"]}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Move to"}),fe.map(n=>e.jsx(R,{variant:"outline",size:"sm",onClick:()=>void Ce(n),children:ae[n]},n)),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>D(new Set),children:"Clear"})]}):e.jsxs(e.Fragment,{children:[l.data&&l.data.data.length>0&&i!==void 0&&e.jsx(Xt,{rounds:l.data.data,active:i,onPick:n=>u({round:n,thread:void 0}),onStart:n=>E.mutate(n,{onSuccess:m=>u({round:m.number,thread:void 0,status:void 0})}),starting:E.isPending}),e.jsx("span",{className:"mx-1 h-[18px] w-px bg-border"}),e.jsxs(Pe,{on:p.size===0,onClick:()=>u({status:void 0}),children:["All ",e.jsx("span",{className:"text-muted-foreground",children:w.length})]}),fe.map(n=>e.jsxs(Pe,{on:p.has(n),onClick:()=>we(n),children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[n])}),ae[n]," ",e.jsx("span",{className:"text-muted-foreground",children:O.get(n)??0})]},n)),e.jsx("div",{className:"flex-1"}),e.jsxs(Pe,{on:W,onClick:()=>u({view:W?void 0:"board"}),children:[W?e.jsx(wt,{className:"size-3.5"}):e.jsx(vt,{className:"size-3.5"}),W?"List":"Board"]}),e.jsx(Yt,{value:t.q??"",onChange:n=>u({q:n||void 0})}),P.length>1&&e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.page)}),children:[t.page??"All pages",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"end",children:[e.jsx(G,{onClick:()=>u({page:void 0}),children:"All pages"}),P.map(n=>e.jsx(G,{onClick:()=>u({page:n}),children:e.jsx("span",{className:"font-mono text-[12px]",children:n})},n))]})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.assignee),"aria-label":"Filter by assignee"}),children:[Zt(t.assignee,h),e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.assignee??"any",onValueChange:n=>u({assignee:n==="any"?void 0:n}),children:[e.jsx(X,{value:"any",children:"Anyone"}),e.jsx(X,{value:"unassigned",children:"Unassigned"}),y&&e.jsx(X,{value:"me",children:"Me"}),h.filter(n=>!n.isMe).map(n=>e.jsx(X,{value:n.id,children:n.name},n.id))]})})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!1)}),children:[t.sort==="oldest"?"Oldest":"Newest",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.sort??"newest",onValueChange:n=>u({sort:n==="oldest"?"oldest":void 0}),children:[e.jsx(X,{value:"newest",children:"Newest first"}),e.jsx(X,{value:"oldest",children:"Oldest first"})]})})]})]})}),Ne.map(n=>e.jsxs("button",{type:"button",className:"shrink-0 border-b border-border/60 bg-brand-soft px-4 py-1.5 text-left text-[12.5px] text-foreground",onClick:()=>u({round:n.number,thread:void 0}),children:[e.jsxs("b",{className:"font-semibold",children:[n.unresolved," unresolved"]})," in ",n.name," — still open, not carried over."," ",e.jsx("span",{className:"text-brand",children:"Go there"})]},n.id)),e.jsxs("div",{className:C("grid min-h-0 flex-1",A?"grid-cols-1 lg:grid-cols-[minmax(0,1fr)_520px]":"grid-cols-1"),children:[e.jsxs("div",{className:C("min-h-0 overflow-auto lg:border-r lg:border-border",A&&"hidden lg:block"),children:[v.isPending&&e.jsx(sn,{}),v.isError&&e.jsx(Ee,{title:"Could not load the comments",children:v.error.message}),v.isSuccess&&w.length===0&&!ye&&e.jsx("div",{className:"mx-auto max-w-[560px] py-8",children:e.jsxs(Ee,{icon:e.jsx(yt,{className:"size-5"}),title:"No comments yet",children:[e.jsxs("p",{className:"m-0",children:["When someone leaves a comment on ",x.name," it appears here, grouped by page."]}),e.jsx("div",{className:"mt-4 text-left",children:e.jsx(ht,{uid:s})})]})}),v.isSuccess&&w.length>0&&_.length===0&&e.jsx(Ee,{title:"Nothing matches",action:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>u({status:void 0,page:void 0,q:void 0,assignee:void 0}),children:"Show all"}),children:"No comment matches that filter."}),W&&v.isSuccess&&_.length>0&&e.jsx(tn,{columns:Se,uid:s,selectedId:A?.id??null,onMove:(n,m)=>S.mutate({id:n,status:m})}),!W&&ke.map(([n,m])=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border/60 bg-background px-4 py-2 font-mono text-[12px] text-ink-soft",children:[n," ",e.jsxs("span",{className:"font-sans text-muted-foreground",children:["· ",m.length]})]}),m.map(j=>e.jsx(en,{t:j,uid:s,on:A?.id===j.id,picked:B.has(j.id),picking:B.size>0,onPick:T=>D(L=>{const M=new Set(L);return T?M.add(j.id):M.delete(j.id),M})},j.id))]},n))]}),A&&e.jsxs("div",{className:"min-h-0 overflow-hidden bg-card",children:[e.jsx("div",{className:"lg:hidden",children:e.jsxs(R,{variant:"ghost",size:"sm",className:"m-2",onClick:()=>u({thread:void 0}),children:[e.jsx(gt,{}),"Back to the list"]})}),e.jsx(qt,{thread:A,site:{name:x.name,...o.data?.origins[0]?{origin:o.data.origins[0]}:{}},onStatus:n=>S.mutate({id:A.id,status:n}),onReply:n=>F.mutateAsync({id:A.id,body:n}),replying:F.isPending,pool:h,onAssign:n=>$.mutate({id:A.id,assignee:n}),onAddPerson:n=>I.mutateAsync(n),trackers:(d.data?.data??[]).map(n=>n.provider),onCreateIssue:n=>N.mutate({id:A.id,provider:n}),creatingIssue:N.isPending?N.variables?.provider:void 0,onClose:()=>u({thread:void 0})})]})]})]})}function Zt(s,t){return s?s==="unassigned"?"Unassigned":s==="me"?"Me":t.find(a=>a.id===s)?.name??"Assignee":"Assignee"}function Oe(s){return s.anchor?.page?.route??s.route??"/"}function be(s){return C("inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",s&&"border-line-strong bg-muted text-foreground")}function Pe({on:s,onClick:t,children:a}){return e.jsx("button",{type:"button",className:be(s),"aria-pressed":s,onClick:t,children:a})}function Yt({value:s,onChange:t}){const[a,c]=g.useState(s);return e.jsxs("form",{className:"relative",onSubmit:x=>{x.preventDefault(),t(a.trim())},children:[e.jsx(ct,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(je,{type:"search","aria-label":"Search comments",placeholder:"Search",value:a,onChange:x=>c(x.target.value),onBlur:()=>a.trim()!==s&&t(a.trim()),className:"h-7 w-[170px] pl-7 text-[12.5px]"})]})}function en({t:s,uid:t,on:a,picked:c,picking:x,onPick:o}){const l=s.comments[0]?.body??(typeof s.anchor?.label=="string"?s.anchor.label:"(no comment)"),k=s.comments[0]?.body&&typeof s.anchor?.label=="string"?s.anchor.label:"";return e.jsxs("div",{className:C("group grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 bg-card px-4 hover:bg-accent/60",a&&"bg-brand-soft hover:bg-brand-soft"),children:[e.jsx("span",{className:C("flex items-center",!x&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:e.jsx(_t,{checked:c,onCheckedChange:d=>o(!!d),"aria-label":`Select ${s.key}`})}),e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:d=>({...d,thread:s.key}),className:"contents text-foreground",children:[e.jsx("span",{className:"font-mono text-[11.5px] text-muted-foreground",children:s.key}),e.jsxs("span",{className:"truncate text-[13.5px]",children:[l,k&&e.jsx("small",{className:"ml-2 text-[12px] text-muted-foreground",children:k})]}),e.jsxs("span",{className:"flex items-center gap-2.5 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:s.createdBy.name||"someone"}),s.assignee&&e.jsx(te,{className:"size-5",title:`Assigned to ${s.assignee.name}`,children:e.jsx(ne,{className:C("text-[9px] font-semibold",s.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.assignee.name)})}),e.jsx(ms,{status:s.status}),e.jsx("span",{className:"w-11 whitespace-nowrap text-right",children:ve(s.updatedAt)})]})]})]})}function sn(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-border/60 bg-background px-4 py-2",children:e.jsx(de,{className:"h-3 w-16"})}),[70,55,80,62].map((s,t)=>e.jsxs("div",{className:"grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx("span",{}),e.jsx(de,{className:"h-3 w-10"}),e.jsx(de,{className:"h-3",style:{width:`${s}%`}}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(de,{className:"h-3 w-11"}),e.jsx(de,{className:"h-[18px] w-16 rounded-full"})]})]},t))]})}function tn({columns:s,uid:t,selectedId:a,onMove:c}){const[x,o]=g.useState(null);return e.jsx("div",{className:"flex h-full min-h-0 gap-3 overflow-x-auto p-3",children:s.map(({status:l,items:k})=>e.jsxs("section",{"aria-label":ae[l],onDragOver:d=>{d.preventDefault(),o(l)},onDragLeave:()=>o(d=>d===l?null:d),onDrop:d=>{d.preventDefault(),o(null);const h=d.dataTransfer.getData("text/plain");h&&c(h,l)},className:C("flex w-[280px] shrink-0 flex-col rounded-lg border border-border bg-muted/40",x===l&&"border-brand bg-brand-soft"),children:[e.jsxs("h3",{className:"m-0 flex items-center gap-2 px-3 py-2 text-[12px] font-medium",children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[l])}),ae[l],e.jsx("span",{className:"text-muted-foreground",children:k.length})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2 pt-0",children:[k.length===0&&e.jsx("p",{className:"m-0 px-1 py-3 text-[12px] text-muted-foreground",children:"Nothing here."}),k.map(d=>e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:h=>({...h,thread:d.key}),draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",d.id),h.dataTransfer.effectAllowed="move"},className:C("flex cursor-grab flex-col gap-1.5 rounded-md border border-border bg-card p-2.5 text-foreground no-underline active:cursor-grabbing",a===d.id&&"border-brand ring-1 ring-brand"),children:[e.jsx("span",{className:"line-clamp-3 text-[13px]",children:d.comments[0]?.body??(typeof d.anchor?.label=="string"?d.anchor.label:"(no comment)")}),e.jsxs("span",{className:"flex items-center gap-2 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:d.key}),e.jsx("span",{className:"truncate",children:Oe(d)}),e.jsx("span",{className:"flex-1"}),d.assignee&&e.jsx(te,{className:"size-4",title:`Assigned to ${d.assignee.name}`,children:e.jsx(ne,{className:C("text-[8px] font-semibold",d.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(d.assignee.name)})}),e.jsx("span",{children:ve(d.updatedAt)})]})]},d.id))]})]},l))})}export{Sn as component,ut as isStatus};
39
+ `}function Vt(s,t){return Lt(s,t,{statusLabel:a=>ut(a)?ae[a]:a})}function qt({thread:s,site:t,onStatus:a,onReply:c,replying:x,onClose:o,pool:l,onAssign:k,onAddPerson:d,trackers:h,onCreateIssue:y,creatingIssue:i}){const f=s.anchor??{},v=s.context??{},r=typeof f.label=="string"?f.label:"",S=f.page,F=S?.route??s.route??"/",$=S?.origin??t.origin,I=$?`${$}${S?.pathname??F}?${ss("t")}=${encodeURIComponent(s.key)}`:"",N=s.attachments?.find(p=>p.kind==="screenshot")??s.attachments?.[0],[E,B]=g.useState(""),[D,u]=g.useState(""),w=()=>{navigator.clipboard?.writeText(Vt(s,{name:t.name,...$?{origin:$}:{},dashboardOrigin:location.origin})),ts.success("Copied as a brief")};return e.jsxs("article",{className:"flex min-h-0 flex-col","aria-label":`${s.key} — ${r||"a comment"}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2.5",children:[e.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:s.key}),e.jsx(Ut,{status:s.status,onStatus:a}),e.jsx(Jt,{assignee:s.assignee??null,pool:l,onAssign:k,onAddPerson:d}),(h??[]).map(p=>{const O=s.refs?.find(P=>P.provider===p&&P.kind===Ts[p]&&P.status!=="detached");if(O){const P=p==="github"?`Issue #${O.externalId}`:p==="jira"?O.externalId:p==="slack"?"Slack message":/\/issue\/([A-Z][A-Z0-9]*-\d+)/.exec(O.url)?.[1]??`${He[p]} issue`;return e.jsxs(R,{variant:"ghost",size:"sm",render:e.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Ye,{}),P]},p)}return y?e.jsx(R,{variant:"ghost",size:"sm",disabled:!!i,onClick:()=>y(p),children:i===p?p==="slack"?"Posting…":"Creating…":p==="slack"?"Post to Slack":`Create ${He[p]} issue`},p):null}),e.jsx("div",{className:"flex-1"}),e.jsxs(R,{variant:"ghost",size:"sm",onClick:w,children:[e.jsx(mt,{}),"Copy as brief"]}),e.jsx(R,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:o,children:e.jsx(ot,{})})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-5 overflow-auto px-4 py-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[16px] font-semibold leading-snug tracking-tight",children:r||"A comment on this page"}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:F}),$&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("a",{href:`${$}${S?.pathname??F}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-brand hover:underline",children:[$.replace(/^https?:\/\//,""),e.jsx(Ye,{className:"size-3"})]})]}),I&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("a",{href:I,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"Open on the page"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[s.comments.length===0&&e.jsx("p",{className:"m-0 text-muted-foreground",children:"A pin with no words — the element says what it is about."}),s.comments.map(p=>e.jsxs("div",{className:"flex gap-2.5",children:[e.jsx(te,{className:"size-6 shrink-0",children:e.jsx(ne,{className:C("text-[10px] font-semibold",p.author.kind==="agent"?"bg-muted text-ink-soft":"bg-brand-soft text-brand"),children:ue(p.author.name,"?")})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2 text-[12px] text-muted-foreground",children:[e.jsx("b",{className:"text-[13px] font-semibold text-foreground",children:p.author.name||"Anonymous"}),p.author.kind==="agent"&&e.jsx("span",{className:"rounded-sm bg-muted px-1 text-[10.5px] font-medium uppercase tracking-wide",children:"agent"}),e.jsx("span",{children:ve(p.createdAt)})]}),e.jsx("p",{className:"m-0 whitespace-pre-wrap text-[13.5px] leading-normal",children:p.body??e.jsx("i",{className:"text-muted-foreground",children:"deleted"})})]})]},p.id)),e.jsxs("form",{className:"flex gap-2.5",onSubmit:async p=>{p.preventDefault();const O=E.trim();if(!(!O||x)){u("");try{await c(O),B("")}catch(P){u(P instanceof Error?P.message:"Could not send that reply.")}}},children:[e.jsx(te,{className:"size-6 shrink-0",children:e.jsx(ne,{className:"bg-primary text-[10px] font-semibold text-primary-foreground",children:"you"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2 rounded-md border border-input bg-card p-2",children:[e.jsx(Ft,{"aria-label":"Reply",placeholder:`Reply to ${s.createdBy.name||"the reviewer"}…`,value:E,onChange:p=>B(p.target.value),rows:2,className:"min-h-0 resize-none border-0 bg-transparent p-1 shadow-none focus-visible:ring-0"}),D&&e.jsx("p",{role:"alert",className:"m-0 text-[12px] text-destructive",children:D}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.status==="resolved"?e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("open"),children:"Reopen"}):e.jsxs(e.Fragment,{children:[s.status!=="review"&&e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("review"),children:"Mark in review"}),e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("resolved"),children:"Mark resolved"})]}),e.jsx(R,{type:"submit",size:"sm",disabled:!E.trim()||x,children:x?"Sending…":"Reply"})]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Fe,{children:"Screenshot"}),N?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:N.url,target:"_blank",rel:"noreferrer",className:"block overflow-hidden rounded-lg border border-border bg-background",children:e.jsx("img",{src:N.url,alt:`The page when ${s.key} was left`,width:N.width,height:N.height,loading:"lazy",className:"block h-auto w-full"})}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[N.width??"?"," × ",N.height??"?",v.prefersColorScheme?` · ${v.prefersColorScheme}`:""," · taken at the click, ",ve(s.createdAt)," ·"," ",e.jsx("a",{href:N.url,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"open full size"})]})]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-border px-3 py-3 text-[12.5px] text-muted-foreground",children:[e.jsx(xt,{className:"size-4 shrink-0"}),e.jsx("span",{children:"No screenshot for this one — either no bucket was connected when it was left, or the reviewer turned the picture off. The element and the environment below are unaffected."})]}),e.jsx(Kt,{ctx:v})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Fe,{children:"Element"}),e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[r&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Label"}),e.jsx("dd",{className:"m-0",children:r})]}),typeof f.css=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Selector"}),e.jsx("dd",{className:"m-0 break-all font-mono text-[12px] text-ink-soft",children:f.css})]}),typeof f.domid=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"DOM id"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:["#",f.domid]})]}),typeof f.role=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Role"}),e.jsxs("dd",{className:"m-0",children:[f.role,typeof f.accessibleName=="string"?` “${f.accessibleName}”`:""]})]}),f.text?.exact&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Text"}),e.jsxs("dd",{className:"m-0",children:["“",String(f.text.exact),"”"]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Anchor"}),e.jsx("dd",{className:"m-0",children:e.jsx(Wt,{state:s.anchorState})})]})]}),e.jsx(Gt,{ctx:v}),e.jsx(Ht,{ctx:v})]})]})}function Ut({status:s,onStatus:t}){return e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx("button",{type:"button",className:"inline-flex items-center rounded-full","aria-label":"Status"}),children:e.jsx(ms,{status:s})}),e.jsx(se,{align:"start",className:"w-[180px]",children:e.jsx(Be,{value:s,onValueChange:a=>t(a),children:fe.map(a=>e.jsx(Z,{value:a,children:ae[a]},a))})})]})}function Wt({state:s}){const t=s==="anchored"?"bg-ok-soft text-ok":s==="approximate"?"bg-muted text-ink-soft":"bg-warn-soft text-destructive",a=s==="anchored"?"Anchored":s==="approximate"?"Approximate":s==="orphaned"?"Orphaned":s;return e.jsx("span",{className:C("rounded-full px-2 py-0.5 text-[11.5px] font-medium",t),children:a})}function Kt({ctx:s}){const t=s.capture;if(!t)return null;const a=[];return t.screenshot&&t.screenshot!=="ok"&&a.push(`Screenshot ${t.screenshot}${t.reasons?.length?` — ${t.reasons.join("; ")}`:""}`),t.breadcrumbs&&t.breadcrumbs!=="ok"&&a.push(`Breadcrumbs ${t.breadcrumbs}`),t.blindSpots?.length&&a.push(`${t.blindSpots.length} blind spot${t.blindSpots.length===1?"":"s"}: ${t.blindSpots.join("; ")}`),t.droppedCategories?.length&&a.push(`Dropped: ${t.droppedCategories.join(", ")}`),a.length?e.jsx("ul",{className:"m-0 list-none p-0 text-[12px] text-caution",children:a.map(c=>e.jsx("li",{children:c},c))}):null}function Gt({ctx:s}){const t=s.derived,a=s.viewport,c=s.build,x=[];return t?.browser||t?.os?x.push(["Browser",[t.browser,t.os,t.device].filter(Boolean).join(" · ")]):s.ua&&x.push(["User agent",String(s.ua)]),a?.w&&x.push(["Viewport",`${a.w} × ${a.h}${a.dpr?` @${Math.round(a.dpr*10)/10}x`:""}`]),s.language&&x.push(["Language",String(s.language)]),c&&Object.keys(c).length&&x.push(["Build",Object.entries(c).map(([o,l])=>`${o} ${String(l)}`).join(" · ")]),x.length?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fe,{children:"Environment"}),e.jsx("button",{type:"button",className:"text-[11.5px] text-brand hover:underline",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(s,null,2)),ts.success("Copied the environment")},children:"copy as JSON"})]}),e.jsx("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:x.map(([o,l])=>e.jsxs("span",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:o}),e.jsx("dd",{className:C("m-0",o==="Build"&&"font-mono text-[12px] text-ink-soft"),children:l})]},o))})]}):null}function Ht({ctx:s}){const t=s.breadcrumbs,[a,c]=g.useState(!1);if(!t?.length)return null;const x=t.filter(o=>o.level==="error"||o.type==="error").length;return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":a,onClick:()=>c(!a),children:[e.jsx(pt,{className:C("size-3.5 text-muted-foreground transition-transform",a&&"rotate-90")}),t.length," breadcrumb",t.length===1?"":"s",x>0?` · ${x} error${x===1?"":"s"} before the click`:"",e.jsx("span",{className:"ml-auto text-[12px] text-muted-foreground",children:a?"hide":"show"})]}),a&&e.jsx("ol",{className:"m-0 flex list-none flex-col gap-1 p-0 font-mono text-[11.5px]",children:t.map((o,l)=>e.jsxs("li",{className:C("flex gap-2",(o.level==="error"||o.type==="error")&&"text-destructive"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:o.t.slice(11,19)}),e.jsxs("span",{className:"shrink-0 w-14 text-muted-foreground",children:[o.type,o.level?`/${o.level}`:""]}),e.jsx("span",{className:"min-w-0 break-words",children:o.message})]},l))})]})}function Jt({assignee:s,pool:t,onAssign:a,onAddPerson:c}){const[x,o]=g.useState(!1),l=t.find(i=>i.isMe),k=t.filter(i=>i.isTeam),d=t.filter(i=>!i.isTeam),h=i=>a({id:i.id,name:i.name,kind:i.kind,isTeam:i.isTeam}),y=i=>e.jsxs(G,{onClick:()=>h(i),children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",i.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(i.name,i.email)})}),e.jsx("span",{className:"truncate",children:i.isMe?`${i.name} (you)`:i.name}),s?.id===i.id&&e.jsx(as,{className:"ml-auto size-3.5"})]},i.id);return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx(R,{variant:"ghost",size:"sm","aria-label":s?`Assignee: ${s.name}`:"Assignee"}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",s.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.name)})}),e.jsx("span",{className:"max-w-[150px] truncate",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(Rt,{}),"Assign"]})}),e.jsxs(se,{align:"start",className:"min-w-56",children:[l&&s?.id!==l.id||s?e.jsxs(ce,{children:[l&&s?.id!==l.id&&e.jsx(G,{onClick:()=>h(l),children:"Assign to me"}),s&&e.jsx(G,{onClick:()=>a(null),children:"Unassign"})]}):null,k.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"The studio"}),k.map(y)]}),d.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"People who commented"}),d.map(y)]}),e.jsx(us,{}),e.jsx(ce,{children:e.jsxs(G,{onClick:()=>o(!0),children:[e.jsx(At,{}),"Add a person…"]})})]})]}),e.jsx(Xt,{open:x,onOpenChange:o,onAdd:async i=>{const f=await c(i);h(f)}})]})}function Xt({open:s,onOpenChange:t,onAdd:a}){const[c,x]=g.useState(""),[o,l]=g.useState(""),[k,d]=g.useState(!1),[h,y]=g.useState(""),i=async f=>{if(f.preventDefault(),!(!c.trim()||k)){d(!0),y("");try{await a({name:c.trim(),...o.trim()?{email:o.trim()}:{}}),x(""),l(""),t(!1)}catch(v){y(v instanceof Bs?v.message:"Could not add the person.")}finally{d(!1)}}};return e.jsx(rs,{open:s,onOpenChange:t,children:e.jsx(os,{children:e.jsxs("form",{onSubmit:f=>void i(f),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Add a person"}),e.jsx(ds,{children:"Somebody to assign comments to who has not commented yet — your client, before they have said anything. If they later open a review link with this email, their comments join up."})]}),h&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:h}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-name",children:"Name"}),e.jsx(je,{id:"person-name",placeholder:"Sofia",value:c,onChange:f=>x(f.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-email",children:"Email (optional)"}),e.jsx(je,{id:"person-email",type:"email",placeholder:"sofia@acme.com",value:o,onChange:f=>l(f.target.value)})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(R,{type:"submit",loading:k,disabled:!c.trim(),children:k?"Adding…":"Add and assign"})]})]})})})}function Zt({rounds:s,active:t,onPick:a,onStart:c,starting:x}){const o=s.find(i=>i.number===t),l=(s[0]?.number??0)+1,[k,d]=g.useState(!1),[h,y]=g.useState("");return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-line-strong bg-muted px-2.5 text-[12.5px] font-semibold text-foreground","aria-label":"Round"}),children:[e.jsx(St,{className:"size-3.5"}),o?.name??`Round ${t}`,e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"start",className:"w-[260px]",children:[e.jsxs(ce,{children:[e.jsx(_e,{children:"Rounds"}),s.map(i=>e.jsxs(G,{onClick:()=>a(i.number),children:[e.jsx("span",{className:"truncate",children:i.name}),e.jsxs("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:[i.closed?"closed":"open",i.unresolved>0?` · ${i.unresolved} to go`:""]})]},i.id))]}),e.jsx(us,{}),e.jsxs(G,{onClick:()=>{y(`Round ${l}`),d(!0)},children:["Start a new round…",e.jsx("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:"closes this one"})]})]})]}),o&&e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.closed?"closed":"open",o.unresolved>0?` · ${o.unresolved} to go`:o.closed?"":" · all clear"]}),e.jsx(rs,{open:k,onOpenChange:d,children:e.jsx(os,{children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:i=>{i.preventDefault(),!(!h.trim()||x)&&(c(h.trim()),d(!1))},children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Start a new round"}),e.jsxs(ds,{children:["A round is one pass of feedback. Starting the next one closes ",o?.name??"the current one","; what is still open there stays counted, not carried over."]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"round-name",children:"Name"}),e.jsx(je,{id:"round-name",value:h,onChange:i=>y(i.target.value),autoFocus:!0})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!h.trim()||x,children:x?"Starting…":"Start the round"})]})]})})})]})}Ws({thread:ie().optional(),status:ie().optional(),page:ie().optional(),q:ie().optional(),sort:Ze(["newest","oldest"]).optional(),round:Ks().int().positive().optional(),assignee:ie().optional(),view:Ze(["board"]).optional()});const hs={open:"bg-status-open",progress:"bg-status-progress",review:"bg-status-review",resolved:"bg-status-resolved"};function Cn(){const{site:s}=Je.useParams(),t=Je.useSearch(),a=_s(),x=ft().projects.find(n=>n.uid===s),o=le(he.origins(s)),l=le(he.rounds(s)),k=le(he.assignees(s)),d=le(he.siteIntegrations(s)),h=k.data?.data??[],y=h.find(n=>n.isMe)?.id,i=t.round??l.data?.data[0]?.number,f=g.useMemo(()=>({...i!==void 0?{round:i}:{},...t.page?{route:t.page}:{},...t.q?{q:t.q}:{}}),[i,t.page,t.q]),v=le({...Xe(s,f),enabled:l.isSuccess}),r=Xe(s,f).queryKey,S=Fs(s,r),F=Os(r),$=Ls(s,r),I=Vs(s),N=qs(s,r),E=Us(s),[B,D]=g.useState(new Set),u=n=>void a({to:"/s/$site/comments",params:{site:s},search:m=>({...m,...n}),replace:!0}),w=v.data?.data??[],p=g.useMemo(()=>new Set((t.status??"").split(",").filter(Boolean)),[t.status]),O=g.useMemo(()=>{const n=new Map;for(const m of w)n.set(m.status,(n.get(m.status)??0)+1);return n},[w]),P=g.useMemo(()=>[...new Set(w.map(n=>Oe(n)))].sort(),[w]),_=g.useMemo(()=>{let n=p.size?w.filter(m=>p.has(m.status)):w;return t.assignee==="unassigned"?n=n.filter(m=>!m.assignee):t.assignee==="me"?n=n.filter(m=>!!y&&m.assignee?.id===y):t.assignee&&(n=n.filter(m=>m.assignee?.id===t.assignee)),t.sort==="oldest"&&(n=[...n].reverse()),n},[w,p,t.sort,t.assignee,y]),ke=g.useMemo(()=>{const n=new Map;for(const m of _){const j=Oe(m);n.has(j)||n.set(j,[]),n.get(j).push(m)}return[...n.entries()]},[_]),A=t.thread?w.find(n=>n.key===t.thread)??null:null,ye=p.size>0||!!t.page||!!t.q||!!t.assignee,Ne=(l.data?.data??[]).filter(n=>n.number!==i&&n.unresolved>0),we=n=>{const m=new Set(p);m.has(n)?m.delete(n):m.add(n),u({status:[...m].join(",")||void 0})},Ce=async n=>{const m=[...B];D(new Set);for(const j of m)await S.mutateAsync({id:j,status:n}).catch(()=>{})};g.useEffect(()=>{const n=m=>{if(m.metaKey||m.ctrlKey||m.altKey)return;const j=m.target;if(j&&(j.closest("input,textarea,select,[contenteditable]")||j.isContentEditable))return;const T=m.key.toLowerCase();if(T!=="j"&&T!=="k"&&T!=="e"||_.length===0)return;if(m.preventDefault(),T==="e"){if(!A)return;S.mutate({id:A.id,status:A.status==="resolved"?"open":"resolved"});return}const L=A?_.findIndex(z=>z.id===A.id):-1,M=T==="j"?Math.min(L+1,_.length-1):Math.max(L-1,0),q=_[L===-1?0:M];q&&u({thread:q.key})};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)});const W=t.view==="board",Se=g.useMemo(()=>fe.map(n=>({status:n,items:_.filter(m=>m.status===n)})),[_]);return e.jsxs("div",{className:"flex h-[calc(100dvh-3rem)] min-h-0 flex-col",children:[e.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-4 py-2",children:B.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[13px] font-medium",children:[B.size," selected"]}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Move to"}),fe.map(n=>e.jsx(R,{variant:"outline",size:"sm",onClick:()=>void Ce(n),children:ae[n]},n)),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>D(new Set),children:"Clear"})]}):e.jsxs(e.Fragment,{children:[l.data&&l.data.data.length>0&&i!==void 0&&e.jsx(Zt,{rounds:l.data.data,active:i,onPick:n=>u({round:n,thread:void 0}),onStart:n=>E.mutate(n,{onSuccess:m=>u({round:m.number,thread:void 0,status:void 0})}),starting:E.isPending}),e.jsx("span",{className:"mx-1 h-[18px] w-px bg-border"}),e.jsxs(Pe,{on:p.size===0,onClick:()=>u({status:void 0}),children:["All ",e.jsx("span",{className:"text-muted-foreground",children:w.length})]}),fe.map(n=>e.jsxs(Pe,{on:p.has(n),onClick:()=>we(n),children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[n])}),ae[n]," ",e.jsx("span",{className:"text-muted-foreground",children:O.get(n)??0})]},n)),e.jsx("div",{className:"flex-1"}),e.jsxs(Pe,{on:W,onClick:()=>u({view:W?void 0:"board"}),children:[W?e.jsx(wt,{className:"size-3.5"}):e.jsx(vt,{className:"size-3.5"}),W?"List":"Board"]}),e.jsx(Yt,{value:t.q??"",onChange:n=>u({q:n||void 0})}),P.length>1&&e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.page)}),children:[t.page??"All pages",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"end",children:[e.jsx(G,{onClick:()=>u({page:void 0}),children:"All pages"}),P.map(n=>e.jsx(G,{onClick:()=>u({page:n}),children:e.jsx("span",{className:"font-mono text-[12px]",children:n})},n))]})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.assignee),"aria-label":"Filter by assignee"}),children:[Qt(t.assignee,h),e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.assignee??"any",onValueChange:n=>u({assignee:n==="any"?void 0:n}),children:[e.jsx(Z,{value:"any",children:"Anyone"}),e.jsx(Z,{value:"unassigned",children:"Unassigned"}),y&&e.jsx(Z,{value:"me",children:"Me"}),h.filter(n=>!n.isMe).map(n=>e.jsx(Z,{value:n.id,children:n.name},n.id))]})})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!1)}),children:[t.sort==="oldest"?"Oldest":"Newest",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.sort??"newest",onValueChange:n=>u({sort:n==="oldest"?"oldest":void 0}),children:[e.jsx(Z,{value:"newest",children:"Newest first"}),e.jsx(Z,{value:"oldest",children:"Oldest first"})]})})]})]})}),Ne.map(n=>e.jsxs("button",{type:"button",className:"shrink-0 border-b border-border/60 bg-brand-soft px-4 py-1.5 text-left text-[12.5px] text-foreground",onClick:()=>u({round:n.number,thread:void 0}),children:[e.jsxs("b",{className:"font-semibold",children:[n.unresolved," unresolved"]})," in ",n.name," — still open, not carried over."," ",e.jsx("span",{className:"text-brand",children:"Go there"})]},n.id)),e.jsxs("div",{className:C("grid min-h-0 flex-1",A?"grid-cols-1 lg:grid-cols-[minmax(0,1fr)_520px]":"grid-cols-1"),children:[e.jsxs("div",{className:C("min-h-0 overflow-auto lg:border-r lg:border-border",A&&"hidden lg:block"),children:[v.isPending&&e.jsx(sn,{}),v.isError&&e.jsx(Ee,{title:"Could not load the comments",children:v.error.message}),v.isSuccess&&w.length===0&&!ye&&e.jsx("div",{className:"mx-auto max-w-[560px] py-8",children:e.jsxs(Ee,{icon:e.jsx(yt,{className:"size-5"}),title:"No comments yet",children:[e.jsxs("p",{className:"m-0",children:["When someone leaves a comment on ",x.name," it appears here, grouped by page."]}),e.jsx("div",{className:"mt-4 text-left",children:e.jsx(ht,{uid:s})})]})}),v.isSuccess&&w.length>0&&_.length===0&&e.jsx(Ee,{title:"Nothing matches",action:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>u({status:void 0,page:void 0,q:void 0,assignee:void 0}),children:"Show all"}),children:"No comment matches that filter."}),W&&v.isSuccess&&_.length>0&&e.jsx(tn,{columns:Se,uid:s,selectedId:A?.id??null,onMove:(n,m)=>S.mutate({id:n,status:m})}),!W&&ke.map(([n,m])=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border/60 bg-background px-4 py-2 font-mono text-[12px] text-ink-soft",children:[n," ",e.jsxs("span",{className:"font-sans text-muted-foreground",children:["· ",m.length]})]}),m.map(j=>e.jsx(en,{t:j,uid:s,on:A?.id===j.id,picked:B.has(j.id),picking:B.size>0,onPick:T=>D(L=>{const M=new Set(L);return T?M.add(j.id):M.delete(j.id),M})},j.id))]},n))]}),A&&e.jsxs("div",{className:"min-h-0 overflow-hidden bg-card",children:[e.jsx("div",{className:"lg:hidden",children:e.jsxs(R,{variant:"ghost",size:"sm",className:"m-2",onClick:()=>u({thread:void 0}),children:[e.jsx(gt,{}),"Back to the list"]})}),e.jsx(qt,{thread:A,site:{name:x.name,...o.data?.origins[0]?{origin:o.data.origins[0]}:{}},onStatus:n=>S.mutate({id:A.id,status:n}),onReply:n=>F.mutateAsync({id:A.id,body:n}),replying:F.isPending,pool:h,onAssign:n=>$.mutate({id:A.id,assignee:n}),onAddPerson:n=>I.mutateAsync(n),trackers:(d.data?.data??[]).map(n=>n.provider),onCreateIssue:n=>N.mutate({id:A.id,provider:n}),creatingIssue:N.isPending?N.variables?.provider:void 0,onClose:()=>u({thread:void 0})})]})]})]})}function Qt(s,t){return s?s==="unassigned"?"Unassigned":s==="me"?"Me":t.find(a=>a.id===s)?.name??"Assignee":"Assignee"}function Oe(s){return s.anchor?.page?.route??s.route??"/"}function be(s){return C("inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",s&&"border-line-strong bg-muted text-foreground")}function Pe({on:s,onClick:t,children:a}){return e.jsx("button",{type:"button",className:be(s),"aria-pressed":s,onClick:t,children:a})}function Yt({value:s,onChange:t}){const[a,c]=g.useState(s);return e.jsxs("form",{className:"relative",onSubmit:x=>{x.preventDefault(),t(a.trim())},children:[e.jsx(ct,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(je,{type:"search","aria-label":"Search comments",placeholder:"Search",value:a,onChange:x=>c(x.target.value),onBlur:()=>a.trim()!==s&&t(a.trim()),className:"h-7 w-[170px] pl-7 text-[12.5px]"})]})}function en({t:s,uid:t,on:a,picked:c,picking:x,onPick:o}){const l=s.comments[0]?.body??(typeof s.anchor?.label=="string"?s.anchor.label:"(no comment)"),k=s.comments[0]?.body&&typeof s.anchor?.label=="string"?s.anchor.label:"";return e.jsxs("div",{className:C("group grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 bg-card px-4 hover:bg-accent/60",a&&"bg-brand-soft hover:bg-brand-soft"),children:[e.jsx("span",{className:C("flex items-center",!x&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:e.jsx(_t,{checked:c,onCheckedChange:d=>o(!!d),"aria-label":`Select ${s.key}`})}),e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:d=>({...d,thread:s.key}),className:"contents text-foreground",children:[e.jsx("span",{className:"font-mono text-[11.5px] text-muted-foreground",children:s.key}),e.jsxs("span",{className:"truncate text-[13.5px]",children:[l,k&&e.jsx("small",{className:"ml-2 text-[12px] text-muted-foreground",children:k})]}),e.jsxs("span",{className:"flex items-center gap-2.5 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:s.createdBy.name||"someone"}),s.assignee&&e.jsx(te,{className:"size-5",title:`Assigned to ${s.assignee.name}`,children:e.jsx(ne,{className:C("text-[9px] font-semibold",s.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.assignee.name)})}),e.jsx(ms,{status:s.status}),e.jsx("span",{className:"w-11 whitespace-nowrap text-right",children:ve(s.updatedAt)})]})]})]})}function sn(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-border/60 bg-background px-4 py-2",children:e.jsx(de,{className:"h-3 w-16"})}),[70,55,80,62].map((s,t)=>e.jsxs("div",{className:"grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx("span",{}),e.jsx(de,{className:"h-3 w-10"}),e.jsx(de,{className:"h-3",style:{width:`${s}%`}}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(de,{className:"h-3 w-11"}),e.jsx(de,{className:"h-[18px] w-16 rounded-full"})]})]},t))]})}function tn({columns:s,uid:t,selectedId:a,onMove:c}){const[x,o]=g.useState(null);return e.jsx("div",{className:"flex h-full min-h-0 gap-3 overflow-x-auto p-3",children:s.map(({status:l,items:k})=>e.jsxs("section",{"aria-label":ae[l],onDragOver:d=>{d.preventDefault(),o(l)},onDragLeave:()=>o(d=>d===l?null:d),onDrop:d=>{d.preventDefault(),o(null);const h=d.dataTransfer.getData("text/plain");h&&c(h,l)},className:C("flex w-[280px] shrink-0 flex-col rounded-lg border border-border bg-muted/40",x===l&&"border-brand bg-brand-soft"),children:[e.jsxs("h3",{className:"m-0 flex items-center gap-2 px-3 py-2 text-[12px] font-medium",children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[l])}),ae[l],e.jsx("span",{className:"text-muted-foreground",children:k.length})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2 pt-0",children:[k.length===0&&e.jsx("p",{className:"m-0 px-1 py-3 text-[12px] text-muted-foreground",children:"Nothing here."}),k.map(d=>e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:h=>({...h,thread:d.key}),draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",d.id),h.dataTransfer.effectAllowed="move"},className:C("flex cursor-grab flex-col gap-1.5 rounded-md border border-border bg-card p-2.5 text-foreground no-underline active:cursor-grabbing",a===d.id&&"border-brand ring-1 ring-brand"),children:[e.jsx("span",{className:"line-clamp-3 text-[13px]",children:d.comments[0]?.body??(typeof d.anchor?.label=="string"?d.anchor.label:"(no comment)")}),e.jsxs("span",{className:"flex items-center gap-2 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:d.key}),e.jsx("span",{className:"truncate",children:Oe(d)}),e.jsx("span",{className:"flex-1"}),d.assignee&&e.jsx(te,{className:"size-4",title:`Assigned to ${d.assignee.name}`,children:e.jsx(ne,{className:C("text-[8px] font-semibold",d.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(d.assignee.name)})}),e.jsx("span",{children:ve(d.updatedAt)})]})]},d.id))]})]},l))})}export{Cn as component,ut as isStatus};
@@ -0,0 +1 @@
1
+ import{ar as A,r as f,j as e,B as g,as as S,f as E,at as I,y as k,P,C as L,D as y}from"./index-B7_Oj3hr.js";import{u as C}from"./useQuery-CBgK187B.js";import{u as F,a as M}from"./zod-BUdBrC5l.js";import{C as D}from"./card-YnwmM74t.js";import{X as U,E as $,G as B,I as H,H as z,J as K,K as V}from"./dialog-BO8bYmy1.js";import{L as N,I as Y}from"./label-Dpq7t35_.js";import{T as q,a as G,b as T,c as p,d as J,e as j}from"./table-DdjoxL3-.js";import{C as O}from"./ConfirmDialog-ClUMXHe1.js";import{C as Q}from"./CopyButton-DCsj-LZV.js";import{P as X,E as W}from"./parts-C1QjM02Y.js";import{b as R}from"./labels--UUyt9uB.js";import{C as Z}from"./check-CLHnIgiu.js";import{U as _}from"./users-DDrXwrCG.js";import{P as ee}from"./plus-D247LXUb.js";import"./useBaseQuery-yj7uWlSz.js";import"./copy-ZOZ0pLVD.js";function be(){const{site:s}=A.useParams(),{site:d}=A.useRouteContext(),r=C(k.links(s)),l=C(k.origins(s)),[x,n]=f.useState(!1),[t,a]=f.useState(null);f.useEffect(()=>a(null),[s]);const i=r.data?.data??[],c=l.data?.origins[0]?.replace(/\/+$/,"")??"",m=t?`${c}/${t.fragment}`:"",v=e.jsxs(g,{onClick:()=>n(!0),children:[e.jsx(ee,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(X,{title:"Reviewers",sub:`Each reviewer gets their own link to ${d.name}`,actions:v}),t&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(Z,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[t.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:m}),e.jsx(Q,{text:m,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>a(null),children:e.jsx(U,{})})]}),r.isSuccess&&i.length===0?e.jsx(D,{className:"max-w-[1040px]",children:e.jsx(W,{icon:e.jsx(_,{className:"size-5"}),title:"No reviewers yet",action:v,children:"Add your client and send them their link. They never need an account."})}):e.jsx(D,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(q,{children:[e.jsx(G,{children:e.jsxs(T,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Uses"}),e.jsx(p,{children:"Last seen"}),e.jsx(p,{className:"w-0"})]})}),e.jsx(J,{children:i.map(u=>e.jsx(se,{link:u,uid:s,onRevoked:()=>a(h=>h?.id===u.id?null:h)},u.id))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"Revoking ends every session minted from the link within 10 seconds. The comments a reviewer left stay."}),e.jsx(ne,{uid:s,open:x,onOpenChange:n,onMinted:a})]})}function se({link:s,uid:d,onRevoked:r}){const l=S(d),[x,n]=f.useState(!1),t=!!s.revokedAt,a=!t&&new Date(s.expiresAt).getTime()<=Date.now(),i=t||a,c=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(T,{className:E(i&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:t?e.jsxs("span",{children:["Revoked ",R(s.revokedAt)]}):a?e.jsx("span",{children:"Expired"}):e.jsxs("span",{children:[e.jsx("span",{className:"rounded-full bg-ok-soft px-2 py-0.5 text-[11.5px] font-medium text-ok",children:"Active"}),e.jsxs("span",{className:"ml-2 text-[12px] text-muted-foreground",children:["expires in ",c," day",c===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?R(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!t&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>n(!0),children:"Revoke"}),e.jsx(O,{open:x,onOpenChange:n,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:l.isPending,onConfirm:()=>{n(!1),r(),l.mutate(s.id)}})]})]})}const te=L({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function ne({uid:s,open:d,onOpenChange:r,onMinted:l}){const x=I(s),n=C({...k.rounds(s),enabled:d}),[t,a]=f.useState(""),{register:i,handleSubmit:c,formState:m,reset:v}=F({resolver:M(te),defaultValues:{days:"14",roundId:""}}),u=c(async o=>{a("");const b=Number(o.days);try{const w=await x.mutateAsync({name:o.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...o.roundId?{roundId:o.roundId}:{}});l(w),v(),r(!1)}catch(w){a(P(w))}}),h="h-8 w-full rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50";return e.jsx($,{open:d,onOpenChange:r,children:e.jsx(B,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(H,{children:[e.jsx(z,{children:"New reviewer"}),e.jsx(K,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(Y,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!m.errors.name,...i("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...i("days"),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),n.data&&n.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...i("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),n.data.data.map(o=>e.jsx("option",{value:o.id,children:o.name},o.id))]})]}),e.jsxs(V,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:m.isSubmitting,children:m.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{be as component};
@@ -0,0 +1 @@
1
+ import{r as i,h as Pe,X as ie,Y as Me,d as de,W as Be,E as ce,i as pe,j as e,Z as We,e as U,ap as ve,av as Ge,f as me,aw as qe,ax as _e,B as Z,o as Ye,ay as ze,y as Ue}from"./index-B7_Oj3hr.js";import{u as $e}from"./useQuery-CBgK187B.js";import{f as De,h as Oe,j as Ae,u as Fe,A as Je,c as Qe,n as Xe,g as ye,e as Ze,k as et,l as tt,a as st,L as $,I as he}from"./label-Dpq7t35_.js";import{O as nt,L as rt,M as ot,N as it,A as at,aL as Re,ak as Ie,ad as ae,a9 as le,aM as Ce,aN as je,ao as lt,aO as ke,aa as dt,ab as ct,aP as we,aQ as Se,aR as Ne,aS as Ee,aT as ut,aU as ft,X as pt}from"./dialog-BO8bYmy1.js";import{b as mt,u as ht,C as gt}from"./CompositeItem-B5AtyrD6.js";import{u as xt}from"./useValueChanged-DQ0Iea1L.js";import{u as bt}from"./FieldItemContext-DVEWRsEB.js";import{u as vt}from"./useAriaLabelledBy-BNUj3f_d.js";import{C as yt}from"./ConfirmDialog-ClUMXHe1.js";import{C as Rt}from"./CopyButton-DCsj-LZV.js";import{I as It}from"./InstallTag-B_qg9P2r.js";import{S as Ct}from"./switch-ElcxbE6-.js";import{P as jt,a as ue}from"./parts-C1QjM02Y.js";import{S as kt}from"./SaveState-B-6cG0nU.js";import{u as wt}from"./me-DoCJgtG9.js";import{P as St}from"./plus-D247LXUb.js";import"./useBaseQuery-yj7uWlSz.js";import"./check-CLHnIgiu.js";import"./copy-ZOZ0pLVD.js";import"./card-YnwmM74t.js";import"./labels--UUyt9uB.js";const Nt=i.createContext(void 0);function Et(t=!1){const r=i.useContext(Nt);if(!r&&!t)throw new Error(Pe(86));return r}function Pt(t,r){return t.matches(":disabled")?!1:!r||t.form===r?!0:t.form===null&&!t.hasAttribute("form")}function Mt(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const fe={checked(t){return t?{"data-checked":""}:{"data-unchecked":""}},...nt,...De},Te="data-composite-item-active",Le=i.createContext(void 0);function Dt(){return i.useContext(Le)}function Ot(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}const Ve=i.createContext(void 0);function At(){const t=i.useContext(Ve);if(t===void 0)throw new Error(Pe(52));return t}const Ft=i.forwardRef(function(r,n){const{render:a,className:u,disabled:p=!1,readOnly:d=!1,required:m=!1,"aria-labelledby":o,value:v,inputRef:H,nativeButton:h=!1,id:T,style:P,...O}=r,A=Dt(),{disabled:w,readOnly:_,required:x,form:K,checkedValue:y,touched:M=!1,validation:B,name:I,setCheckedValue:q=ie,setTouched:Y=ie,registerInputRef:s=ie}=A??{},{setTouched:g,setFilled:b,state:C,disabled:S}=Oe(),N=bt(),{labelId:L,getDescriptionProps:J}=Ae(),c=S||N.disabled||w||p,f=_||d,F=x||m,V=K,j=A?y===v:v==="",D=i.useRef(null),k=i.useRef(null),W=B?.registerInput,G=i.useCallback(R=>W?.(R,{controlRef:D,value:void 0}),[W]),Q=Me(H,k,s,G);de(()=>{k.current?.checked&&b(!0)},[b]),de(()=>{if(k.current){if(c&&j){s(null);return}s(k.current)}},[j,c,s]);const ee=Fe(),te=Je({id:T,implicit:!1,controlRef:D}),se=h?void 0:te,ne=vt(o,L,k,!h,se),re={role:"radio","aria-checked":j,"aria-labelledby":ne,[Te]:j?"":void 0,id:h?te:ee,onKeyDown(R){R.key==="Enter"&&R.preventDefault()},onClick(R){if(R.defaultPrevented||c||f)return;R.preventDefault();const X=k.current;X&&We(X,R)},onFocus(R){R.defaultPrevented||c||f||!M||(k.current?.click(),Y(!1))}},{getButtonProps:oe,buttonRef:l}=Be({disabled:c,native:h,composite:!1}),E={type:"radio",ref:Q,form:V,id:se,name:I,tabIndex:-1,style:I?rt:ot,"aria-hidden":!0,...v!==void 0?{value:Ot(v)}:ce,disabled:c,checked:j,required:F,readOnly:f,onChange(R){if(R.nativeEvent.defaultPrevented||c||f||v===void 0)return;const X=Qe(Xe,R.nativeEvent);q(v,X),!X.isCanceled&&g(!0)},onClick(R){R.stopPropagation()},onFocus(){D.current?.focus()}},z=i.useMemo(()=>({...C,required:F,disabled:c,readOnly:f,checked:j}),[C,c,f,j,F]),He=z,ge=A!==void 0,xe=[n,D,l],be=[re,O,oe,J,B?R=>B.getValidationProps(c,R):ce],Ke=pe("span",r,{enabled:!ge,state:z,ref:xe,props:be,stateAttributesMapping:fe});return e.jsxs(Ve.Provider,{value:He,children:[ge?e.jsx(mt,{tag:"span",render:a,className:u,style:P,state:z,refs:xe,props:be,stateAttributesMapping:fe}):Ke,e.jsx("input",{...E,suppressHydrationWarning:!0})]})}),Tt=i.forwardRef(function(r,n){const{render:a,className:u,style:p,keepMounted:d=!1,...m}=r,o=At(),v=o.checked,{mounted:H,transitionStatus:h,setMounted:T}=it(v),P={...o,transitionStatus:h},O=i.useRef(null),A=d||H,w=pe("span",r,{ref:[n,O],state:P,props:m,stateAttributesMapping:fe});return at({open:v,ref:O,onComplete(){v||T(!1)}}),A?w:null}),Lt=[];function Vt(t){const{loopFocus:r=!0,orientation:n="both",grid:a,onLoop:u,direction:p,highlightedIndex:d,onHighlightedIndexChange:m,rootRef:o,enableHomeAndEndKeys:v=!1,stopEventPropagation:H,disabledIndices:h,modifierKeys:T=Lt}=t,[P,O]=i.useState(0),A=a!=null,w=i.useRef(null),_=Me(w,o),x=i.useRef([]),K=i.useRef(!1),y=d??P,M=U((s,g=!1)=>{if((m??O)(s),g){const b=x.current[s];Re(w.current,b,p,n)}}),B=U(s=>{if(s.size===0||K.current)return;K.current=!0;const g=Array.from(s.keys()),b=g.find(S=>S?.hasAttribute(Te))??null,C=b?s.get(b)?.index??-1:-1;if(C!==-1)M(C);else if(Ie(g,y,h)){const S=ae(g,{disabledIndices:h});le(g,S)||M(S)}Re(w.current,b,p,n)});de(()=>{if(h==null||d!=null||!K.current)return;const s=x.current;if(Ie(s,y,h)){const g=ae(s,{disabledIndices:h});le(s,g)||M(g)}},[h,d,y,x,M]);const I=U((s,g,b)=>u?u(s,g,b,x):b),q=U(s=>{const g=s.key===Ce||s.key===je;if(!lt.has(s.key)||!v&&g||Ht(s,T)||!w.current)return;const C=p==="rtl",S=C?Ne:Ee,N=C?Ee:Ne,L=n==="vertical"?we:S,J=n==="vertical"?Se:N,c=ye(s.nativeEvent);if(c!=null&&ke(c)&&!Mt(c)){const k=c.selectionStart,W=c.selectionEnd,G=c.value;if(k==null||s.shiftKey||k!==W||s.key!==J&&k<G.length||s.key!==L&&k>0)return}let f=y;const F=dt(x,h),V=ct(x,h);a!=null&&(f=a({disabledIndices:h,elementsRef:x,event:s,highlightedIndex:y,loopFocus:r,maxIndex:V,minIndex:F,onLoop:I,orientation:n,rtl:C}));const j=n!=="vertical"&&s.key===S||n!=="horizontal"&&s.key===we,D=n!=="vertical"&&s.key===N||n!=="horizontal"&&s.key===Se;v&&(s.key===Ce?f=F:s.key===je&&(f=V)),f===y&&(j||D)&&(r&&f===V&&j?(f=F,u&&(f=u(s,y,f,x))):r&&f===F&&D?(f=V,u&&(f=u(s,y,f,x))):f=ae(x.current,{startingIndex:f,decrement:D,disabledIndices:h})),f!==y&&!le(x.current,f)&&(H&&s.stopPropagation(),(A||g||j||D)&&s.preventDefault(),M(f,!0),queueMicrotask(()=>{x.current[f]?.focus()}))});return{props:{ref:_,onFocus(s){const g=w.current,b=ye(s.nativeEvent);!g||b==null||!ke(b)||b.setSelectionRange(0,b.value.length)},onKeyDown:q},highlightedIndex:y,onHighlightedIndexChange:M,elementsRef:x,onMapChange:B,relayKeyboardEvent:q}}function Ht(t,r){for(const n of ut)if(!r.includes(n)&&t.getModifierState(n))return!0;return!1}function Kt(t){const{render:r,className:n,style:a,refs:u=ve,props:p=ve,state:d=ce,stateAttributesMapping:m,highlightedIndex:o,onHighlightedIndexChange:v,orientation:H,grid:h,loopFocus:T,onLoop:P,enableHomeAndEndKeys:O,onMapChange:A,stopEventPropagation:w=!0,rootRef:_,disabledIndices:x,modifierKeys:K,highlightItemOnHover:y=!1,tag:M="div",...B}=t,I=ht(),{props:q,highlightedIndex:Y,onHighlightedIndexChange:s,elementsRef:g,onMapChange:b,relayKeyboardEvent:C}=Vt({grid:h,loopFocus:T,onLoop:P,orientation:H,highlightedIndex:o,onHighlightedIndexChange:v,rootRef:_,stopEventPropagation:w,enableHomeAndEndKeys:O,direction:I,disabledIndices:x,modifierKeys:K}),S=pe(M,t,{state:d,ref:u,props:[q,...p,B],stateAttributesMapping:m}),N=i.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:s,highlightItemOnHover:y,relayKeyboardEvent:C}),[Y,s,y,C]);return e.jsx(Ge.Provider,{value:N,children:e.jsx(gt,{elementsRef:g,onMapChange:L=>{A?.(L),b(L)},children:S})})}const Bt=[ft],Wt=i.forwardRef(function(r,n){const{render:a,className:u,disabled:p,readOnly:d,required:m,onValueChange:o,value:v,defaultValue:H,form:h,name:T,inputRef:P,id:O,style:A,...w}=r,{setTouched:_,setFocused:x,validationMode:K,name:y,disabled:M,state:B,validation:I,setDirty:q,setFilled:Y,validityData:s}=Oe(),{labelId:g}=Ae(),{clearErrors:b,elementRef:C}=Ze(),S=Et(!0),N=M||p,L=y??T,J=Fe(O),[c,f]=et({controlled:v,default:H,name:"RadioGroup",state:"value"}),[F,V]=i.useState(!1),j=U((l,E)=>{o?.(l,E),!E.isCanceled&&f(l)}),D=I.getInputControl,k=i.useMemo(()=>({get current(){return D()}}),[D]),W=i.useRef(null),G=i.useRef(null);function Q(l){let E;return P&&(typeof P=="function"?E=P(l):P.current=l),W.current=l,E}const ee=U(l=>{if(!l||l.disabled)return;G.current||(G.current=l);const E=W.current,z=l.checked||E==null||E.disabled?Q(l):void 0;return()=>{G.current===l&&(G.current=null),W.current===l?z?(z(),W.current=null):Q(null):z?.()}}),te=U(()=>{const l=C.current;if(!l)return c??null;for(const E of I.registeredInputs.keys())if(E.checked&&Pt(E,l))return c??null;return null});tt(k,J,c??null,te,!N,T),xt(c,()=>{b(L),q(c!==s.initialValue),Y(c!=null),I.change(c);const l=G.current;c==null&&l&&!l.disabled&&Q(l)});const se=g??S?.legendId,ne={...B,disabled:N??!1,required:m??!1,readOnly:d??!1},re=i.useMemo(()=>({checkedValue:c,disabled:N,form:h,validation:I,name:L,readOnly:d,registerInputRef:ee,required:m,setCheckedValue:j,setTouched:V,touched:F}),[c,N,h,I,L,d,ee,m,j,V,F]),oe={id:O,role:"radiogroup","aria-required":m||void 0,"aria-disabled":N||void 0,"aria-readonly":d||void 0,"aria-labelledby":se,onFocus(){x(!0)},onBlur(l){st(l.currentTarget,l.relatedTarget)||(_(!0),x(!1),K==="onBlur"&&I.commit(c))},onKeyDownCapture(l){l.key.startsWith("Arrow")&&(V(!0),x(!0))}};return e.jsx(Le.Provider,{value:re,children:e.jsx(Kt,{render:a,className:u,style:A,state:ne,props:[oe,w,l=>I.getValidationProps(N??!1,l)],refs:[n],stateAttributesMapping:De,enableHomeAndEndKeys:!1,modifierKeys:Bt})})});function Gt({className:t,...r}){return e.jsx(Wt,{"data-slot":"radio-group",className:me("grid w-full gap-2",t),...r})}function qt({className:t,...r}){return e.jsx(Ft,{"data-slot":"radio-group-item",className:me("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",t),...r,children:e.jsx(Tt,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}const _t=[{id:"open",title:"Everyone on the site",note:"The toolbar appears for every visitor on the addresses above. Simplest for a staging URL nobody else knows."},{id:"link-required",title:"Only reviewers with a link",note:"You add a reviewer and send them their link. Use this when staging is publicly reachable, or when one reviewer needs revoking without shutting the whole site."}];function xs(){const{site:t}=qe.useParams(),n=wt().projects.find(o=>o.uid===t),a=$e(Ue.origins(t)),u=_e(t),[p,d]=i.useState(null),m=o=>u.mutate(o,{onSuccess:()=>d(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(jt,{title:"Settings",sub:n.name,actions:e.jsx(kt,{saving:u.isPending,savedAt:p})}),e.jsxs(ue,{title:"Site",description:"Its name, its ID for the tag, and where the widget may run.",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{children:"Site ID"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md bg-muted px-2.5 py-1.5 font-mono text-[12.5px] text-ink-soft",children:n.uid}),e.jsx(Rt,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(Yt,{name:n.name,onSave:o=>m({name:o})}),e.jsx(zt,{domain:a.data?.domain??null,loaded:a.isSuccess,onSave:o=>m({domain:o})}),e.jsx(Ut,{list:a.data?.origins??[],loaded:a.isSuccess,hasDomain:!!a.data?.domain,onChange:o=>m({origins:o})})]}),e.jsxs(ue,{title:"Widget",description:"Whether it runs, who the toolbar appears for, and the tag itself.",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx($,{htmlFor:"widget-on",className:"text-[13px] font-medium",children:"Widget on this site"}),e.jsx("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:"Off hides the toolbar for everyone and refuses new comments. The tag can stay in the site's code."})]}),e.jsx(Ct,{id:"widget-on","aria-label":"Widget on this site",checked:n.status!=="paused",onCheckedChange:o=>m({status:o?"active":"paused"})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx($,{children:"Who can comment"}),e.jsx(Gt,{value:n.writeMode,onValueChange:o=>m({writeMode:String(o)}),className:"gap-2",children:_t.map(o=>e.jsxs("label",{className:me("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",n.writeMode===o.id&&"border-brand bg-brand-soft"),children:[e.jsx(qt,{value:o.id,className:"mt-0.5","aria-label":o.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:o.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:o.note})]})]},o.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{children:"The tag"}),e.jsx(It,{uid:n.uid}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Paste it before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed."]})]})]}),e.jsx($t,{uid:t,name:n.name})]})}function Yt({name:t,onSave:r}){const[n,a]=i.useState(t);i.useEffect(()=>a(t),[t]);const u=n.trim().length>0&&n.trim()!==t;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:p=>{p.preventDefault(),u&&r(n.trim())},children:[e.jsx($,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(he,{id:"site-name",value:n,onChange:p=>a(p.target.value)}),u&&e.jsx(Z,{type:"submit",variant:"outline",children:"Save"})]})]})}function zt({domain:t,loaded:r,onSave:n}){const[a,u]=i.useState(t??"");i.useEffect(()=>u(t??""),[t]);const p=a.trim()!==(t??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:d=>{d.preventDefault(),p&&n(a.trim()||null)},children:[e.jsx($,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(he,{id:"site-domain",placeholder:"kilnwork.studio",value:a,onChange:d=>u(d.target.value),disabled:!r}),p&&e.jsx(Z,{type:"submit",variant:"outline",children:a.trim()?"Save domain":"Clear domain"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build."})]})}function Ut({list:t,loaded:r,hasDomain:n,onChange:a}){const[u,p]=i.useState("");return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{htmlFor:"site-origin-add",children:"Also allowed"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Exact addresses the domain does not cover — a client's other host, a preview on somebody else's suffix."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:[t.map(d=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md border border-border px-2 py-1 font-mono text-[12px]",children:d}),e.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${d}`,disabled:t.length<=1&&!n,onClick:()=>a(t.filter(m=>m!==d)),children:e.jsx(pt,{})})]},d)),r&&t.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:n?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:d=>{d.preventDefault();const m=u.trim();m&&(a([...t,m]),p(""))},children:[e.jsx(he,{id:"site-origin-add",placeholder:"https://staging.example.com",value:u,onChange:d=>p(d.target.value)}),e.jsxs(Z,{type:"submit",variant:"outline",disabled:!u.trim(),children:[e.jsx(St,{}),"Add"]})]})]})}function $t({uid:t,name:r}){const[n,a]=i.useState(!1),u=Ye(),p=ze(t);return e.jsxs(ue,{danger:!0,title:"Delete this site",description:e.jsxs(e.Fragment,{children:["The site stops appearing and its widget stops being served."," ",e.jsx("b",{className:"font-semibold text-foreground",children:"Nothing your client wrote is destroyed"})," — the comments stay in the database, so a mistake here is recoverable."]}),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:"You will be asked to type the site's name."}),e.jsxs(Z,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>a(!0),children:["Delete ",r,"…"]})]}),e.jsx(yt,{open:n,onOpenChange:a,title:`Delete ${r}?`,description:"The site stops appearing and its widget stops being served. Nothing your client wrote is destroyed — the comments stay in the database.",confirmLabel:"Delete",confirmWord:r,busy:p.isPending,onConfirm:()=>p.mutate(void 0,{onSuccess:()=>{a(!1),u({to:"/sites"})}})})]})}export{xs as component};
@@ -1 +1 @@
1
- import{R as x,n as h,r as g,o as f,w as j,y as w,A as N,j as e,G as y,B as b,z as S,C as r}from"./index-D4yHhKPM.js";import{u as v,a as A}from"./zod-CBoGbUzv.js";import{L as o,I as i}from"./label-BGuYH_Ll.js";const C=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:d}=x.useSearch(),c=h(),[l,n]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:A(C)}),u=p(async t=>{n("");try{await f.setup({token:d??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),w.clear(),c({to:"/welcome",replace:!0})}catch(m){n(m instanceof N?m.message:"Something went wrong. Try again.")}});return e.jsx(y,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"email",children:"Your email"}),e.jsx(i,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!s.errors.email,...a("email")}),s.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:s.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"password",children:"Password"}),e.jsx(i,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!s.errors.password,...a("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(b,{type:"submit",size:"lg",disabled:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})})}export{E as component};
1
+ import{R as x,o as h,r as g,p as f,x as j,z as N,A as w,j as e,G as y,B as b,C as S,D as r}from"./index-B7_Oj3hr.js";import{u as v,a as A}from"./zod-BUdBrC5l.js";import{L as o,I as i}from"./label-Dpq7t35_.js";const C=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:c}=x.useSearch(),d=h(),[l,n]=g.useState(""),{register:s,handleSubmit:p,formState:a}=v({resolver:A(C)}),u=p(async t=>{n("");try{await f.setup({token:c??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),N.clear(),d({to:"/welcome",replace:!0})}catch(m){n(m instanceof w?m.message:"Something went wrong. Try again.")}});return e.jsx(y,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"email",children:"Your email"}),e.jsx(i,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...s("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"password",children:"Password"}),e.jsx(i,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...s("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"orgName",placeholder:"My studio",...s("orgName")})]}),e.jsx(b,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Setting up…":"Create my account"})]})})}export{E as component};
@@ -0,0 +1 @@
1
+ import{F as w,o as y,r as l,y as d,p as N,x as S,A as C,j as e,G as k,B as F,f as E,L,C as R,D as m}from"./index-B7_Oj3hr.js";import{u as c}from"./useQuery-CBgK187B.js";import{u as A,a as I}from"./zod-BUdBrC5l.js";import{L as u,I as p}from"./label-Dpq7t35_.js";import{C as z}from"./chevron-right-BX_QQNXH.js";import"./useBaseQuery-yj7uWlSz.js";const B=R({email:m().trim().min(1,"Your email"),password:m().min(1,"Your password")});function Q(){const{redirect:x}=w.useSearch(),r=y(),[a,o]=l.useState(""),[s,h]=l.useState(!1),{register:i,handleSubmit:f,formState:t}=A({resolver:I(B)});c({...d.claimed(),enabled:!0}).data===!1&&r({to:"/setup",replace:!0});const g=c(d.setupState()),j=f(async({email:b,password:v})=>{o("");try{await N.login(b,v),S("in"),r({to:x??"/sites",replace:!0})}catch(n){o(n instanceof C?n.message:"Could not reach the server.")}});return e.jsx(k,{children:e.jsxs("form",{onSubmit:j,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),a&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(u,{htmlFor:"email",children:"Email"}),e.jsx(p,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!t.errors.email,...i("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(u,{htmlFor:"password",children:"Password"}),e.jsx(p,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!t.errors.password,...i("password")})]}),e.jsx(F,{type:"submit",size:"lg",loading:t.isSubmitting,children:t.isSubmitting?"Signing in…":"Sign in"}),e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>h(!s),children:[e.jsx(z,{className:E("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),g.data?.signup&&e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["New here?"," ",e.jsx(L,{to:"/sign-up",className:"text-foreground underline underline-offset-4",children:"Create a studio"})]}),s&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"There's no reset email — a fresh install has no mail set up, and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{Q as component};
@@ -1 +1 @@
1
- import{n as u,r as p,o as h,w as g,y as f,A as j,j as e,G as N,B as w,L as y,z as b,C as t}from"./index-D4yHhKPM.js";import{u as v,a as S}from"./zod-CBoGbUzv.js";import{L as i,I as o}from"./label-BGuYH_Ll.js";const A=b({email:t().trim().email("An email address"),password:t().min(12,"At least 12 characters"),name:t().trim().max(120).optional(),orgName:t().trim().max(120).optional()});function k(){const d=u(),[n,l]=p.useState(""),{register:r,handleSubmit:c,formState:a}=v({resolver:S(A)}),x=c(async s=>{l("");try{await h.register({email:s.email,password:s.password,...s.name?{name:s.name}:{},orgName:s.orgName||"My studio"}),g("in"),f.clear(),d({to:"/welcome",replace:!0})}catch(m){l(m instanceof j?m.message:"Something went wrong. Try again.")}});return e.jsx(N,{width:400,children:e.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Create a studio"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Your account, and the studio your sites live in. Reviewers never sign up — they open a link."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...r("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"name",autoComplete:"name",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...r("orgName")})]}),e.jsx(w,{type:"submit",size:"lg",disabled:a.isSubmitting,children:a.isSubmitting?"Creating…":"Create my studio"}),e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["Already have an account?"," ",e.jsx(y,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})]})]})})}export{k as component};
1
+ import{o as p,r as u,p as h,x as g,z as f,A as j,j as e,G as N,B as w,L as v,C as y,D as t}from"./index-B7_Oj3hr.js";import{u as b,a as S}from"./zod-BUdBrC5l.js";import{L as o,I as i}from"./label-Dpq7t35_.js";const A=y({email:t().trim().email("An email address"),password:t().min(12,"At least 12 characters"),name:t().trim().max(120).optional(),orgName:t().trim().max(120).optional()});function k(){const d=p(),[n,l]=u.useState(""),{register:r,handleSubmit:c,formState:a}=b({resolver:S(A)}),x=c(async s=>{l("");try{await h.register({email:s.email,password:s.password,...s.name?{name:s.name}:{},orgName:s.orgName||"My studio"}),g("in"),f.clear(),d({to:"/welcome",replace:!0})}catch(m){l(m instanceof j?m.message:"Something went wrong. Try again.")}});return e.jsx(N,{width:400,children:e.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Create a studio"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Your account, and the studio your sites live in. Reviewers never sign up — they open a link."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"email",children:"Your email"}),e.jsx(i,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...r("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"password",children:"Password"}),e.jsx(i,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"name",autoComplete:"name",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"orgName",placeholder:"My studio",...r("orgName")})]}),e.jsx(w,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Creating…":"Create my studio"}),e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["Already have an account?"," ",e.jsx(v,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})]})]})})}export{k as component};
@@ -0,0 +1 @@
1
+ import{N as v,r as x,j as e,B as c,L as N,o as y,t as w,p as A,A as S,C as $,D as p}from"./index-B7_Oj3hr.js";import{u as k,a as C}from"./zod-BUdBrC5l.js";import{C as _}from"./card-YnwmM74t.js";import{E as D,G as E,I,H as L,J as P,K as F}from"./dialog-BO8bYmy1.js";import{L as h,I as g}from"./label-Dpq7t35_.js";import{P as z,E as H}from"./parts-C1QjM02Y.js";import{b as K}from"./labels--UUyt9uB.js";import{u as T}from"./me-DoCJgtG9.js";import{P as f}from"./plus-D247LXUb.js";import{L as q}from"./layout-grid-Bf2WS_DV.js";import{I as B}from"./image-off-Dg9jTwH7.js";import"./useBaseQuery-yj7uWlSz.js";function te(){const i=T(),{add:a}=v.useSearch(),[m,r]=x.useState(!!a);x.useEffect(()=>{a&&r(!0)},[a]);const d=i.projects.reduce((s,o)=>s+o.unresolved,0),t=i.limits.projects.limit,n=t!==null&&i.projects.length>=t;return e.jsxs("div",{className:"p-7",children:[e.jsx(z,{title:"Sites",sub:i.projects.length?`${i.projects.length}${t!==null?` of ${t}`:""} site${i.projects.length===1&&t===null?"":"s"} · ${d} open`:t!==null?`0 of ${t} sites`:void 0,actions:e.jsxs(c,{onClick:()=>r(!0),disabled:n,title:n?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(f,{}),"Add a site"]})}),i.projects.length===0?e.jsx(_,{className:"max-w-[1100px]",children:e.jsx(H,{icon:e.jsx(q,{className:"size-5"}),title:"No sites yet",action:e.jsxs(c,{onClick:()=>r(!0),children:[e.jsx(f,{}),"Add a site"]}),children:"A site is one client website. Add it, paste the tag, and comments start arriving here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:i.projects.map(s=>e.jsxs(N,{to:"/s/$site/comments",params:{site:s.uid},className:"block overflow-hidden rounded-lg border border-border bg-card text-foreground transition-shadow hover:shadow-[0_1px_2px_rgb(24_23_22/.06),0_8px_24px_rgb(24_23_22/.08)]",children:[e.jsx("div",{className:"flex h-[150px] items-center justify-center border-b border-border bg-background",children:s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:"",className:"size-full object-cover object-top"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted",children:e.jsx(B,{className:"size-4"})}),"No screenshot yet"]})}),e.jsxs("div",{className:"px-3.5 pb-3.5 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold",children:[e.jsx("span",{className:"truncate",children:s.name}),s.status==="paused"&&e.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-px text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground",children:"Paused"})]}),s.domain&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[12px] text-muted-foreground",children:s.domain}),e.jsx("div",{className:"mt-2 text-[12.5px] text-ink-soft",children:s.threads===0?"Nothing filed yet":`${s.unresolved} open of ${s.threads}${s.lastActivityAt?` · ${K(s.lastActivityAt)}`:""}`})]})]},s.uid))}),e.jsx(Q,{open:m,onOpenChange:r})]})}const G=$({name:p().trim().min(1,"A name"),domain:p().trim().min(1,"Its domain")});function Q({open:i,onOpenChange:a}){const m=y(),r=w(),[d,t]=x.useState(""),{register:n,handleSubmit:s,formState:o,reset:j}=k({resolver:C(G)}),b=s(async u=>{t("");try{const l=await A.createProject(u.name,"",u.domain);await r.invalidateQueries({queryKey:["me"]}),j(),a(!1),m({to:"/s/$site/comments",params:{site:l.uid}})}catch(l){t(l instanceof S?l.message:"Could not add the site.")}});return e.jsx(D,{open:i,onOpenChange:a,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(I,{children:[e.jsx(L,{children:"Add a site"}),e.jsx(P,{children:"One client website. The tag it needs is shown right after."})]}),d&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:d}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{htmlFor:"site-name",children:"Name"}),e.jsx(g,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!o.errors.name,...n("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{htmlFor:"site-domain",children:"Domain"}),e.jsx(g,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!o.errors.domain,...n("domain")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in Settings."})]}),e.jsxs(F,{children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(c,{type:"submit",loading:o.isSubmitting,children:o.isSubmitting?"Adding…":"Add site"})]})]})})})}export{te as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-B7_Oj3hr.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -0,0 +1 @@
1
+ import{t as y,y as s,Q as u,p as o,S as i,P as c}from"./index-B7_Oj3hr.js";function d(){const e=y(),r=s.me().queryKey;return u({mutationFn:a=>o.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{...t,org:{...t.org,name:a}}),{was:t}},onError:(a,t,n)=>{n?.was&&e.setQueryData(r,n.was),i.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:r})})}function q(){const e=y(),r=s.me().queryKey;return u({mutationFn:a=>o.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{...t,user:{...t.user,name:a}}),{was:t}},onError:(a,t,n)=>{n?.was&&e.setQueryData(r,n.was),i.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>o.changePassword(e.current,e.next)})}function l(){const e=y();return u({mutationFn:r=>o.addMember(r),onSuccess:r=>e.setQueryData(s.members().queryKey,r)})}function w(){const e=y(),r=s.members().queryKey;return u({mutationFn:a=>o.setMemberRole(a.email,a.role),onMutate:async({email:a,role:t})=>{await e.cancelQueries({queryKey:r});const n=e.getQueryData(r);return n&&e.setQueryData(r,{data:n.data.map(m=>m.email===a?{...m,role:t}:m)}),{was:n}},onSuccess:(a,{email:t})=>{e.setQueryData(r,a),a.data.find(n=>n.email===t)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,t,n)=>{n?.was&&e.setQueryData(r,n.was),i.error(c(a))}})}function D(){const e=y(),r=s.members().queryKey;return u({mutationFn:a=>o.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{data:t.data.filter(n=>n.email!==a)}),{was:t}},onSuccess:a=>e.setQueryData(r,a),onError:(a,t,n)=>{n?.was&&e.setQueryData(r,n.was),i.error(c(a))}})}export{f as a,d as b,w as c,D as d,l as e,q as u};
@@ -0,0 +1 @@
1
+ import{t as B,r as h,Q as v,p as y,S as b,P as C,j as e,B as g,y as S,A as K}from"./index-B7_Oj3hr.js";import{u as w}from"./useQuery-CBgK187B.js";import{L as A,I as N}from"./label-Dpq7t35_.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-BO8bYmy1.js";import{C as _}from"./ConfirmDialog-ClUMXHe1.js";import{a as D,P as G}from"./parts-C1QjM02Y.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-DoCJgtG9.js";import{S as O}from"./SaveState-B-6cG0nU.js";import{b as q}from"./studio-enyabWEx.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-yj7uWlSz.js";import"./card-YnwmM74t.js";function H({owner:n}){const s=w(S.instance()),i=B(),t=()=>i.invalidateQueries({queryKey:S.instance().queryKey}),[c,l]=h.useState(!1),[p,x]=h.useState(!1),[d,u]=h.useState(null),a=v({mutationFn:y.disconnectStorage,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),f=v({mutationFn:y.testMail,onSuccess:j=>b.success(`Sent to ${j.to}`),onError:j=>b.error(C(j))}),k=z(),m=s.data?.storage,o=s.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(D,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!s.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:s.isError?"Could not read it.":"Reading…"}),m&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(P,{tone:m.connected?"ok":m.unreadable?"bad":"off",text:m.connected?`Connected · ${m.bucket} at ${(m.endpoint??"").replace(/^https?:\/\//,"")}${m.connectedAt?` · since ${F(m.connectedAt)}`:""}`:m.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),k.limits.storage.limit!==null&&e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[R(k.limits.storage.used)," of ",R(k.limits.storage.limit)," used across the studio's sites."]}),m.source==="env"?e.jsx(E,{what:"SNAGSET_STORAGE_S3_*"}):n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>l(!0),children:m.connected||m.unreadable?"Replace…":"Connect a bucket…"}),(m.connected||m.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(D,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(P,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${F(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx(E,{what:"SNAGSET_MAIL_URL"}):n?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>x(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(g,{variant:"outline",size:"sm",loading:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&n===!1,null)]})}),e.jsx(V,{open:c,onOpenChange:l,onDone:()=>void t()}),e.jsx(W,{open:p,onOpenChange:x,onDone:()=>void t()}),e.jsx(_,{open:d!==null,onOpenChange:j=>!j&&u(null),title:d==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:d==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:a.isPending||r.isPending,onConfirm:async()=>{d==="storage"?await a.mutateAsync():await r.mutateAsync(),u(null)}})]})}function P({tone:n,text:s}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${n==="ok"?"bg-ok":n==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:s})]})}function E({what:n}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:n}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function V({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[l,p]=h.useState(""),x=v({mutationFn:y.connectStorage}),d=r=>f=>c({...t,[r]:f.target.value}),u=async r=>{r.preventDefault(),p("");try{await x.mutateAsync({endpoint:t.endpoint.trim(),bucket:t.bucket.trim(),accessKeyId:t.accessKeyId.trim(),secretAccessKey:t.secretAccessKey,...t.region.trim()?{region:t.region.trim()}:{},...t.publicBaseUrl.trim()?{publicBaseUrl:t.publicBaseUrl.trim()}:{}}),c({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),s(!1),i(),b.success("Bucket connected — screenshots are on")}catch(f){p(f instanceof K?f.message:"Could not reach the server.")}},a=(r,f,k,m="text",o)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:`st-${r}`,children:f}),e.jsx(N,{id:`st-${r}`,type:m,placeholder:k,value:t[r],onChange:d(r),autoComplete:"off"}),o&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:o})]});return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void u(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(U,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),a("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),a("bucket","Bucket","snagset"),a("region","Region","auto","text","Leave empty for providers that do not use one."),a("accessKeyId","Access key ID",""),a("secretAccessKey","Secret access key","","password"),a("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:x.isPending,children:x.isPending?"Probing…":"Connect"})]})]})})})}function W({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState(""),[l,p]=h.useState(""),[x,d]=h.useState(""),u=v({mutationFn:y.connectMail}),a=async r=>{r.preventDefault(),d("");try{await u.mutateAsync({url:t.trim(),from:l.trim()}),c(""),p(""),s(!1),i(),b.success("Transport connected — send a test email to be sure")}catch(f){d(f instanceof K?f.message:"Could not reach the server.")}};return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void a(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(U,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),x&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-url",children:"Transport"}),e.jsx(N,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:t,onChange:r=>c(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-from",children:"From"}),e.jsx(N,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:l,onChange:r=>p(r.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:u.isPending,disabled:!t.trim()||!l.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function R(n){const s=["B","KB","MB","GB","TB"];let i=n,t=0;for(;i>=1024&&t<s.length-1;)i/=1024,t+=1;return`${t===0?i:i.toFixed(i>=10?0:1)} ${s[t]}`}function ue(){const n=z(),s=w(S.meta()),i=w(S.members()),t=q(),c=n.user.role==="owner",[l,p]=h.useState(n.org.name),[x,d]=h.useState(null);h.useEffect(()=>p(n.org.name),[n.org.name]);const u=c&&l.trim().length>0&&l.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(G,{title:"General",sub:n.org.name,actions:e.jsx(O,{saving:t.isPending,savedAt:x})}),e.jsx(D,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),u&&t.mutate(l.trim(),{onSuccess:()=>d(Date.now())})},children:[e.jsx(A,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(N,{id:"studio-name",value:l,readOnly:!c,onChange:a=>p(a.target.value)}),u&&e.jsx(g,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(D,{title:"This instance",description:"What is running, and where.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[s.data?.version??"—"," ",e.jsx(J,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(X,{owner:c})}),s.data?.commit&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[n.projects.length," · ",i.data?.data.length??"—"]})]})}),e.jsx(H,{owner:c})]})}function J({version:n}){const[s,i]=h.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),Q(n).then(t=>i({s:"done",r:t})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):s.s==="checking"?e.jsx("span",{className:"text-muted-foreground",children:"· checking…"}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function X({owner:n}){const s=B(),i=w(S.instance()),[t,c]=h.useState(null),[l,p]=h.useState(""),x=v({mutationFn:a=>y.setAddress(a),onSuccess:a=>{s.setQueryData(S.instance().queryKey,a),c(null),p(""),b.success("Address saved — every new link is built from it")},onError:a=>p(C(a))}),d=i.data?.address;if(!d)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const u=d.source==="env";return t===null||!n||u?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:d.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:u?"· set by the environment (SNAGSET_BASE_URL)":d.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),n&&!u&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>c(d.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(t.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(N,{"aria-label":"Address",value:t,onChange:a=>c(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(g,{type:"submit",size:"sm",loading:x.isPending,disabled:!t.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(null),children:"Cancel"})]}),l&&e.jsx("span",{className:"text-[12px] text-destructive",children:l}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}export{ue as component};