@snagset/server 0.1.53 → 0.1.54

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 (101) hide show
  1. package/package.json +1 -1
  2. package/static/dashboard/assets/{CompositeItem-BOk-i3nR.js → CompositeItem-D7Q5QVvi.js} +1 -1
  3. package/static/dashboard/assets/{CompositeList-CizhTu5k.js → CompositeList-w7YcjHbo.js} +1 -1
  4. package/static/dashboard/assets/ConfirmDialog-CHiXSDkR.js +1 -0
  5. package/static/dashboard/assets/{CopyButton-Cc6bLGfR.js → CopyButton-DkXHOvAs.js} +1 -1
  6. package/static/dashboard/assets/{FieldItemContext-BYUTQ-zN.js → FieldItemContext-BWEjbC5Z.js} +1 -1
  7. package/static/dashboard/assets/InstallTag-DlqXIhqI.js +17 -0
  8. package/static/dashboard/assets/InstanceRows-DwXLnXU2.js +1 -0
  9. package/static/dashboard/assets/McpTokens-BvQnjHcP.js +1 -0
  10. package/static/dashboard/assets/Picker-CtjWzkpT.js +1 -0
  11. package/static/dashboard/assets/{SaveState-DzF8ZaPe.js → SaveState-DzX_pKjo.js} +1 -1
  12. package/static/dashboard/assets/{_app-1rENGvme.js → _app-B-X6wLWA.js} +1 -1
  13. package/static/dashboard/assets/{_app-ClXa_BSX.js → _app-DW5KDMy_.js} +3 -3
  14. package/static/dashboard/assets/activity-C8vHHVVs.js +1 -0
  15. package/static/dashboard/assets/{arrow-left-DDim6ZAR.js → arrow-left-DbWDuhAv.js} +1 -1
  16. package/static/dashboard/assets/avatar-BL6yPDkc.js +1 -0
  17. package/static/dashboard/assets/{badge-CCBUSB_y.js → badge-Dybw0_bq.js} +1 -1
  18. package/static/dashboard/assets/{card-CBSSmpT3.js → card-DwOk-mSd.js} +1 -1
  19. package/static/dashboard/assets/{check-DJgo7I6A.js → check-Dfkv0gma.js} +1 -1
  20. package/static/dashboard/assets/{chevron-down-60UlZ0Ky.js → chevron-down-BFQamcZy.js} +1 -1
  21. package/static/dashboard/assets/{chevron-right-B5sFu-7i.js → chevron-right-v0My-Qwf.js} +1 -1
  22. package/static/dashboard/assets/{copy-BVdfZXH-.js → copy-Bnl05Zl3.js} +1 -1
  23. package/static/dashboard/assets/createBaseUIEventDetails-DviWdj-N.js +1 -0
  24. package/static/dashboard/assets/dialog-B1TvUOp8.js +6 -0
  25. package/static/dashboard/assets/{dropdown-menu-DBe6PomQ.js → dropdown-menu-DQDS-MXM.js} +3 -3
  26. package/static/dashboard/assets/forgot-B13MZpbf.js +1 -0
  27. package/static/dashboard/assets/getPseudoElementBounds-Bv3Ra6Wj.js +1 -0
  28. package/static/dashboard/assets/{image-off-CMJxtYwl.js → image-off-4dn7EbeZ.js} +1 -1
  29. package/static/dashboard/assets/index-PP-fkxl1.css +1 -0
  30. package/static/dashboard/assets/{index-DXj5DU-z.js → index-_7kIe8FW.js} +3 -3
  31. package/static/dashboard/assets/{inertValue-Bju6oxRr.js → inertValue-BSe8K39O.js} +1 -1
  32. package/static/dashboard/assets/invite-nV6ykkp0.js +1 -0
  33. package/static/dashboard/assets/label-BkHFb2_L.js +1 -0
  34. package/static/dashboard/assets/{layout-grid-DkVlSz3z.js → layout-grid-Dt1Q4YQ_.js} +1 -1
  35. package/static/dashboard/assets/me-BDpKAhA-.js +1 -0
  36. package/static/dashboard/assets/{parts-DUFMukrB.js → parts-DGVjMHe8.js} +1 -1
  37. package/static/dashboard/assets/{plus-1z8Ku-LH.js → plus-hkwBCzos.js} +1 -1
  38. package/static/dashboard/assets/reset-BNNJmqWL.js +1 -0
  39. package/static/dashboard/assets/{s._site-CtQgYzLV.js → s._site-MSdo-oKn.js} +1 -1
  40. package/static/dashboard/assets/{s._site.comments-WC9g6KEV.js → s._site.comments-0jkl72Ja.js} +3 -3
  41. package/static/dashboard/assets/s._site.reviewers-BWi4M9dg.js +1 -0
  42. package/static/dashboard/assets/{s._site.settings-BBmpjCXH.js → s._site.settings-_fxdLl8T.js} +1 -1
  43. package/static/dashboard/assets/select-DjpYopV7.js +6 -0
  44. package/static/dashboard/assets/setup-Ccth7CNk.js +1 -0
  45. package/static/dashboard/assets/sign-in-BeNKRQ7N.js +1 -0
  46. package/static/dashboard/assets/sign-up-B8239y6x.js +1 -0
  47. package/static/dashboard/assets/sites-CekL50U1.js +1 -0
  48. package/static/dashboard/assets/studio-5pj2ZjeU.js +1 -0
  49. package/static/dashboard/assets/{studio-C6rKaKyK.js → studio-pysRGF6Z.js} +1 -1
  50. package/static/dashboard/assets/studio.index-D1Utbxqz.js +1 -0
  51. package/static/dashboard/assets/studio.integrations-M2aLKrz5.js +1 -0
  52. package/static/dashboard/assets/studio.members-C9Gigy9Y.js +6 -0
  53. package/static/dashboard/assets/studio.plan-CVZcQmU2.js +1 -0
  54. package/static/dashboard/assets/{sun-BHujGXQB.js → sun-Ciy3ROc0.js} +1 -1
  55. package/static/dashboard/assets/switch-wRlAfGsi.js +1 -0
  56. package/static/dashboard/assets/{table-DCkeQpxm.js → table-Bd53YpCs.js} +1 -1
  57. package/static/dashboard/assets/useAriaLabelledBy-Dt1pmXDF.js +1 -0
  58. package/static/dashboard/assets/{useBaseQuery-Dl2qdxNT.js → useBaseQuery-DVrotnH-.js} +1 -1
  59. package/static/dashboard/assets/{useCompositeItem-eZ3mWAYz.js → useCompositeItem-fDEe_Juq.js} +1 -1
  60. package/static/dashboard/assets/useQuery-ClGlUO36.js +1 -0
  61. package/static/dashboard/assets/useRender-BO4-nlty.js +1 -0
  62. package/static/dashboard/assets/useScrollLock-DdWilGdG.js +1 -0
  63. package/static/dashboard/assets/{useValueChanged-D634YMNF.js → useValueChanged-Cm4_pRNG.js} +1 -1
  64. package/static/dashboard/assets/{users-kg2hhvKi.js → users-BDCRp6bm.js} +1 -1
  65. package/static/dashboard/assets/{welcome-BjaK019o.js → welcome-CcxTkiVu.js} +2 -2
  66. package/static/dashboard/assets/{widget-signin-D4ZH3Oaw.js → widget-signin-CpAmvjAU.js} +1 -1
  67. package/static/dashboard/assets/you-guotGi3r.js +1 -0
  68. package/static/dashboard/assets/{zod-DrSDAsp7.js → zod-Q9KJcyiZ.js} +1 -1
  69. package/static/dashboard/index.html +2 -2
  70. package/static/widget/build.json +2 -2
  71. package/static/widget/snag.js +1 -1
  72. package/static/widget/snag.runtime.js +1 -1
  73. package/static/dashboard/assets/ConfirmDialog-CUQ3wyl0.js +0 -1
  74. package/static/dashboard/assets/InstallTag-BkUjzO7Q.js +0 -17
  75. package/static/dashboard/assets/InstanceRows-S3bDqoib.js +0 -1
  76. package/static/dashboard/assets/McpTokens-Bj04Bv7o.js +0 -1
  77. package/static/dashboard/assets/activity-yg3O3FDe.js +0 -1
  78. package/static/dashboard/assets/avatar-CE2TkZa-.js +0 -1
  79. package/static/dashboard/assets/dialog-zaKAKGow.js +0 -6
  80. package/static/dashboard/assets/forgot-BYMFyxwU.js +0 -1
  81. package/static/dashboard/assets/index-DVRHlt-r.css +0 -1
  82. package/static/dashboard/assets/invite-DH6dh7D-.js +0 -1
  83. package/static/dashboard/assets/label-BNpdN3Cg.js +0 -1
  84. package/static/dashboard/assets/labels--UUyt9uB.js +0 -1
  85. package/static/dashboard/assets/me-DRWJq-k_.js +0 -1
  86. package/static/dashboard/assets/reset-QshsZ8Pi.js +0 -1
  87. package/static/dashboard/assets/s._site.reviewers-B1wTd7uh.js +0 -1
  88. package/static/dashboard/assets/setup-COktVcsh.js +0 -1
  89. package/static/dashboard/assets/sign-in-D2MXhZPE.js +0 -1
  90. package/static/dashboard/assets/sign-up-DwpcLIA4.js +0 -1
  91. package/static/dashboard/assets/sites-BPdqrX1-.js +0 -1
  92. package/static/dashboard/assets/studio-BGRf9vPd.js +0 -1
  93. package/static/dashboard/assets/studio.index-BWRigBYG.js +0 -1
  94. package/static/dashboard/assets/studio.integrations-CzF2zxXk.js +0 -1
  95. package/static/dashboard/assets/studio.members-C-a4YKia.js +0 -11
  96. package/static/dashboard/assets/studio.plan-BntVcF5I.js +0 -1
  97. package/static/dashboard/assets/switch-DxJ9TWjl.js +0 -1
  98. package/static/dashboard/assets/useAriaLabelledBy-Cx69TO6K.js +0 -1
  99. package/static/dashboard/assets/useQuery-BO7PrbuY.js +0 -1
  100. package/static/dashboard/assets/useRender-0SJIdv0u.js +0 -1
  101. package/static/dashboard/assets/you-2qQEJT_G.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snagset/server",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The Snagset server: API, dashboard and widget in one package. Node and Postgres, or Vercel.",
@@ -1 +1 @@
1
- import{E as u,ab as t,k as c}from"./index-DXj5DU-z.js";import{u as E}from"./useCompositeItem-eZ3mWAYz.js";function M(e){const{render:d,className:l,style:C,state:s=u,props:o=t,refs:r=t,metadata:a,stateAttributesMapping:m,tag:p="div",...i}=e,{compositeProps:n,compositeRef:f}=E({metadata:a});return c(p,e,{state:s,ref:[f,...r],props:[n,...o,i],stateAttributesMapping:m})}export{M as C};
1
+ import{E as u,ah as t,k as c}from"./index-_7kIe8FW.js";import{u as E}from"./useCompositeItem-fDEe_Juq.js";function M(e){const{render:d,className:l,style:C,state:s=u,props:o=t,refs:r=t,metadata:a,stateAttributesMapping:m,tag:p="div",...i}=e,{compositeProps:n,compositeRef:f}=E({metadata:a});return c(p,e,{state:s,ref:[f,...r],props:[n,...o,i],stateAttributesMapping:m})}export{M as C};
@@ -1 +1 @@
1
- import{r as c,e as L,f as g,aa as S,j}from"./index-DXj5DU-z.js";const k=c.createContext(void 0);function F(){return c.useContext(k)?.direction??"ltr"}const y=c.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function T(){return c.useContext(y)}function G(u={}){const{guess:o,label:e,metadata:s,textRef:p,index:t}=u,{register:i,unregister:a,subscribeMapChange:m,nextIndexRef:R}=T(),f=c.useRef(-1),[v,b]=c.useState(t==null&&o?()=>{if(f.current===-1){const l=R.current;R.current+=1,f.current=l}return f.current}:-1),I=t??v,h=c.useRef(null),E=c.useCallback(l=>{const C=h.current;C&&a(C),h.current=l,l&&i(l,{metadata:s??null,index:t??null,label:e,textRef:p})},[t,i,a,s,e,p]);return L(()=>{if(t==null)return m(l=>{const C=h.current?l.get(h.current)?.index:null;C!=null&&b(C)})},[t,m]),{ref:E,index:I}}function V(u){const{children:o,elementsRef:e,labelsRef:s,onMapChange:p}=u,t=g(p),[,i]=c.useState(!1),a=S(U).current,m=S(A).current,R=c.useRef(0),f=c.useRef(!0),v=c.useRef([]),b=c.useRef(null),I=g(()=>{f.current||(f.current=!0,i(n=>!n))}),h=g((n,d)=>{m.set(n,d),I()}),E=g(n=>{m.delete(n),I()}),l=g(n=>{const d=new Map;return e.current.length=0,s&&(s.current.length=0),n.forEach(r=>{d.set(r.element,{...r.registration.metadata??{},index:r.index}),e.current[r.index]=r.element,s&&(s.current[r.index]=r.registration.label!==void 0?r.registration.label:r.registration.textRef?.current?.textContent??r.element.textContent)}),R.current=e.current.length,d});function C(n){if(b.current?.disconnect(),b.current=null,typeof MutationObserver!="function"||n.length<2)return;const d=new MutationObserver(x=>{if(!z(x))return;let M=null;for(const w of n)if(w.isConnected){if(M&&D(M,w)>0){d.disconnect(),I();return}M=w}});b.current=d;const r=new Set;for(let x=1;x<n.length;x+=1){const M=_(n[x-1],n[x]);M&&r.add(M)}r.forEach(x=>d.observe(x,{childList:!0}))}const N=g(()=>{const[n,d]=W(m),r=l(n);C(d),v.current=n,f.current=!1,a.forEach(x=>x(r)),t(r)});L(()=>(f.current||l(v.current),()=>{e.current=[],s&&(s.current=[])}),[e,s,l]),L(()=>{f.current&&N()}),L(()=>()=>{b.current?.disconnect(),f.current=!0},[]);const O=g(n=>(a.add(n),()=>{a.delete(n)})),P=c.useMemo(()=>({register:h,unregister:E,subscribeMapChange:O,nextIndexRef:R}),[h,E,O,R]);return j.jsx(y.Provider,{value:P,children:o})}function A(){return new Map}function U(){return new Set}function W(u){const o=new Set,e=[],s=[];u.forEach((t,i)=>{if(!i.isConnected)return;const a=t.index,m={index:a??-1,element:i,registration:t};a===null?s.push(m):a>=0&&(o.add(a),e.push(m))});let p=0;return s.sort((t,i)=>D(t.element,i.element)),s.forEach(t=>{for(;o.has(p);)p+=1;t.index=p,e.push(t),p+=1}),o.size>0&&e.sort((t,i)=>t.index-i.index),[e,s.map(t=>t.element)]}function _(u,o){let e=u.parentElement;for(;e&&!e.contains(o);)e=e.parentElement;return e}function z(u){for(const o of u)for(let e=0;e<o.removedNodes.length;e+=1)if(o.removedNodes[e].isConnected)return!0;return!1}function D(u,o){return u.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}export{V as C,G as a,F as u};
1
+ import{r as c,e as L,f as g,ag as S,j}from"./index-_7kIe8FW.js";const k=c.createContext(void 0);function F(){return c.useContext(k)?.direction??"ltr"}const y=c.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function T(){return c.useContext(y)}function G(u={}){const{guess:o,label:e,metadata:s,textRef:p,index:t}=u,{register:i,unregister:a,subscribeMapChange:m,nextIndexRef:R}=T(),f=c.useRef(-1),[v,b]=c.useState(t==null&&o?()=>{if(f.current===-1){const l=R.current;R.current+=1,f.current=l}return f.current}:-1),I=t??v,h=c.useRef(null),E=c.useCallback(l=>{const C=h.current;C&&a(C),h.current=l,l&&i(l,{metadata:s??null,index:t??null,label:e,textRef:p})},[t,i,a,s,e,p]);return L(()=>{if(t==null)return m(l=>{const C=h.current?l.get(h.current)?.index:null;C!=null&&b(C)})},[t,m]),{ref:E,index:I}}function V(u){const{children:o,elementsRef:e,labelsRef:s,onMapChange:p}=u,t=g(p),[,i]=c.useState(!1),a=S(U).current,m=S(A).current,R=c.useRef(0),f=c.useRef(!0),v=c.useRef([]),b=c.useRef(null),I=g(()=>{f.current||(f.current=!0,i(n=>!n))}),h=g((n,d)=>{m.set(n,d),I()}),E=g(n=>{m.delete(n),I()}),l=g(n=>{const d=new Map;return e.current.length=0,s&&(s.current.length=0),n.forEach(r=>{d.set(r.element,{...r.registration.metadata??{},index:r.index}),e.current[r.index]=r.element,s&&(s.current[r.index]=r.registration.label!==void 0?r.registration.label:r.registration.textRef?.current?.textContent??r.element.textContent)}),R.current=e.current.length,d});function C(n){if(b.current?.disconnect(),b.current=null,typeof MutationObserver!="function"||n.length<2)return;const d=new MutationObserver(x=>{if(!z(x))return;let M=null;for(const w of n)if(w.isConnected){if(M&&D(M,w)>0){d.disconnect(),I();return}M=w}});b.current=d;const r=new Set;for(let x=1;x<n.length;x+=1){const M=_(n[x-1],n[x]);M&&r.add(M)}r.forEach(x=>d.observe(x,{childList:!0}))}const N=g(()=>{const[n,d]=W(m),r=l(n);C(d),v.current=n,f.current=!1,a.forEach(x=>x(r)),t(r)});L(()=>(f.current||l(v.current),()=>{e.current=[],s&&(s.current=[])}),[e,s,l]),L(()=>{f.current&&N()}),L(()=>()=>{b.current?.disconnect(),f.current=!0},[]);const O=g(n=>(a.add(n),()=>{a.delete(n)})),P=c.useMemo(()=>({register:h,unregister:E,subscribeMapChange:O,nextIndexRef:R}),[h,E,O,R]);return j.jsx(y.Provider,{value:P,children:o})}function A(){return new Map}function U(){return new Set}function W(u){const o=new Set,e=[],s=[];u.forEach((t,i)=>{if(!i.isConnected)return;const a=t.index,m={index:a??-1,element:i,registration:t};a===null?s.push(m):a>=0&&(o.add(a),e.push(m))});let p=0;return s.sort((t,i)=>D(t.element,i.element)),s.forEach(t=>{for(;o.has(p);)p+=1;t.index=p,e.push(t),p+=1}),o.size>0&&e.sort((t,i)=>t.index-i.index),[e,s.map(t=>t.element)]}function _(u,o){let e=u.parentElement;for(;e&&!e.contains(o);)e=e.parentElement;return e}function z(u){for(const o of u)for(let e=0;e<o.removedNodes.length;e+=1)if(o.removedNodes[e].isConnected)return!0;return!1}function D(u,o){return u.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}export{V as C,G as a,F as u};
@@ -0,0 +1 @@
1
+ import{r as i,j as e,B as u}from"./index-_7kIe8FW.js";import{i as C,j as v,l as b,k as D,m as y,n as N}from"./dialog-B1TvUOp8.js";import{I as k}from"./label-BkHFb2_L.js";import{C as T}from"./check-Dfkv0gma.js";import{C as B}from"./copy-Bnl05Zl3.js";function F({open:l,onOpenChange:o,title:x,description:n,children:g,confirmLabel:h,confirmWord:s,busy:t=!1,onConfirm:j}){const[r,c]=i.useState(""),[d,m]=i.useState(!1),f=i.useId();i.useEffect(()=>{l&&c("")},[l]);const p=!s||r.trim()===s;return e.jsx(C,{open:l,onOpenChange:a=>{!a&&t||o(a)},children:e.jsx(v,{showCloseButton:!1,children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:a=>{a.preventDefault(),p&&!t&&j()},children:[e.jsxs(b,{children:[e.jsx(D,{children:x}),n&&e.jsx(y,{children:n})]}),g,s&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("p",{className:"m-0 flex flex-wrap items-center gap-1 text-sm font-medium",children:["Type",e.jsxs("button",{type:"button",disabled:t,title:"Copy the name",className:"inline-flex items-center gap-1 rounded-sm bg-muted px-1.5 py-0.5 font-semibold text-foreground hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring",onClick:()=>{navigator.clipboard?.writeText(s).catch(()=>{}),m(!0),setTimeout(()=>m(!1),1500),document.getElementById(f)?.focus()},children:[s,d?e.jsx(T,{className:"size-3.5 text-muted-foreground"}):e.jsx(B,{className:"size-3.5 text-muted-foreground"}),e.jsx("span",{className:"sr-only",children:d?" copied":" — copy"})]}),"to confirm"]}),e.jsx(k,{id:f,"aria-label":`Type ${s} to confirm`,value:r,autoComplete:"off",spellCheck:!1,disabled:t,onChange:a=>c(a.target.value)})]}),e.jsxs(N,{children:[e.jsx(u,{type:"button",variant:"outline",disabled:t,onClick:()=>o(!1),children:"Cancel"}),e.jsx(u,{type:"submit",variant:"destructive",loading:t,disabled:!p,children:t?"Working…":h})]})]})})})}export{F as C};
@@ -1 +1 @@
1
- import{r as n,j as t,B as c}from"./index-DXj5DU-z.js";import{C}from"./check-DJgo7I6A.js";import{C as m}from"./copy-BVdfZXH-.js";function l({text:r,label:e="Copy",withText:s=!1,size:a="icon-sm",className:p}){const[o,i]=n.useState(!1);return t.jsxs(c,{type:"button",variant:"outline",size:s?"sm":a,className:p,"aria-label":o?"Copied":e,onClick:()=>{navigator.clipboard?.writeText(r).catch(()=>{}),i(!0),setTimeout(()=>i(!1),1500)},children:[o?t.jsx(C,{}):t.jsx(m,{}),s&&(o?"Copied":e)]})}export{l as C};
1
+ import{r as n,j as t,B as c}from"./index-_7kIe8FW.js";import{C}from"./check-Dfkv0gma.js";import{C as m}from"./copy-Bnl05Zl3.js";function l({text:r,label:e="Copy",withText:s=!1,size:a="icon-sm",className:p}){const[o,i]=n.useState(!1);return t.jsxs(c,{type:"button",variant:"outline",size:s?"sm":a,className:p,"aria-label":o?"Copied":e,onClick:()=>{navigator.clipboard?.writeText(r).catch(()=>{}),i(!0),setTimeout(()=>i(!1),1500)},children:[o?t.jsx(C,{}):t.jsx(m,{}),s&&(o?"Copied":e)]})}export{l as C};
@@ -1 +1 @@
1
- import{r as t}from"./index-DXj5DU-z.js";const e=t.createContext({disabled:!1});function r(){return t.useContext(e)}export{r as u};
1
+ import{r as t}from"./index-_7kIe8FW.js";const e=t.createContext({disabled:!1});function r(){return t.useContext(e)}export{r as u};
@@ -0,0 +1,17 @@
1
+ import{r as a,i as je,e as Z,f as _,k as oe,j as n,aI as Ne,aj as Le,ai as Oe,ah as ue,E as Ve,b4 as ze,h as re,o as He,B as Ke,b5 as Be}from"./index-_7kIe8FW.js";import{k as _e,c as Pe,C as pe,D as ge,d as Fe,u as we,x as $e,r as be,a as We,n as Ye,g as he}from"./createBaseUIEventDetails-DviWdj-N.js";import{C as ke,a as Ue,u as Je}from"./CompositeList-w7YcjHbo.js";import{i as qe}from"./isElementDisabled-CwHw_lZC.js";import{a as Ge,u as Qe,t as Xe,i as Ze,s as ve,k as me,h as le,e as ce,H as xe,E as Re,C as et,l as Ce,g as tt,f as nt,A as ye,m as Ie,n as Ee,o as Te,M as at}from"./inertValue-BSe8K39O.js";import{u as st}from"./useCompositeItem-fDEe_Juq.js";import{C as ot}from"./check-Dfkv0gma.js";import{C as rt}from"./copy-Bnl05Zl3.js";const Se=a.createContext(void 0);function fe(){const t=a.useContext(Se);if(t===void 0)throw new Error(je(64));return t}const ie={tabActivationDirection:t=>({"data-activation-direction":t})},it=a.forwardRef(function(o,r){const{className:C,defaultValue:i=0,onValueChange:j,orientation:u="horizontal",render:A,value:E,style:P,...w}=o,v=o.defaultValue!==void 0,O=a.useRef([]),[D,x]=a.useState(()=>new Map),[l,R]=_e({controlled:E,default:i,name:"Tabs",state:"value"}),y=E!==void 0,[s,T]=a.useState(()=>new Map),f=a.useRef(void 0),g=a.useCallback(p=>de(s,p),[s]),[V,L]=a.useState(()=>({previousValue:l,tabActivationDirection:"none"})),{previousValue:c,tabActivationDirection:I}=V;let e=I,d=!1;c!==l&&(e=Me(c,l,u,s),d=c!=null&&l!=null&&g(l)==null);const b=d?c:l,k=c!==b||I!==e;Z(()=>{k&&L({previousValue:b,tabActivationDirection:e})},[b,k,e]);const S=_((p,M)=>{const W=Me(l,p,u,s);M.activationDirection=W,j?.(p,M),!M.isCanceled&&R(p)}),H=_((p,M)=>{j?.(p,Pe(M,void 0,void 0,{activationDirection:"none"}))}),F=_((p,M)=>(x(W=>{const G=new Map(W);return G.set(p,M),G}),()=>{x(W=>{if(W.get(p)!==M)return W;const G=new Map(W);return G.delete(p),G})})),U=a.useCallback(p=>D.get(p),[D]),N=a.useCallback(p=>{for(const M of s.values())if(p===M.value)return M.id},[s]),h=a.useMemo(()=>({getTabElementBySelectedValue:g,getTabIdByPanelValue:N,getTabPanelIdByValue:U,onValueChange:S,orientation:u,registerMountedTabPanel:F,setTabMap:T,tabActivationDirection:e,value:l}),[g,N,U,S,u,F,T,e,l]),z=a.useMemo(()=>{for(const p of s.values())if(p.value===l)return p},[s,l]),$=a.useMemo(()=>{for(const p of s.values())if(!p.disabled)return p.value},[s]),K=a.useRef(!v),J=a.useRef(i),q=a.useRef(v),m=a.useRef(!1);Z(()=>{if(y)return;function p(X,ee){R(X),L({previousValue:X,tabActivationDirection:"none"}),H(X,ee),K.current=!1}if(s.size===0){m.current&&l!==null&&!f.current?.isConnected&&p(null,ge);return}m.current=!0,f.current=s.keys().next().value;const M=z?.disabled,W=z==null&&l!==null;if(!M&&l===J.current&&(q.current=!1),q.current&&M&&l===J.current)return;const G=K.current;if(M||W){const X=$??null;if(l===X){K.current=!1;return}let ee=ge;G?ee=pe:M&&(ee=Fe),p(X,ee);return}G&&z!=null&&(H(l,pe),K.current=!1)},[$,y,H,z,R,s,l]);const Q=oe("div",o,{state:{orientation:u,tabActivationDirection:e},ref:r,props:w,stateAttributesMapping:ie});return n.jsx(Se.Provider,{value:h,children:n.jsx(ke,{elementsRef:O,children:Q})})});function de(t,o){for(const[r,C]of t.entries())if(o===C.value)return r;return null}function Me(t,o,r,C){if(t==null||o==null)return"none";const[i,j,u]=r==="horizontal"?["left","left","right"]:["top","up","down"],A=de(C,t),E=de(C,o);if(A==null||E==null)return A!==E&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof o?o>t?u:j:"none";const P=A.getBoundingClientRect()[i],w=E.getBoundingClientRect()[i];return w<P?j:w>P?u:"none"}const Ae="data-composite-item-active",De=a.createContext(void 0);function lt(){const t=a.useContext(De);if(t===void 0)throw new Error(je(65));return t}const ct=a.forwardRef(function(o,r){const{className:C,disabled:i=!1,render:j,value:u,id:A,nativeButton:E=!0,style:P,...w}=o,{value:v,getTabPanelIdByValue:O,onValueChange:D,orientation:x,tabActivationDirection:l}=fe(),{activateOnFocus:R,registerTabResizeObserverElement:y,tabsListElement:s}=lt(),{highlightedIndex:T,onHighlightedIndexChange:f}=Ne(),g=we(A),V=a.useMemo(()=>({disabled:i,id:g,value:u}),[i,g,u]),{compositeProps:L,compositeRef:c,index:I}=st({metadata:V}),e=u===v,d=a.useRef(!1),b=a.useRef(null),k=_(m=>{b.current?.(),b.current=m?y(m):null});Z(()=>{if(d.current){d.current=!1;return}if(!(e&&I>-1&&T!==I))return;const m=s;if(m!=null){const B=$e(be(m));if(B&&We(m,B))return}i||f(I)},[e,I,T,f,i,s]);const{getButtonProps:S,buttonRef:H}=Le({disabled:i,native:E,focusableWhenDisabled:!0}),F=O(u),U=a.useRef(!1),N=a.useRef(!1);function h(m){D(u,Pe(Ye,m.nativeEvent,void 0,{activationDirection:"none"}))}function z(m){e||i||h(m)}function $(m){e||i||R&&(!U.current||N.current)&&h(m)}function K(m){if(e||i)return;U.current=!0,N.current=m.button===0;const B=be(m.currentTarget);function Q(){U.current=!1,N.current=!1,B.removeEventListener("pointerup",Q),B.removeEventListener("pointercancel",Q)}B.addEventListener("pointerup",Q),B.addEventListener("pointercancel",Q)}return oe("button",o,{state:{disabled:i,active:e,orientation:x,tabActivationDirection:l},ref:[r,H,c,k],props:[L,{role:"tab","aria-controls":F,"aria-selected":e,id:g,onClick:z,onFocus:$,onPointerDown:K,[Ae]:e?"":void 0,onKeyDownCapture(){d.current=!0}},w,S],stateAttributesMapping:ie})}),ut={...ie,...Xe},dt=a.forwardRef(function(o,r){const{className:C,value:i,render:j,keepMounted:u=!1,style:A,...E}=o,{value:P,getTabIdByPanelValue:w,orientation:v,tabActivationDirection:O,registerMountedTabPanel:D}=fe(),x=we(),{ref:l,index:R}=Ue(),y=i===P,{mounted:s,transitionStatus:T,setMounted:f}=Ge(y),g=!s,V=w(i),L={hidden:g,orientation:v,tabActivationDirection:O,transitionStatus:T},c=a.useRef(null),I=oe("div",o,{state:L,ref:[r,l,c],props:[{"aria-labelledby":V,hidden:g,id:x,role:"tabpanel",tabIndex:y?0:-1,inert:Ze(!y),"data-index":R},E],stateAttributesMapping:ut});return Qe({open:y,ref:c,onComplete(){y||f(!1)}}),Z(()=>{if(!(x==null||g&&!u))return D(i,x)},[g,u,i,x,D]),u||s?I:null}),ft=[];function pt(t){const{loopFocus:o=!0,orientation:r="both",grid:C,onLoop:i,direction:j,highlightedIndex:u,onHighlightedIndexChange:A,rootRef:E,enableHomeAndEndKeys:P=!1,stopEventPropagation:w,disabledIndices:v,modifierKeys:O=ft}=t,[D,x]=a.useState(0),l=C!=null,R=a.useRef(null),y=Oe(R,E),s=a.useRef([]),T=a.useRef(!1),f=u??D,g=_((e,d=!1)=>{if((A??x)(e),d){const b=s.current[e];ve(R.current,b,j,r)}}),V=_(e=>{if(e.size===0||T.current)return;T.current=!0;const d=Array.from(e.keys()),b=d.find(S=>S?.hasAttribute(Ae))??null,k=b?e.get(b)?.index??-1:-1;if(k!==-1)g(k);else if(me(d,f,v)){const S=le(d,{disabledIndices:v});ce(d,S)||g(S)}ve(R.current,b,j,r)});Z(()=>{if(v==null||u!=null||!T.current)return;const e=s.current;if(me(e,f,v)){const d=le(e,{disabledIndices:v});ce(e,d)||g(d)}},[v,u,f,s,g]);const L=_((e,d,b)=>i?i(e,d,b,s):b),c=_(e=>{const d=e.key===xe||e.key===Re;if(!et.has(e.key)||!P&&d||gt(e,O)||!R.current)return;const k=j==="rtl",S=k?Ee:Te,H=k?Te:Ee,F=r==="vertical"?ye:S,U=r==="vertical"?Ie:H,N=he(e.nativeEvent);if(N!=null&&Ce(N)&&!qe(N)){const q=N.selectionStart,m=N.selectionEnd,B=N.value;if(q==null||e.shiftKey||q!==m||e.key!==U&&q<B.length||e.key!==F&&q>0)return}let h=f;const z=tt(s,v),$=nt(s,v);C!=null&&(h=C({disabledIndices:v,elementsRef:s,event:e,highlightedIndex:f,loopFocus:o,maxIndex:$,minIndex:z,onLoop:L,orientation:r,rtl:k}));const K=r!=="vertical"&&e.key===S||r!=="horizontal"&&e.key===ye,J=r!=="vertical"&&e.key===H||r!=="horizontal"&&e.key===Ie;P&&(e.key===xe?h=z:e.key===Re&&(h=$)),h===f&&(K||J)&&(o&&h===$&&K?(h=z,i&&(h=i(e,f,h,s))):o&&h===z&&J?(h=$,i&&(h=i(e,f,h,s))):h=le(s.current,{startingIndex:h,decrement:J,disabledIndices:v})),h!==f&&!ce(s.current,h)&&(w&&e.stopPropagation(),(l||d||K||J)&&e.preventDefault(),g(h,!0),queueMicrotask(()=>{s.current[h]?.focus()}))});return{props:{ref:y,onFocus(e){const d=R.current,b=he(e.nativeEvent);!d||b==null||!Ce(b)||b.setSelectionRange(0,b.value.length)},onKeyDown:c},highlightedIndex:f,onHighlightedIndexChange:g,elementsRef:s,onMapChange:V,relayKeyboardEvent:c}}function gt(t,o){for(const r of at)if(!o.includes(r)&&t.getModifierState(r))return!0;return!1}function bt(t){const{render:o,className:r,style:C,refs:i=ue,props:j=ue,state:u=Ve,stateAttributesMapping:A,highlightedIndex:E,onHighlightedIndexChange:P,orientation:w,grid:v,loopFocus:O,onLoop:D,enableHomeAndEndKeys:x,onMapChange:l,stopEventPropagation:R=!0,rootRef:y,disabledIndices:s,modifierKeys:T,highlightItemOnHover:f=!1,tag:g="div",...V}=t,L=Je(),{props:c,highlightedIndex:I,onHighlightedIndexChange:e,elementsRef:d,onMapChange:b,relayKeyboardEvent:k}=pt({grid:v,loopFocus:O,onLoop:D,orientation:w,highlightedIndex:E,onHighlightedIndexChange:P,rootRef:y,stopEventPropagation:R,enableHomeAndEndKeys:x,direction:L,disabledIndices:s,modifierKeys:T}),S=oe(g,t,{state:u,ref:i,props:[c,...j,V],stateAttributesMapping:A}),H=a.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:e,highlightItemOnHover:f,relayKeyboardEvent:k}),[I,e,f,k]);return n.jsx(ze.Provider,{value:H,children:n.jsx(ke,{elementsRef:d,onMapChange:F=>{l?.(F),b(F)},children:S})})}const ht=a.forwardRef(function(o,r){const{activateOnFocus:C=!1,className:i,loopFocus:j=!0,render:u,style:A,...E}=o,{orientation:P,setTabMap:w,tabActivationDirection:v}=fe(),[O,D]=a.useState(0),[x,l]=a.useState(null),R=a.useRef(new Set),y=a.useRef(new Set),s=a.useRef(null);Z(()=>{if(typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>{R.current.forEach(I=>{I()})});return s.current=c,x&&c.observe(x),y.current.forEach(I=>{c.observe(I)}),()=>{c.disconnect(),s.current=null}},[x]);const T=_(c=>(R.current.add(c),()=>{R.current.delete(c)})),f=_(c=>(y.current.add(c),s.current?.observe(c),()=>{y.current.delete(c),s.current?.unobserve(c)})),g={orientation:P,tabActivationDirection:v},V={"aria-orientation":P==="vertical"?"vertical":void 0,role:"tablist"},L=a.useMemo(()=>({activateOnFocus:C,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:f,tabsListElement:x}),[C,T,f,x]);return n.jsx(De.Provider,{value:L,children:n.jsx(bt,{render:u,className:i,style:A,state:g,refs:[r,l],props:[V,E],stateAttributesMapping:ie,highlightedIndex:O,enableHomeAndEndKeys:!0,loopFocus:j,orientation:P,onHighlightedIndexChange:D,onMapChange:w,disabledIndices:ue})})});function vt({className:t,orientation:o="horizontal",...r}){return n.jsx(it,{"data-slot":"tabs","data-orientation":o,className:re("group/tabs flex gap-2 data-horizontal:flex-col",t),...r})}const mt=He("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function xt({className:t,variant:o="default",...r}){return n.jsx(ht,{"data-slot":"tabs-list","data-variant":o,className:re(mt({variant:o}),t),...r})}function te({className:t,...o}){return n.jsx(ct,{"data-slot":"tabs-trigger",className:re("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",t),...o})}function ne({className:t,...o}){return n.jsx(dt,{"data-slot":"tabs-content",className:re("flex-1 text-sm outline-none",t),...o})}function Rt(t){return`<script src="${location.origin}/snag.js" ${Be("site")}="${t}" defer><\/script>`}function Y({code:t,label:o}){const[r,C]=a.useState(!1);return n.jsxs("div",{className:"relative rounded-md border border-border bg-background px-3 py-2.5 pr-11 font-mono text-[12.5px] leading-relaxed",children:[n.jsx("code",{className:"whitespace-pre-wrap break-all",children:t}),n.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"absolute right-1.5 top-1.5","aria-label":r?"Copied":o,onClick:()=>{navigator.clipboard?.writeText(t),C(!0),setTimeout(()=>C(!1),1500)},children:r?n.jsx(ot,{}):n.jsx(rt,{})})]})}const se="npm install snagset";function ae({children:t}){return n.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:t})}function wt({uid:t}){const o=location.origin,r=`host="${o}" site="${t}"`;return n.jsxs(vt,{defaultValue:"html",className:"gap-3",children:[n.jsxs(xt,{className:"w-full",children:[n.jsx(te,{value:"html",children:"HTML"}),n.jsx(te,{value:"next",children:"Next.js"}),n.jsx(te,{value:"react",children:"React"}),n.jsx(te,{value:"vue",children:"Vue"}),n.jsx(te,{value:"js",children:"JS"})]}),n.jsxs(ne,{value:"html",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:Rt(t),label:"Copy the tag"}),n.jsxs(ae,{children:["Paste it before ",n.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed. On WordPress, Webflow, Framer or Squarespace, put it in the site's footer or custom code setting."]})]}),n.jsxs(ne,{value:"next",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:se,label:"Copy the install command"}),n.jsx(Y,{code:`// app/layout.tsx
2
+ import { Snagset } from "snagset/next";
3
+
4
+ <body>
5
+ {children}
6
+ <Snagset ${r} />
7
+ </body>`,label:"Copy the Next.js code"}),n.jsx(ae,{children:"It renders the tag on the server, so it adds no client JavaScript."})]}),n.jsxs(ne,{value:"react",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:se,label:"Copy the install command"}),n.jsx(Y,{code:`import Snagset from "snagset/react";
8
+
9
+ <Snagset ${r} />`,label:"Copy the React code"}),n.jsx(ae,{children:"Put it once, near the root of the app."})]}),n.jsxs(ne,{value:"vue",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:se,label:"Copy the install command"}),n.jsx(Y,{code:`<script setup>
10
+ import Snagset from "snagset/vue";
11
+ <\/script>
12
+
13
+ <template>
14
+ <Snagset ${r} />
15
+ </template>`,label:"Copy the Vue code"}),n.jsx(ae,{children:"Put it once, in the root component."})]}),n.jsxs(ne,{value:"js",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:se,label:"Copy the install command"}),n.jsx(Y,{code:`import snagset from "snagset";
16
+
17
+ snagset.init({ host: "${o}", site: "${t}" });`,label:"Copy the JavaScript code"}),n.jsx(ae,{children:"For any other bundler or framework."})]})]})}export{Ae as A,bt as C,wt as I};
@@ -0,0 +1 @@
1
+ import{d as U,r as f,a5 as y,s as v,a6 as j,a2 as S,j as e,B as x,A as w,C as M}from"./index-_7kIe8FW.js";import{u as L}from"./useQuery-ClGlUO36.js";import{i as B,j as K,l as R,k as I,m as P,n as E}from"./dialog-B1TvUOp8.js";import{L as k,I as C}from"./label-BkHFb2_L.js";import{C as z}from"./ConfirmDialog-CHiXSDkR.js";import{a as N}from"./parts-DGVjMHe8.js";import{v as A}from"./useScrollLock-DdWilGdG.js";import{u as _}from"./me-BDpKAhA-.js";function ee({owner:t}){const r=L(w.instance()),l=U(),s=()=>l.invalidateQueries({queryKey:w.instance().queryKey}),[g,m]=f.useState(!1),[b,p]=f.useState(!1),[h,u]=f.useState(null),d=y({mutationFn:v.disconnectStorage,onSuccess:()=>void s(),onError:c=>j.error(S(c))}),n=y({mutationFn:v.disconnectMail,onSuccess:()=>void s(),onError:c=>j.error(S(c))}),i=y({mutationFn:v.testMail,onSuccess:c=>j.success(`Sent to ${c.to}`),onError:c=>j.error(S(c))}),a=r.data?.storage,o=r.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(N,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!r.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:r.isError?"Could not read it.":"Reading…"}),a&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{tone:a.connected?"ok":a.unreadable?"bad":"off",text:a.connected?`Connected · ${a.bucket} at ${(a.endpoint??"").replace(/^https?:\/\//,"")}${a.connectedAt?` · since ${A(a.connectedAt)}`:""}`:a.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."}),e.jsx(O,{}),a.source==="env"?e.jsx($,{what:"SNAGSET_STORAGE_S3_*"}):t?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{variant:"outline",size:"sm",onClick:()=>m(!0),children:a.connected||a.unreadable?"Replace…":"Connect a bucket…"}),(a.connected||a.unreadable)&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(N,{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(D,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${A(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($,{what:"SNAGSET_MAIL_URL"}):t?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(x,{variant:"outline",size:"sm",onClick:()=>p(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(x,{variant:"outline",size:"sm",loading:i.isPending,onClick:()=>i.mutate(),children:i.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&t===!1,null)]})}),e.jsx(q,{open:g,onOpenChange:m,onDone:()=>void s()}),e.jsx(G,{open:b,onOpenChange:p,onDone:()=>void s()}),e.jsx(z,{open:h!==null,onOpenChange:c=>!c&&u(null),title:h==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:h==="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:d.isPending||n.isPending,onConfirm:async()=>{h==="storage"?await d.mutateAsync():await n.mutateAsync(),u(null)}})]})}function T(){const{storage:t}=_().limits;return t.limit===null?null:`${F(t.used)} of ${F(t.limit)} used across the studio's sites.`}function O(){const t=T();return t===null?null:e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:t})}function te(){const t=T();return t===null?null:e.jsx(N,{title:"Storage",description:"Screenshots and files, against the studio's plan.",children:e.jsx("p",{className:"m-0 text-[13px]",children:t})})}function D({tone:t,text:r}){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 ${t==="ok"?"bg-ok":t==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:r})]})}function $({what:t}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:t}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function q({open:t,onOpenChange:r,onDone:l}){const[s,g]=f.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[m,b]=f.useState(""),p=y({mutationFn:v.connectStorage}),h=n=>i=>g({...s,[n]:i.target.value}),u=async n=>{n.preventDefault(),b("");try{await p.mutateAsync({endpoint:s.endpoint.trim(),bucket:s.bucket.trim(),accessKeyId:s.accessKeyId.trim(),secretAccessKey:s.secretAccessKey,...s.region.trim()?{region:s.region.trim()}:{},...s.publicBaseUrl.trim()?{publicBaseUrl:s.publicBaseUrl.trim()}:{}}),g({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),r(!1),l(),j.success("Bucket connected — screenshots are on")}catch(i){b(i instanceof M?i.message:"Could not reach the server.")}},d=(n,i,a,o="text",c)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:`st-${n}`,children:i}),e.jsx(C,{id:`st-${n}`,type:o,placeholder:a,value:s[n],onChange:h(n),autoComplete:"off"}),c&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c})]});return e.jsx(B,{open:t,onOpenChange:r,children:e.jsx(K,{children:e.jsxs("form",{onSubmit:n=>void u(n),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(P,{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."})]}),m&&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:m}),d("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),d("bucket","Bucket","snagset"),d("region","Region","auto","text","Leave empty for providers that do not use one."),d("accessKeyId","Access key ID",""),d("secretAccessKey","Secret access key","","password"),d("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(E,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:p.isPending,children:p.isPending?"Probing…":"Connect"})]})]})})})}function G({open:t,onOpenChange:r,onDone:l}){const[s,g]=f.useState(""),[m,b]=f.useState(""),[p,h]=f.useState(""),u=y({mutationFn:v.connectMail}),d=async n=>{n.preventDefault(),h("");try{await u.mutateAsync({url:s.trim(),from:m.trim()}),g(""),b(""),r(!1),l(),j.success("Transport connected — send a test email to be sure")}catch(i){h(i instanceof M?i.message:"Could not reach the server.")}};return e.jsx(B,{open:t,onOpenChange:r,children:e.jsx(K,{children:e.jsxs("form",{onSubmit:n=>void d(n),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(P,{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."})]}),p&&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:p}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"mail-url",children:"Transport"}),e.jsx(C,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:s,onChange:n=>g(n.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"mail-from",children:"From"}),e.jsx(C,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:m,onChange:n=>b(n.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(E,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:u.isPending,disabled:!s.trim()||!m.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function F(t){const r=["B","KB","MB","GB","TB"];let l=t,s=0;for(;l>=1024&&s<r.length-1;)l/=1024,s+=1;return`${s===0?l:l.toFixed(l>=10?0:1)} ${r[s]}`}export{ee as I,te as S,F as b};
@@ -0,0 +1 @@
1
+ import{d as Q,r as p,a5 as P,j as e,$ as J,B as b,a6 as A,a2 as D,A as M,s as R,a9 as K,C as z}from"./index-_7kIe8FW.js";import{P as E}from"./Picker-CtjWzkpT.js";import{u as G}from"./useQuery-ClGlUO36.js";import{B as O}from"./badge-Dybw0_bq.js";import{i as F,j as _,l as $,k as B,m as I,n as q}from"./dialog-B1TvUOp8.js";import{L as C,I as H}from"./label-BkHFb2_L.js";import{S as W}from"./switch-wRlAfGsi.js";import{C as U}from"./ConfirmDialog-CHiXSDkR.js";import{C as w}from"./CopyButton-DkXHOvAs.js";import{a as Y}from"./parts-DGVjMHe8.js";import{v as V}from"./useScrollLock-DdWilGdG.js";function me({owner:n,instanceOwner:i,operator:f,sites:v,mine:h=!1}){const o=Q(),a=G(M.mcpTokens()),[x,u]=p.useState(!1),[l,m]=p.useState(null),[c,g]=p.useState(null),k=P({mutationFn:t=>R.revokeMcpToken(t),onSuccess:()=>{g(null),o.invalidateQueries({queryKey:["mcp-tokens"]})},onError:t=>A.error(D(t))}),j=a.data?.data??[],N=j.filter(t=>!t.revokedAt),d=a.data?.http??null,y=P({mutationFn:t=>R.setMcpHttp(t),onSuccess:(t,s)=>{o.setQueryData(M.instance().queryKey,t),o.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(s?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:t=>A.error(D(t))}),S=t=>{const s=new Set(t),r=s.has("comments:write")||s.has("threads:write");return!r&&!s.has("context:read")?"Read-only":r?`Writes: ${[s.has("comments:write")?"reply":"",s.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Y,{title:h?"Your agent tokens":"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[a.isPending&&e.jsx(J,{rows:2}),d&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[d.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:d.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:d.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),d.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":i?"":f?" Only an owner can switch it.":" Only whoever runs this server can switch it."]})]}),e.jsx(W,{id:"mcp-http-on","aria-label":"Remote transport",checked:d.enabled,disabled:!i||d.source==="env"||y.isPending,onCheckedChange:t=>y.mutate(t)})]}),a.isSuccess&&N.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:h?"You have no agent tokens yet.":"No agent can read this studio yet."})]}),j.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:j.map(t=>e.jsxs("li",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px] ${t.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[t.prefix,"…"]}),e.jsx(O,{variant:"outline",className:t.revokedAt?"":"border-ok text-ok",children:t.revokedAt?"Revoked":S(t.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[t.site?t.site.name:"All sites"," · ",t.lastUsedAt?`last used ${V(t.lastUsedAt)}`:"never used",t.expiresAt&&!t.revokedAt?` · expires ${new Date(t.expiresAt).toLocaleDateString()}`:"",t.createdBy?` · by ${t.createdBy}`:""]}),t.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>g(t),children:"Revoke"})})]},t.id))}),n&&e.jsx("div",{children:e.jsx(b,{variant:"outline",size:"sm",onClick:()=>u(!0),children:"New token…"})}),e.jsx(X,{open:x,onOpenChange:u,sites:v,http:a.data?.http??null,onDone:t=>{o.invalidateQueries({queryKey:["mcp-tokens"]}),m(t)}}),e.jsx(Z,{state:l,http:a.data?.http??null,onClose:()=>m(null)}),e.jsx(U,{open:c!==null,onOpenChange:t=>!t&&g(null),title:`Revoke “${c?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:k.isPending,onConfirm:async()=>{c&&await k.mutateAsync(c.id)}})]})}function X({open:n,onOpenChange:i,sites:f,http:v,onDone:h}){const[o,a]=p.useState(""),[x,u]=p.useState(""),[l,m]=p.useState(["threads:read","source:map"]),[c,g]=p.useState(""),[k,j]=p.useState(!1),[N,d]=p.useState(""),y=P({mutationFn:()=>R.mintMcpToken({name:o.trim(),...x?{site:x}:{},scopes:l,...c?{expiresInDays:Number(c)}:{},...k?{allowRemoteWrites:!0}:{}})}),S=(s,r)=>m(T=>r?[...new Set([...T,s])]:T.filter(L=>L!==s)),t=async s=>{s.preventDefault(),d("");try{const r=await y.mutateAsync();a(""),u(""),m(["threads:read","source:map"]),g(""),j(!1),i(!1),h(r)}catch(r){d(r instanceof z?r.message:"Could not reach the server.")}};return e.jsx(F,{open:n,onOpenChange:i,children:e.jsx(_,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs($,{children:[e.jsx(B,{children:"New agent token"}),e.jsx(I,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),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(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(H,{id:"mcp-name",placeholder:"Claude Code",value:o,onChange:s=>a(s.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsx(E,{id:"mcp-site",value:x,onChange:u,options:[{value:"",label:"All sites"},...f.map(s=>({value:s.uid,label:s.name}))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),K.map(s=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:l.includes(s.scope),onChange:r=>S(s.scope,r.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:s.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:s.hint})]})]},s.scope))]}),v?.enabled&&(l.includes("comments:write")||l.includes("threads:write"))&&e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:k,onChange:s=>j(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsx(E,{id:"mcp-expires",value:c,onChange:g,options:[{value:"",label:"Never"},{value:"30",label:"In 30 days"},{value:"90",label:"In 90 days"},{value:"365",label:"In a year"}]})]}),e.jsxs(q,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(b,{type:"submit",loading:y.isPending,disabled:!o.trim()||l.length===0,children:y.isPending?"Minting…":"Create token"})]})]})})})}function Z({state:n,http:i,onClose:f}){const v=typeof location<"u"?location.origin:"",h={SNAGSET_MCP_TOKEN:n?.secret??"",SNAGSET_MCP_HOST:v,...n?.token.site?{SNAGSET_MCP_PROJECT:n.token.site.uid}:{}},o=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:h}}},null,2),a=["claude mcp add snagset",...Object.entries(h).map(([m,c])=>`-e ${m}=${c}`),"--","npx -y @snagset/mcp"].join(" "),x=`Bearer ${n?.secret??""}`,u=["claude mcp add","--transport http","snagset",i?.url??"",`--header "Authorization: ${x}"`].join(" "),l=JSON.stringify({mcpServers:{snagset:{type:"http",url:i?.url??"",headers:{Authorization:x}}}},null,2);return e.jsx(F,{open:n!==null,onOpenChange:m=>!m&&f(),children:e.jsxs(_,{className:"sm:max-w-xl",children:[e.jsxs($,{children:[e.jsxs(B,{children:["Token for “",n?.token.name??"","”"]}),e.jsx(I,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),n&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:n.secret}),e.jsx(w,{text:n.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(w,{text:a,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:a})]}),i?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(w,{text:l,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:u}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:l}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(w,{text:o,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:o}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(q,{children:e.jsx(b,{type:"button",onClick:f,children:"Done"})})]})})}export{me as M};
@@ -0,0 +1 @@
1
+ import{j as a,h as o}from"./index-_7kIe8FW.js";import{S as x,a as b,b as d,c as j,d as S}from"./select-DjpYopV7.js";const l="__none__";function f({id:n,value:s,onChange:r,options:c,className:i,size:u="default","aria-label":m}){const t=c.map(e=>({value:e.value===""?l:e.value,label:e.label}));return a.jsxs(x,{items:t,value:s===""?l:s,onValueChange:e=>e!=null&&r(e===l?"":String(e)),children:[a.jsx(b,{id:n,size:u,"aria-label":m,className:o("w-full bg-card",i),children:a.jsx(d,{})}),a.jsx(j,{children:t.map(e=>a.jsx(S,{value:e.value,children:e.label},e.value))})]})}export{f as P};
@@ -1 +1 @@
1
- import{r,j as e,b3 as o}from"./index-DXj5DU-z.js";function l({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{l as S};
1
+ import{r,j as e,b3 as o}from"./index-_7kIe8FW.js";function l({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{l as S};
@@ -1 +1 @@
1
- import{j as e,u as n,G as a,B as r}from"./index-DXj5DU-z.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
1
+ import{j as e,u as n,G as a,B as r}from"./index-_7kIe8FW.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
@@ -1,4 +1,4 @@
1
- import{u as ft,a as xt,b as mt,c as O,d as je,r as o,e as L,f as ce,g as bt,j as e,B as Z,h as w,i as ne,m as ye,E as vt,k as Se,l as fe,n as jt,o as yt,p as ae,q as K,S as St,s as ee,t as $e,v as wt,L as _,w as Nt,M as Ct,x as kt,y as Tt,z as Pt,A as Be,O as Rt}from"./index-DXj5DU-z.js";import{u as we}from"./useQuery-BO7PrbuY.js";import{T as Mt,i as Fe,a as Et,D as Ot,b as Dt,c as It,X as At,d as _t,e as zt,f as Ht,g as Lt,R as $t,p as Bt,h as Ft,j as Ut,k as qt,P as Gt,l as Vt,u as Kt,m as Yt,n as Wt,o as Xt,q as Qt,r as Jt,s as Zt,t as es,v as ts,w as ss,x as ns,y as as,z as rs,F as os,A as is,B as ls,C as Ue,E as qe,G as Ge,H as ds,I as cs,J as us}from"./dialog-zaKAKGow.js";import{c as B,n as Ve,g as ps,a as xe,t as gs,d as hs,i as fs,u as xs,b as ue,L as ms,I as bs}from"./label-BNpdN3Cg.js";import{g as me,u as vs,a as js,b as ys,s as Ss,c as ws,d as Ns,S as Ke,E as J,D as re,e as oe,f as ie,h as Ne,i as te,j as I,k as V,l as Cs,m as pe}from"./dropdown-menu-DBe6PomQ.js";import{u as ks,a as Ts,g as Ps,A as Rs,b as Ms}from"./avatar-CE2TkZa-.js";import{u as Es}from"./inertValue-Bju6oxRr.js";import{u as Ye}from"./useRender-0SJIdv0u.js";import{S as Os,i as Ds,a as Is}from"./labels--UUyt9uB.js";import{u as le}from"./me-DRWJq-k_.js";import{L as se}from"./layout-grid-DkVlSz3z.js";import{U as be}from"./users-kg2hhvKi.js";import{c as As}from"./update-duXzIzFS.js";import{P as We}from"./plus-1z8Ku-LH.js";import{M as _s,S as zs,a as Hs}from"./sun-BHujGXQB.js";import"./useBaseQuery-Dl2qdxNT.js";import"./check-DJgo7I6A.js";import"./CompositeList-CizhTu5k.js";import"./CompositeItem-BOk-i3nR.js";import"./useCompositeItem-eZ3mWAYz.js";import"./useValueChanged-D634YMNF.js";function Ls(t){const s=ft({warn:t?.router===void 0}),n=t?.router||s;return xt(n.stores.__store,mt(t,n))}/**
1
+ import{u as ht,a as xt,b as mt,c as O,d as je,r as o,e as L,f as ce,g as bt,j as e,B as Z,h as w,i as ne,m as ye,E as vt,k as Se,l as he,n as jt,o as yt,p as ae,q as K,S as St,s as ee,t as $e,v as wt,L as _,w as Nt,M as Ct,x as kt,y as Tt,z as Pt,A as Be,O as Rt}from"./index-_7kIe8FW.js";import{u as we}from"./useQuery-ClGlUO36.js";import{D as Mt,a as Et,b as Ot,X as Dt,c as It,d as At,e as _t,f as zt,p as Ht,g as Lt,h as $t,i as Fe,j as Ue,k as qe,l as Bt,m as Ft,n as Ut}from"./dialog-B1TvUOp8.js";import{T as qt,i as Ve,a as Vt,R as Gt,b as Kt,P as Yt,f as Wt,u as Xt,c as Qt,d as Jt,e as Zt,g as es,h as ts,j as ss,k as ns,l as as,m as rs,t as os,n as is,o as ls,F as ds,p as cs,q as us,S as ps,r as gs,s as fs}from"./useScrollLock-DdWilGdG.js";import{c as B,n as Ge,g as hs,a as xe,t as xs,d as ms,i as bs,u as vs,b as ue}from"./createBaseUIEventDetails-DviWdj-N.js";import{g as me,u as js,a as ys,b as Ss,s as ws,c as Ns,d as Cs,S as Ke,E as J,D as re,e as oe,f as ie,h as Ne,i as te,j as I,k as G,l as ks,m as pe}from"./dropdown-menu-DQDS-MXM.js";import{u as Ts,a as Ps,g as Rs}from"./getPseudoElementBounds-Bv3Ra6Wj.js";import{u as Ms}from"./inertValue-BSe8K39O.js";import{u as Ye}from"./useRender-BO4-nlty.js";import{A as Es,a as Os}from"./avatar-BL6yPDkc.js";import{L as Ds,I as Is}from"./label-BkHFb2_L.js";import{u as le}from"./me-BDpKAhA-.js";import{L as se}from"./layout-grid-Dt1Q4YQ_.js";import{U as be}from"./users-BDCRp6bm.js";import{c as As}from"./update-duXzIzFS.js";import{P as We}from"./plus-hkwBCzos.js";import{M as _s,S as zs,a as Hs}from"./sun-Ciy3ROc0.js";import"./useBaseQuery-DVrotnH-.js";import"./check-Dfkv0gma.js";import"./CompositeList-w7YcjHbo.js";import"./CompositeItem-D7Q5QVvi.js";import"./useCompositeItem-fDEe_Juq.js";import"./useValueChanged-Cm4_pRNG.js";function Ls(t){const s=ht({warn:t?.router===void 0}),n=t?.router||s;return xt(n.stores.__store,mt(t,n))}/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -28,7 +28,7 @@ import{u as ft,a as xt,b as mt,c as O,d as je,r as o,e as L,f as ce,g as bt,j as
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 Gs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Vs=O("circle-question-mark",Gs);/**
31
+ */const Vs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Gs=O("circle-question-mark",Vs);/**
32
32
  * @license lucide-react v1.39.0 - ISC
33
33
  *
34
34
  * This source code is licensed under the ISC license.
@@ -58,4 +58,4 @@ import{u as ft,a as xt,b as mt,c as O,d as je,r as o,e as L,f as ce,g as bt,j as
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const tn=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],et=O("user",tn),sn=[["mcp-tokens"],["instance"],["integrations"],["invites"],["members"]];function nn(){const t=le().user.role,s=je(),n=o.useRef(t);o.useEffect(()=>{if(n.current!==t){n.current=t;for(const a of sn)s.resetQueries({queryKey:a})}},[t,s])}const ge=768;function an(){const[t,s]=o.useState(void 0);return o.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ge-1}px)`),a=()=>{s(window.innerWidth<ge)};return n.addEventListener("change",a),s(window.innerWidth<ge),()=>n.removeEventListener("change",a)},[]),!!t}const rn=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Mt,currentIdRef:{current:null},currentContextRef:{current:null}});function on(t,s){t.current=s.current}function ln(t,s={open:!1}){const{open:n}=s,a="rootStore"in t?t.rootStore:t,r=a.useState("floatingId"),u=o.useContext(rn),{currentIdRef:d,delayRef:i,timeoutMs:x,initialDelayRef:c,currentContextRef:g,hasProvider:b,timeout:f}=u,[j,l]=o.useState(!1),S=o.useRef(n);return L(()=>{S.current=n},[n]),L(()=>{function h(){g.current?.setIsInstantPhase(!1),d.current=null,g.current=null,i.current=c.current,f.clear()}if(d.current&&!n&&d.current===r){if(l(!1),x){const m=r;return f.start(x,()=>{a.select("open")||d.current&&d.current!==m||h()}),()=>{(S.current||d.current!==m)&&f.clear()}}h()}},[n,r,d,i,x,c,g,f,a]),L(()=>{if(!n)return;const h=g.current,m=d.current;f.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:l},d.current=r,i.current={open:0,close:me(c.current,"close")},m!==null&&m!==r?(l(!0),h?.setIsInstantPhase(!0),h?.onOpenChange(!1,B(Ve))):(l(!1),h?.setIsInstantPhase(!1))},[n,r,a,d,i,c,g,f]),L(()=>()=>{if(d.current===r){if(g.current=null,!S.current)return;d.current=null,on(i,c),f.clear()}},[g,d,i,r,c,f]),o.useMemo(()=>({hasProvider:b,delayRef:i,isInstantPhase:j}),[b,i,j])}function dn(t,s){let n=null,a=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const u=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=s.axis==="x"||s.axis==="both",i=s.axis==="y"||s.axis==="both",x=["mouseenter","mousemove"].includes(s.dataRef.current.openEvent?.type||"")&&s.pointerType!=="touch";let c=u.width,g=u.height,b=u.x,f=u.y;return n==null&&s.x&&d&&(n=u.x-s.x),a==null&&s.y&&i&&(a=u.y-s.y),b-=n||0,f-=a||0,c=0,g=0,!r||x?(c=s.axis==="y"?u.width:0,g=s.axis==="x"?u.height:0,b=d&&s.x!=null?s.x:b,f=i&&s.y!=null?s.y:f):r&&!x&&(g=s.axis==="x"?u.height:g,c=s.axis==="y"?u.width:c),r=!0,{width:c,height:g,x:b,y:f,top:f,right:b+c,bottom:f+g,left:b}}}}function Ae(t){return t!=null&&t.clientX!=null}function cn(t,s={}){const{enabled:n=!0,axis:a="both"}=s,r="rootStore"in t?t.rootStore:t,u=r.useState("open"),d=r.useState("floatingElement"),i=r.useState("domReferenceElement"),x=r.context.dataRef,c=o.useRef(!1),g=o.useRef(null),[b,f]=o.useState(),[j,l]=o.useState([]),S=ce(v=>{r.set("positionReference",v)}),h=ce((v,y,R)=>{c.current||x.current.openEvent&&!Ae(x.current.openEvent)||r.set("positionReference",dn(R??i,{x:v,y,axis:a,dataRef:x,pointerType:b}))}),m=ce(v=>{u?g.current||(h(v.clientX,v.clientY,v.currentTarget),l([])):h(v.clientX,v.clientY,v.currentTarget)}),C=Fe(b)?d:u;o.useEffect(()=>{if(!n){S(i);return}if(!C)return;function v(){g.current?.(),g.current=null}const y=bt(d);function R(P){const p=ps(P);xe(d,p)?v():h(P.clientX,P.clientY)}return!x.current.openEvent||Ae(x.current.openEvent)?g.current=Et(y,"mousemove",R):S(i),v},[C,n,d,x,i,r,h,S,j]),o.useEffect(()=>()=>{r.set("positionReference",null)},[r]),o.useEffect(()=>{n&&!d&&(c.current=!1)},[n,d]),o.useEffect(()=>{!n&&u&&(c.current=!0)},[n,u]);const N=o.useMemo(()=>{function v(y){f(y.pointerType)}return{onPointerDown:v,onPointerEnter:v,onMouseMove:m,onMouseEnter:m}},[m]);return o.useMemo(()=>n?{reference:N,trigger:N}:{},[n,N])}function un({...t}){return e.jsx(Ot,{"data-slot":"sheet",...t})}function pn({...t}){return e.jsx(Ht,{"data-slot":"sheet-portal",...t})}function gn({className:t,...s}){return e.jsx(Lt,{"data-slot":"sheet-overlay",className:w("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",t),...s})}function hn({className:t,children:s,side:n="right",showCloseButton:a=!0,...r}){return e.jsxs(pn,{children:[e.jsx(gn,{}),e.jsxs(Dt,{"data-slot":"sheet-content","data-side":n,className:w("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...r,children:[s,a&&e.jsxs(It,{"data-slot":"sheet-close",render:e.jsx(Z,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[e.jsx(At,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fn({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:w("flex flex-col gap-0.5 p-4",t),...s})}function xn({className:t,...s}){return e.jsx(_t,{"data-slot":"sheet-title",className:w("font-heading text-base font-medium text-foreground",t),...s})}function mn({className:t,...s}){return e.jsx(zt,{"data-slot":"sheet-description",className:w("text-sm text-muted-foreground",t),...s})}const tt=o.createContext(void 0);function Y(t){const s=o.useContext(tt);if(s===void 0&&!t)throw new Error(ne(72));return s}const bn={...Bt,disabled:t=>t.disabled,instantType:t=>t.instantType,isInstantPhase:t=>t.isInstantPhase,trackCursorAxis:t=>t.trackCursorAxis,disableHoverablePopup:t=>t.disableHoverablePopup,lastOpenChangeReason:t=>t.openChangeReason,closeOnClick:t=>t.closeOnClick,closeDelay:t=>t.closeDelay,adaptiveOrigin:t=>t.adaptiveOrigin};class vn extends $t{constructor(s,n,a){const r=new Gt;super(jn(s,r,n,a),yn(r),bn)}setOpen=(s,n)=>{Ft(this,s,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(s){this.state.floatingRootContext.dispatchOpenChange(!1,B(gs,s))}}function jn(t,s,n,a=!1){const r={...Ut(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...t};return r.floatingRootContext=qt(s,n,a),r}function yn(t){return{popupRef:o.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:t}}const Sn=Vt(function(s){const{disabled:n=!1,defaultOpen:a=!1,open:r,disableHoverablePopup:u=!1,trackCursorAxis:d="none",actionsRef:i,onOpenChange:x,onOpenChangeComplete:c,handle:g,triggerId:b,defaultTriggerId:f=null,children:j}=s,l=Kt(($,F)=>new vn({open:a,openProp:r,activeTriggerId:f,triggerIdProp:b},$,F));l.useControlledProp("openProp",r),l.useControlledProp("triggerIdProp",b),l.useContextCallback("onOpenChange",x),l.useContextCallback("onOpenChangeComplete",c);const S=l.useState("open"),h=!n&&S,m=l.useState("activeTriggerId"),C=l.useState("mounted"),N=l.useState("payload");l.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:u,disabled:n}),Yt(l,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:v,transitionStatus:y}=Wt(h,l),R=l.useState("isInstantPhase"),P=l.useState("instantType"),p=l.useState("lastOpenChangeReason"),k=o.useRef(null);L(()=>{S&&n&&l.setOpen(!1,B(hs))},[S,n,l]),L(()=>{y==="ending"&&p===Ve||y!=="ending"&&R?(P!=="delay"&&(k.current=P),l.set("instantType","delay")):k.current!==null&&(l.set("instantType",k.current),k.current=null)},[y,R,p,P,l]),L(()=>{h&&m==null&&l.set("payload",void 0)},[l,m,h]),o.useImperativeHandle(i,()=>({unmount:v,close:()=>l.setOpen(!1,B(fs))}),[v,l]);const A=h||C||!n&&d!=="none";return e.jsxs(tt.Provider,{value:l,children:[g&&e.jsx(Xt,{handle:g,store:l}),A&&e.jsx(wn,{store:l,disabled:n,trackCursorAxis:d}),typeof j=="function"?j({payload:N}):j]})});function wn({store:t,disabled:s,trackCursorAxis:n}){const a=t.useState("floatingRootContext"),r=Qt(a,{enabled:!s,referencePress:()=>t.select("closeOnClick")}),u=cn(a,{enabled:!s&&n!=="none",axis:n==="none"?void 0:n}),d=o.useMemo(()=>ye(u.reference,r.reference),[u.reference,r.reference]);return Jt(t,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:r.floating??vt}),null}const Nn=o.createContext(void 0);function Cn(){return o.useContext(Nn)}const _e=600,st="data-base-ui-tooltip-trigger";function ze(t){if("composedPath"in t){const n=t.composedPath();for(let a=0;a<n.length;a+=1){const r=n[a];if(fe(r))return r}}const s=t.target;return fe(s)?s:null}function kn(t){let s=t;for(;s;){const n=s.closest(`[${st}]`);if(n)return n;const a=s.getRootNode();s="host"in a&&fe(a.host)?a.host:null}return null}const Tn=Zt(function(s,n){const{render:a,className:r,style:u,handle:d,payload:i,disabled:x,delay:c,closeOnClick:g=!0,closeDelay:b,id:f,...j}=s,l=Y(!0),h=vs(d)??l;if(!h)throw new Error(ne(82));const m=xs(f),C=h.useState("isTriggerActive",m),N=h.useState("isOpenedByTrigger",m),v=h.useState("floatingRootContext"),y=o.useRef(null),R=c??_e,P=b??0,{registerTrigger:p,isMountedByThisTrigger:k}=es(m,y,h,{payload:i,closeOnClick:g,closeDelay:P}),A=Cn(),{delayRef:$,isInstantPhase:F,hasProvider:D}=ln(v,{open:N}),U=js(v);h.useSyncedValue("isInstantPhase",F);const de=h.useState("disabled"),q=x??de,Pe=ts(q),Re=h.useState("trackCursorAxis"),lt=h.useState("disableHoverablePopup"),G=o.useRef(!1),W=ss(),X=o.useRef(void 0);function Me(){return D?me($.current,"open")===0?0:c??A??_e:R}function Ee(T){const z=y.current;if(!z||!T)return!1;const H=kn(T);return H!==null&&H!==z&&xe(z,H)}function dt(T){const z=Ee(T);return G.current=z,z&&(U.openChangeTimeout.clear(),U.restTimeout.clear(),U.restTimeoutPending=!1,W.clear()),z}const ct=ys(v,{enabled:!q,mouseOnly:!0,move:!1,handleClose:!lt&&Re!=="both"?Ss():null,restMs:Me,delay(){return b==null&&D?{close:me($.current,"close")}:{close:P}},triggerElementRef:y,isActiveTrigger:C,isClosing:()=>h.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),ut=ws(v,{enabled:!q}).reference,pt=T=>{const z=G.current,H=ze(T),Oe=dt(H),Q=y.current,ht=Q&&H&&xe(Q,H);if(Oe&&h.select("open")&&h.select("lastOpenChangeReason")===ue){h.setOpen(!1,B(ue,T));return}if(z&&!Oe&&ht&&!Pe.current&&!h.select("open")&&Q&&Fe(X.current)){const De=()=>{!G.current&&!Pe.current&&!h.select("open")&&h.setOpen(!0,B(ue,T,Q))},Ie=Me();Ie===0?(W.clear(),De()):W.start(Ie,De)}},gt=h.useState("triggerProps",k);return Se("button",s,{state:{open:N},ref:[n,p,y],props:[ct,ut,k||Re!=="none"?gt:void 0,{onMouseOver(T){pt(T.nativeEvent)},onFocus(T){Ee(ze(T.nativeEvent))&&T.preventBaseUIHandler()},onMouseLeave(){G.current=!1,W.clear(),X.current=void 0},onPointerEnter(T){X.current=T.pointerType},onPointerDown(T){X.current=T.pointerType,h.set("closeOnClick",g),g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},onClick(T){g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},id:m,"data-trigger-disabled":q?"":void 0,[st]:q?void 0:""},j],stateAttributesMapping:ns})}),nt=o.createContext(void 0);function Pn(){const t=o.useContext(nt);if(t===void 0)throw new Error(ne(70));return t}const Rn=o.forwardRef(function(s,n){const{children:a,container:r,className:u,render:d,style:i,...x}=s,{node:c,subtree:g}=as({container:r,ref:n,componentProps:s,elementProps:x});return!g&&!c?null:e.jsxs(o.Fragment,{children:[g,c&&jt.createPortal(a,c)]})}),Mn=o.forwardRef(function(s,n){const{keepMounted:a=!1,...r}=s;return Y().useState("mounted")||a?e.jsx(nt.Provider,{value:a,children:e.jsx(Rn,{ref:n,...r})}):null}),at=o.createContext(void 0);function rt(){const t=o.useContext(at);if(t===void 0)throw new Error(ne(71));return t}const En=o.forwardRef(function(s,n){const{render:a,className:r,anchor:u,positionMethod:d="absolute",side:i="top",align:x="center",sideOffset:c=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:f=5,arrowPadding:j=5,sticky:l=!1,disableAnchorTracking:S=!1,collisionAvoidance:h=rs,style:m,...C}=s,N=Y(),v=Pn(),y=N.useState("open"),R=N.useState("mounted"),P=N.useState("trackCursorAxis"),p=N.useState("disableHoverablePopup"),k=N.useState("floatingRootContext"),A=N.useState("instantType"),$=N.useState("transitionStatus"),F=N.useState("adaptiveOrigin"),D=ks({anchor:u,positionMethod:d,floatingRootContext:k,mounted:R,side:i,sideOffset:c,align:x,alignOffset:g,collisionBoundary:b,collisionPadding:f,sticky:l,arrowPadding:j,disableAnchorTracking:S,keepMounted:v,collisionAvoidance:h,adaptiveOrigin:F}),U=o.useMemo(()=>({open:y,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P!=="none"?"tracking-cursor":A}),[y,D.side,D.align,D.anchorHidden,P,A]),de=Ts(s,U,{styles:D.positionerStyles,transitionStatus:$,props:C,refs:[n,N.useStateSetter("positionerElement")],hidden:!R,inert:!y||P==="both"||p});return e.jsx(at.Provider,{value:D,children:de})}),On=o.forwardRef(function(s,n){const{render:a,className:r,style:u,...d}=s,i=Y(),{side:x,align:c}=rt(),g=i.useState("open"),b=i.useState("instantType"),f=i.useState("transitionStatus"),j=i.useState("popupProps"),l=i.useState("floatingRootContext"),S=i.useState("disabled"),h=i.useState("closeDelay");Es({open:g,ref:i.context.popupRef,onComplete(){g&&i.context.onOpenChangeComplete?.(!0)}}),Ns(l,{enabled:!S,closeDelay:h});const m=i.useStateSetter("popupElement");return Se("div",s,{state:{open:g,side:x,align:c,instant:b,transitionStatus:f},ref:[n,i.context.popupRef,m],props:[os,j,Ps(f),d],stateAttributesMapping:is})}),Dn=o.forwardRef(function(s,n){const{render:a,className:r,style:u,...d}=s,i=Y(),{arrowRef:x,side:c,align:g,arrowUncentered:b,arrowStyles:f}=rt(),j=i.useState("open"),l=i.useState("instantType");return Se("div",s,{state:{open:j,side:c,align:g,uncentered:b,instant:l},ref:[n,x],props:[{style:f,"aria-hidden":!0},d],stateAttributesMapping:ls})});function In({...t}){return e.jsx(Sn,{"data-slot":"tooltip",...t})}function An({...t}){return e.jsx(Tn,{"data-slot":"tooltip-trigger",...t})}function _n({className:t,side:s="top",sideOffset:n=4,align:a="center",alignOffset:r=0,children:u,...d}){return e.jsx(Mn,{children:e.jsx(En,{align:a,alignOffset:r,side:s,sideOffset:n,className:"isolate z-50",children:e.jsxs(On,{"data-slot":"tooltip-content",className:w("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...d,children:[u,e.jsx(Dn,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const zn="sidebar_state",Hn=3600*24*7,Ln="16rem",$n="18rem",Bn="3rem",Fn="b",ot=o.createContext(null);function Te(){const t=o.useContext(ot);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Un({defaultOpen:t=!0,open:s,onOpenChange:n,className:a,style:r,children:u,...d}){const i=an(),[x,c]=o.useState(!1),[g,b]=o.useState(t),f=s??g,j=o.useCallback(m=>{const C=typeof m=="function"?m(f):m;n?n(C):b(C),document.cookie=`${zn}=${C}; path=/; max-age=${Hn}`},[n,f]),l=o.useCallback(()=>i?c(m=>!m):j(m=>!m),[i,j,c]);o.useEffect(()=>{const m=C=>{C.key===Fn&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),l())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l]);const S=f?"expanded":"collapsed",h=o.useMemo(()=>({state:S,open:f,setOpen:j,isMobile:i,openMobile:x,setOpenMobile:c,toggleSidebar:l}),[S,f,j,i,x,c,l]);return e.jsx(ot.Provider,{value:h,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Ln,"--sidebar-width-icon":Bn,...r},className:w("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...d,children:u})})}function qn({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",className:a,children:r,dir:u,...d}){const{isMobile:i,state:x,openMobile:c,setOpenMobile:g}=Te();return n==="none"?e.jsx("div",{"data-slot":"sidebar",className:w("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...d,children:r}):i?e.jsx(un,{open:c,onOpenChange:g,...d,children:e.jsxs(hn,{dir:u,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":$n},side:t,children:[e.jsxs(fn,{className:"sr-only",children:[e.jsx(xn,{children:"Sidebar"}),e.jsx(mn,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:r})]})}):e.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":x,"data-collapsible":x==="collapsed"?n:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:w("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:w("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...d,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:r})})]})}function Gn({className:t,onClick:s,...n}){const{toggleSidebar:a}=Te();return e.jsxs(Z,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:w(t),onClick:r=>{s?.(r),a()},...n,children:[e.jsx(Zs,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Vn({className:t,...s}){return e.jsx("main",{"data-slot":"sidebar-inset",className:w("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...s})}function Kn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:w("flex flex-col gap-2 p-2",t),...s})}function Yn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:w("flex flex-col gap-2 p-2",t),...s})}function Wn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:w("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s})}function He({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:w("relative flex w-full min-w-0 flex-col p-2",t),...s})}function Xn({className:t,render:s,...n}){return Ye({defaultTagName:"div",props:ye({className:w("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",t)},n),render:s,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function Le({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:w("w-full text-sm",t),...s})}function he({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:w("flex w-full min-w-0 flex-col gap-0",t),...s})}function M({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:w("group/menu-item relative",t),...s})}const Qn=yt("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function E({render:t,isActive:s=!1,variant:n="default",size:a="default",tooltip:r,className:u,...d}){const{isMobile:i,state:x}=Te(),c=Ye({defaultTagName:"button",props:ye({className:w(Qn({variant:n,size:a}),u)},d),render:r?e.jsx(An,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:s}});return r?(typeof r=="string"&&(r={children:r}),e.jsxs(In,{children:[c,e.jsx(_n,{side:"right",align:"center",hidden:x!=="collapsed"||i,...r})]})):c}function Jn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:w("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",t),...s})}function Zn({open:t,onOpenChange:s}){const n=le(),a=ae(),[r,u]=o.useState(""),[d,i]=o.useState(0),x=o.useRef(null),c=r.trim(),[g,b]=o.useState("");o.useEffect(()=>{const p=setTimeout(()=>b(c),180);return()=>clearTimeout(p)},[c]);const f=we({queryKey:["activity","search",g],queryFn:()=>ee.activity({q:g,status:"all",limit:8}),enabled:t&&g.length>=2,staleTime:3e4});o.useEffect(()=>{t||(u(""),i(0))},[t]);const j=K(n.user.role,"settings"),l=o.useMemo(()=>[{id:"s:sites",label:"Sites",icon:e.jsx(se,{className:"size-4"}),go:()=>void a({to:"/sites"})},{id:"s:activity",label:"Activity",hint:"every site, newest first",icon:e.jsx(Xe,{className:"size-4"}),go:()=>void a({to:"/activity"})},...j?[{id:"s:members",label:"Members",icon:e.jsx(be,{className:"size-4"}),go:()=>void a({to:"/studio/members"})},{id:"s:integrations",label:"Integrations",icon:e.jsx(Qe,{className:"size-4"}),go:()=>void a({to:"/studio/integrations"})},{id:"s:studio",label:"Studio settings",icon:e.jsx(Ce,{className:"size-4"}),go:()=>void a({to:"/studio"})}]:[],{id:"s:you",label:"You",icon:e.jsx(et,{className:"size-4"}),go:()=>void a({to:"/you"})}],[a,j]),S=o.useMemo(()=>n.projects.map(p=>({id:`p:${p.uid}`,label:p.name,hint:p.unresolved>0?`${p.unresolved} open`:"nothing open",icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:p.uid}})})),[n.projects,a]),h=p=>!c||p.toLowerCase().includes(c.toLowerCase()),m=[],C=S.filter(p=>h(p.label)),N=l.filter(p=>h(p.label));C.length&&m.push({title:"Sites",items:C}),N.length&&m.push({title:"Go to",items:N});const v=(f.data?.data??[]).map(p=>({id:`t:${p.id}`,label:p.latest?.body?.trim()||p.route,hint:`${p.site.name} · ${Ds(p.status)?Os[p.status]:p.status} · ${p.key}`,icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:p.site.uid},search:{thread:p.key}})}));v.length&&m.push({title:"Comments",items:v});const y=m.flatMap(p=>p.items),R=Math.min(d,Math.max(0,y.length-1)),P=p=>{p&&(s(!1),p.go())};return o.useEffect(()=>{x.current?.querySelector(`[data-at="${R}"]`)?.scrollIntoView({block:"nearest"})},[R]),e.jsx(Ue,{open:t,onOpenChange:s,children:e.jsxs(qe,{showCloseButton:!1,className:"top-[15%] max-h-[70dvh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg",children:[e.jsx(Ge,{className:"sr-only",children:"Search and go"}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[e.jsx(Ke,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:r,onChange:p=>{u(p.target.value),i(0)},onKeyDown:p=>{p.key==="ArrowDown"?(p.preventDefault(),i(k=>Math.min(k+1,y.length-1))):p.key==="ArrowUp"?(p.preventDefault(),i(k=>Math.max(k-1,0))):p.key==="Enter"&&(p.preventDefault(),P(y[R]))},placeholder:"Go to a site or a screen, or search every comment…","aria-label":"Search and go",className:"h-11 w-full bg-transparent text-[14px] outline-none placeholder:text-muted-foreground"})]}),e.jsxs("div",{ref:x,className:"min-h-0 flex-1 overflow-auto py-1.5",children:[y.length===0&&e.jsx("p",{className:"m-0 px-3 py-6 text-center text-[13px] text-muted-foreground",children:f.isFetching?"Looking…":c?`Nothing matches “${c}”.`:"Nothing here."}),m.map(p=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:p.title}),p.items.map(k=>{const A=y.indexOf(k);return e.jsxs("button",{type:"button","data-at":A,onMouseMove:()=>i(A),onClick:()=>P(k),className:w("flex w-full items-center gap-2.5 border-0 bg-transparent px-3 py-2 text-left text-[13px] text-foreground",A===R&&"bg-muted"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:k.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.label}),k.hint&&e.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:k.hint})]},k.id)})]},p.title)),f.isFetching&&y.length>0&&e.jsxs("p",{className:"m-0 flex items-center gap-1.5 px-3 py-1.5 text-[12px] text-muted-foreground",children:[e.jsx(St,{className:"size-3"}),"Searching every site…"]})]})]})})}function ea(){const[t,s]=o.useState(!1);return o.useEffect(()=>{const n=a=>{a.key.toLowerCase()!=="k"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),s(r=>!r))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),[t,s]}const it="https://snagset.com/docs/",ta="https://www.npmjs.com/package/@snagset/server?activeTab=versions",sa="https://snagset.com/docs/self-hosting/#upgrade";function na({children:t}){const s=le(),n=$e(s),a=wt(s),[r,u]=ea();return nn(),e.jsxs(Un,{children:[e.jsx(oa,{me:s,site:a}),e.jsxs(Vn,{className:"min-w-0",children:[e.jsx(ua,{onSearch:()=>u(!0)}),n&&e.jsx(aa,{names:s.pendingMigrations??[],owner:s.user.role==="owner"}),n&&s.regionMismatch&&K(s.user.role,"settings")&&e.jsx(ra,{...s.regionMismatch}),e.jsx("div",{className:"min-h-0 flex-1",children:t})]}),e.jsx(Zn,{open:r,onOpenChange:u})]})}function aa({names:t,owner:s}){return t.length?e.jsxs("div",{role:"alert",className:"mx-7 mt-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:[e.jsxs("p",{className:"m-0 font-medium",children:["The database needs an update for this version (",t.length," ",t.length===1?"migration":"migrations",")."]}),e.jsx("p",{className:"m-0 mt-0.5",children:s?e.jsxs(e.Fragment,{children:["Run ",e.jsx("code",{className:"font-mono",children:"snagset migrate"})," with this instance's ",e.jsx("code",{className:"font-mono",children:"DATABASE_URL"})," — from the project, ",e.jsx("code",{className:"font-mono",children:"pnpm migrate"}),". Until then, parts of this version may fail."]}):"Ask the studio's owner to run snagset migrate. Until then, parts of this version may fail."})]}):null}function ra({functions:t,database:s,suggest:n}){return e.jsxs("div",{role:"status",className:"mx-7 mt-4 rounded-md border border-border bg-warn-soft px-3 py-2 text-[13px]",children:[e.jsxs("p",{className:"m-0 font-medium",children:["This server runs in ",t,", but its database is in ",s," — every page waits on that distance."]}),e.jsx("p",{className:"m-0 mt-0.5 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Add ",e.jsxs("code",{className:"font-mono",children:['"regions": ["',n,'"]']})," to ",e.jsx("code",{className:"font-mono",children:"vercel.json"})," and redeploy."]}):"Run the server in the same region as the database."})]})}function oa({me:t,site:s}){const n=Ls({select:i=>i.location.pathname}),a=i=>n===i||n.startsWith(i+"/"),r=K(t.user.role,"settings"),u=we(Be.setupState()),d=t.user.role==="owner"?u.data?.billingUrl:null;return e.jsxs(qn,{children:[e.jsx(Kn,{className:"px-3 pb-1 pt-3",children:e.jsx(ia,{me:t})}),e.jsxs(Wn,{children:[e.jsxs(He,{children:[e.jsx(la,{me:t,site:s}),s&&e.jsx(Le,{children:e.jsxs(he,{children:[e.jsxs(M,{children:[e.jsxs(E,{isActive:a(`/s/${s.uid}/comments`),render:e.jsx(_,{to:"/s/$site/comments",params:{site:s.uid}}),children:[e.jsx(ve,{}),e.jsx("span",{children:"Comments"})]}),s.unresolved>0&&e.jsx(Jn,{children:s.unresolved})]}),e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/reviewers`),render:e.jsx(_,{to:"/s/$site/reviewers",params:{site:s.uid}}),children:[e.jsx(be,{}),e.jsx("span",{children:"Reviewers"})]})}),r&&e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/settings`),render:e.jsx(_,{to:"/s/$site/settings",params:{site:s.uid}}),children:[e.jsx(Ze,{}),e.jsx("span",{children:"Site settings"})]})})]})})]}),e.jsxs(He,{children:[e.jsx(Xn,{children:"Studio"}),e.jsx(Le,{children:e.jsxs(he,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/sites"),render:e.jsx(_,{to:"/sites"}),children:[e.jsx(se,{}),e.jsx("span",{children:"Sites"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/activity"),render:e.jsx(_,{to:"/activity"}),children:[e.jsx(Xe,{}),e.jsx("span",{children:"Activity"})]})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/members"),render:e.jsx(_,{to:"/studio/members"}),children:[e.jsx(be,{}),e.jsx("span",{children:"Members"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/integrations"),render:e.jsx(_,{to:"/studio/integrations"}),children:[e.jsx(Qe,{}),e.jsx("span",{children:"Integrations"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:n==="/studio",render:e.jsx(_,{to:"/studio"}),children:[e.jsx(Ce,{}),e.jsx("span",{children:"Studio settings"})]})})]})]})})]})]}),e.jsx(Yn,{children:e.jsxs(he,{children:[d&&e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/plan"),render:e.jsx(_,{to:"/studio/plan"}),children:[e.jsx(Ys,{}),e.jsx("span",{children:"Plan & billing"})]})}),e.jsx(M,{children:e.jsxs(E,{render:e.jsx("a",{href:it,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Je,{}),e.jsx("span",{children:"Docs"}),e.jsx(J,{className:"ml-auto size-3.5 text-muted-foreground"})]})}),e.jsx(M,{children:e.jsx(da,{})}),e.jsx(M,{children:e.jsx(ca,{me:t})})]})})]})}function ia({me:t}){const s=ae(),n=je(),[a,r]=o.useState(!1),[u,d]=o.useState(""),[i,x]=o.useState(""),[c,g]=o.useState(!1),b=e.jsxs(e.Fragment,{children:[e.jsx(Ct,{size:20}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"block truncate text-[14px] font-semibold leading-tight tracking-tight",children:t.org.name}),e.jsx("span",{className:"block truncate text-[11.5px] text-muted-foreground",children:location.host})]})]}),f=K(t.user.role,"settings");if(t.orgs.length<=1&&!t.signupOpen)return f?e.jsx(_,{to:"/studio",className:"flex items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":`${t.org.name} — studio settings`,children:b}):e.jsx("div",{className:"flex items-center gap-2.5 px-1 py-0.5 text-foreground",children:b});const j=async l=>{g(!0),x("");try{await l(),n.clear(),r(!1),d(""),s({to:"/sites",replace:!0})}catch(S){x(S instanceof Error?S.message:"Something went wrong. Try again.")}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":"Switch studio"}),children:[b,e.jsx(ke,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Studios"}),t.orgs.map(l=>e.jsxs(I,{disabled:l.current,onClick:()=>void j(()=>ee.switchOrg(l.slug)),children:[e.jsx(Ce,{}),e.jsx("span",{className:"truncate",children:l.name}),l.current&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},l.slug))]}),(f||t.signupOpen)&&e.jsx(V,{}),f&&e.jsxs(I,{onClick:()=>void s({to:"/studio"}),children:[e.jsx(Ze,{}),"Studio settings"]}),t.signupOpen&&e.jsxs(I,{onClick:()=>r(!0),children:[e.jsx(We,{}),"New studio…"]})]})]}),e.jsx(Ue,{open:a,onOpenChange:l=>!c&&r(l),children:e.jsx(qe,{className:"sm:max-w-[420px]",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:l=>{l.preventDefault(),j(()=>ee.createOrg(u.trim()||"My studio"))},children:[e.jsxs(ds,{children:[e.jsx(Ge,{children:"New studio"}),e.jsx(cs,{children:"Its own sites, members and settings. You are its owner, and you move to it now — this one stays in the menu."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(ms,{htmlFor:"new-studio-name",children:"Studio name"}),e.jsx(bs,{id:"new-studio-name",value:u,onChange:l=>d(l.target.value),placeholder:"My studio",autoFocus:!0})]}),i&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:i}),e.jsxs(us,{children:[e.jsx(Z,{type:"button",variant:"outline",onClick:()=>r(!1),disabled:c,children:"Cancel"}),e.jsx(Z,{type:"submit",loading:c,children:c?"Creating…":"Create studio"})]})]})})})]})}function la({me:t,site:s}){const n=ae();return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"mb-1 flex h-[34px] w-full items-center justify-between rounded-md border border-border bg-card px-2.5 text-[13px] font-semibold text-foreground","aria-label":"Switch site"}),children:[e.jsx("span",{className:"truncate",children:s?.name??"No sites yet"}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Sites"}),t.projects.filter(a=>!a.archived||a.uid===s?.uid).map(a=>e.jsxs(I,{onClick:()=>void n({to:"/s/$site/comments",params:{site:a.uid}}),children:[e.jsx(se,{}),e.jsx("span",{className:"truncate",children:a.name}),a.uid===s?.uid&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},a.uid))]}),e.jsx(V,{}),K(t.user.role,"settings")&&e.jsxs(I,{onClick:()=>void n({to:"/sites",search:{add:!0}}),children:[e.jsx(We,{}),"Add a site"]}),e.jsxs(I,{onClick:()=>void n({to:"/sites"}),children:[e.jsx(se,{}),"All sites"]})]})]})}function da(){const t=$e(le()),s=we(Be.meta()),n=s.data?.version??"",[a,r]=o.useState({state:"idle"}),u=async()=>{r({state:"checking"});try{r({state:"done",result:await As(n)})}catch{r({state:"failed"})}};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{}),children:[e.jsx(Vs,{}),e.jsx("span",{children:"Help"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[240px]",children:[e.jsxs(I,{render:e.jsx("a",{href:it,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Je,{}),"Docs",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsxs(I,{render:e.jsx("a",{href:ta,target:"_blank",rel:"noreferrer"}),children:["Changelog",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),s.data?.sourceUrl&&e.jsxs(I,{render:e.jsx("a",{href:s.data.sourceUrl,target:"_blank",rel:"noreferrer"}),children:["Source · AGPL",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsx(V,{}),e.jsxs("div",{className:"px-2 py-1.5 text-[12px] text-muted-foreground",children:["Snagset ",n||"—",t&&a.state==="idle"&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>void u(),children:"Check for updates"})]}),a.state==="checking"&&" · checking…",a.state==="failed"&&" · could not reach npm",a.state==="done"&&a.result&&e.jsxs(e.Fragment,{children:[" · ",a.result.newer?e.jsxs("a",{href:sa,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:[a.result.latest," is out — how to upgrade"]}):"up to date"]})]})]})]})}function ca({me:t}){const s=ae(),n=je(),[a,r]=o.useState(kt),u=t.user.name||t.user.email,d=t.user.name?t.user.email:t.user.role,i=async()=>{await ee.logout().catch(()=>{}),Pt("out"),n.clear(),s({to:"/sign-in",replace:!0})};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{size:"lg"}),children:[e.jsx(Rs,{className:"size-8 rounded-full",children:e.jsx(Ms,{className:"bg-primary text-[12px] font-semibold text-primary-foreground",children:Is(t.user.name,t.user.email)})}),e.jsxs("div",{className:"min-w-0 flex-1 text-left leading-tight",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold",children:u}),e.jsx("div",{className:"truncate text-[11.5px] text-muted-foreground",children:d})]}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[250px]",children:[e.jsx(Ne,{children:e.jsxs(te,{className:"flex flex-col",children:[e.jsx("span",{className:"text-[13px] font-semibold",children:u}),e.jsx("span",{className:"text-[11.5px] font-normal text-muted-foreground",children:t.user.name?`${t.user.email} · ${t.user.role}`:t.user.role})]})}),e.jsx(V,{}),e.jsxs(Cs,{value:a,onValueChange:x=>{const c=x;Tt(c),r(c)},children:[e.jsx(te,{children:"Theme"}),e.jsxs(pe,{value:"system",children:[e.jsx(_s,{}),"System"]}),e.jsxs(pe,{value:"light",children:[e.jsx(zs,{}),"Light"]}),e.jsxs(pe,{value:"dark",children:[e.jsx(Hs,{}),"Dark"]})]}),e.jsx(V,{}),e.jsxs(I,{onClick:()=>void s({to:"/you"}),children:[e.jsx(et,{}),"You"]}),e.jsxs(I,{onClick:()=>void i(),children:[e.jsx(Xs,{}),"Sign out"]})]})]})}function ua({onSearch:t}){const n=Nt().map(a=>a.loaderData?.crumb).filter(a=>typeof a=="string"&&a.length>0);return e.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx(Gn,{className:"-ml-1"}),e.jsx("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-2 text-[13.5px] font-medium text-muted-foreground",children:n.map((a,r)=>e.jsxs("span",{className:"flex items-center gap-2",children:[r>0&&e.jsx("span",{className:"text-line-strong",children:"/"}),e.jsx("span",{className:r===n.length-1?"text-foreground":void 0,children:a})]},r))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",onClick:t,"aria-label":"Search and go",className:"flex h-7 items-center gap-2 rounded-md border border-border bg-card px-2 text-[12.5px] text-muted-foreground",children:[e.jsx(Ke,{className:"size-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"}),e.jsx("kbd",{className:"hidden rounded border border-border px-1 font-mono text-[11px] sm:inline",children:"⌘K"})]})]})}const _a=()=>e.jsx(na,{children:e.jsx(Rt,{})});export{_a as component};
61
+ */const tn=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],et=O("user",tn),sn=[["mcp-tokens"],["instance"],["integrations"],["invites"],["members"]];function nn(){const t=le().user.role,s=je(),n=o.useRef(t);o.useEffect(()=>{if(n.current!==t){n.current=t;for(const a of sn)s.resetQueries({queryKey:a})}},[t,s])}const ge=768;function an(){const[t,s]=o.useState(void 0);return o.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ge-1}px)`),a=()=>{s(window.innerWidth<ge)};return n.addEventListener("change",a),s(window.innerWidth<ge),()=>n.removeEventListener("change",a)},[]),!!t}const rn=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new qt,currentIdRef:{current:null},currentContextRef:{current:null}});function on(t,s){t.current=s.current}function ln(t,s={open:!1}){const{open:n}=s,a="rootStore"in t?t.rootStore:t,r=a.useState("floatingId"),u=o.useContext(rn),{currentIdRef:d,delayRef:i,timeoutMs:x,initialDelayRef:c,currentContextRef:g,hasProvider:b,timeout:h}=u,[j,l]=o.useState(!1),S=o.useRef(n);return L(()=>{S.current=n},[n]),L(()=>{function f(){g.current?.setIsInstantPhase(!1),d.current=null,g.current=null,i.current=c.current,h.clear()}if(d.current&&!n&&d.current===r){if(l(!1),x){const m=r;return h.start(x,()=>{a.select("open")||d.current&&d.current!==m||f()}),()=>{(S.current||d.current!==m)&&h.clear()}}f()}},[n,r,d,i,x,c,g,h,a]),L(()=>{if(!n)return;const f=g.current,m=d.current;h.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:l},d.current=r,i.current={open:0,close:me(c.current,"close")},m!==null&&m!==r?(l(!0),f?.setIsInstantPhase(!0),f?.onOpenChange(!1,B(Ge))):(l(!1),f?.setIsInstantPhase(!1))},[n,r,a,d,i,c,g,h]),L(()=>()=>{if(d.current===r){if(g.current=null,!S.current)return;d.current=null,on(i,c),h.clear()}},[g,d,i,r,c,h]),o.useMemo(()=>({hasProvider:b,delayRef:i,isInstantPhase:j}),[b,i,j])}function dn(t,s){let n=null,a=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const u=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=s.axis==="x"||s.axis==="both",i=s.axis==="y"||s.axis==="both",x=["mouseenter","mousemove"].includes(s.dataRef.current.openEvent?.type||"")&&s.pointerType!=="touch";let c=u.width,g=u.height,b=u.x,h=u.y;return n==null&&s.x&&d&&(n=u.x-s.x),a==null&&s.y&&i&&(a=u.y-s.y),b-=n||0,h-=a||0,c=0,g=0,!r||x?(c=s.axis==="y"?u.width:0,g=s.axis==="x"?u.height:0,b=d&&s.x!=null?s.x:b,h=i&&s.y!=null?s.y:h):r&&!x&&(g=s.axis==="x"?u.height:g,c=s.axis==="y"?u.width:c),r=!0,{width:c,height:g,x:b,y:h,top:h,right:b+c,bottom:h+g,left:b}}}}function Ae(t){return t!=null&&t.clientX!=null}function cn(t,s={}){const{enabled:n=!0,axis:a="both"}=s,r="rootStore"in t?t.rootStore:t,u=r.useState("open"),d=r.useState("floatingElement"),i=r.useState("domReferenceElement"),x=r.context.dataRef,c=o.useRef(!1),g=o.useRef(null),[b,h]=o.useState(),[j,l]=o.useState([]),S=ce(v=>{r.set("positionReference",v)}),f=ce((v,y,R)=>{c.current||x.current.openEvent&&!Ae(x.current.openEvent)||r.set("positionReference",dn(R??i,{x:v,y,axis:a,dataRef:x,pointerType:b}))}),m=ce(v=>{u?g.current||(f(v.clientX,v.clientY,v.currentTarget),l([])):f(v.clientX,v.clientY,v.currentTarget)}),C=Ve(b)?d:u;o.useEffect(()=>{if(!n){S(i);return}if(!C)return;function v(){g.current?.(),g.current=null}const y=bt(d);function R(P){const p=hs(P);xe(d,p)?v():f(P.clientX,P.clientY)}return!x.current.openEvent||Ae(x.current.openEvent)?g.current=Vt(y,"mousemove",R):S(i),v},[C,n,d,x,i,r,f,S,j]),o.useEffect(()=>()=>{r.set("positionReference",null)},[r]),o.useEffect(()=>{n&&!d&&(c.current=!1)},[n,d]),o.useEffect(()=>{!n&&u&&(c.current=!0)},[n,u]);const N=o.useMemo(()=>{function v(y){h(y.pointerType)}return{onPointerDown:v,onPointerEnter:v,onMouseMove:m,onMouseEnter:m}},[m]);return o.useMemo(()=>n?{reference:N,trigger:N}:{},[n,N])}function un({...t}){return e.jsx(Mt,{"data-slot":"sheet",...t})}function pn({...t}){return e.jsx(_t,{"data-slot":"sheet-portal",...t})}function gn({className:t,...s}){return e.jsx(zt,{"data-slot":"sheet-overlay",className:w("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",t),...s})}function fn({className:t,children:s,side:n="right",showCloseButton:a=!0,...r}){return e.jsxs(pn,{children:[e.jsx(gn,{}),e.jsxs(Et,{"data-slot":"sheet-content","data-side":n,className:w("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...r,children:[s,a&&e.jsxs(Ot,{"data-slot":"sheet-close",render:e.jsx(Z,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[e.jsx(Dt,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function hn({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:w("flex flex-col gap-0.5 p-4",t),...s})}function xn({className:t,...s}){return e.jsx(It,{"data-slot":"sheet-title",className:w("font-heading text-base font-medium text-foreground",t),...s})}function mn({className:t,...s}){return e.jsx(At,{"data-slot":"sheet-description",className:w("text-sm text-muted-foreground",t),...s})}const tt=o.createContext(void 0);function Y(t){const s=o.useContext(tt);if(s===void 0&&!t)throw new Error(ne(72));return s}const bn={...Ht,disabled:t=>t.disabled,instantType:t=>t.instantType,isInstantPhase:t=>t.isInstantPhase,trackCursorAxis:t=>t.trackCursorAxis,disableHoverablePopup:t=>t.disableHoverablePopup,lastOpenChangeReason:t=>t.openChangeReason,closeOnClick:t=>t.closeOnClick,closeDelay:t=>t.closeDelay,adaptiveOrigin:t=>t.adaptiveOrigin};class vn extends Gt{constructor(s,n,a){const r=new Yt;super(jn(s,r,n,a),yn(r),bn)}setOpen=(s,n)=>{Kt(this,s,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(s){this.state.floatingRootContext.dispatchOpenChange(!1,B(xs,s))}}function jn(t,s,n,a=!1){const r={...Lt(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...t};return r.floatingRootContext=$t(s,n,a),r}function yn(t){return{popupRef:o.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:t}}const Sn=Wt(function(s){const{disabled:n=!1,defaultOpen:a=!1,open:r,disableHoverablePopup:u=!1,trackCursorAxis:d="none",actionsRef:i,onOpenChange:x,onOpenChangeComplete:c,handle:g,triggerId:b,defaultTriggerId:h=null,children:j}=s,l=Xt(($,F)=>new vn({open:a,openProp:r,activeTriggerId:h,triggerIdProp:b},$,F));l.useControlledProp("openProp",r),l.useControlledProp("triggerIdProp",b),l.useContextCallback("onOpenChange",x),l.useContextCallback("onOpenChangeComplete",c);const S=l.useState("open"),f=!n&&S,m=l.useState("activeTriggerId"),C=l.useState("mounted"),N=l.useState("payload");l.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:u,disabled:n}),Qt(l,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:v,transitionStatus:y}=Jt(f,l),R=l.useState("isInstantPhase"),P=l.useState("instantType"),p=l.useState("lastOpenChangeReason"),k=o.useRef(null);L(()=>{S&&n&&l.setOpen(!1,B(ms))},[S,n,l]),L(()=>{y==="ending"&&p===Ge||y!=="ending"&&R?(P!=="delay"&&(k.current=P),l.set("instantType","delay")):k.current!==null&&(l.set("instantType",k.current),k.current=null)},[y,R,p,P,l]),L(()=>{f&&m==null&&l.set("payload",void 0)},[l,m,f]),o.useImperativeHandle(i,()=>({unmount:v,close:()=>l.setOpen(!1,B(bs))}),[v,l]);const A=f||C||!n&&d!=="none";return e.jsxs(tt.Provider,{value:l,children:[g&&e.jsx(Zt,{handle:g,store:l}),A&&e.jsx(wn,{store:l,disabled:n,trackCursorAxis:d}),typeof j=="function"?j({payload:N}):j]})});function wn({store:t,disabled:s,trackCursorAxis:n}){const a=t.useState("floatingRootContext"),r=es(a,{enabled:!s,referencePress:()=>t.select("closeOnClick")}),u=cn(a,{enabled:!s&&n!=="none",axis:n==="none"?void 0:n}),d=o.useMemo(()=>ye(u.reference,r.reference),[u.reference,r.reference]);return ts(t,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:r.floating??vt}),null}const Nn=o.createContext(void 0);function Cn(){return o.useContext(Nn)}const _e=600,st="data-base-ui-tooltip-trigger";function ze(t){if("composedPath"in t){const n=t.composedPath();for(let a=0;a<n.length;a+=1){const r=n[a];if(he(r))return r}}const s=t.target;return he(s)?s:null}function kn(t){let s=t;for(;s;){const n=s.closest(`[${st}]`);if(n)return n;const a=s.getRootNode();s="host"in a&&he(a.host)?a.host:null}return null}const Tn=ss(function(s,n){const{render:a,className:r,style:u,handle:d,payload:i,disabled:x,delay:c,closeOnClick:g=!0,closeDelay:b,id:h,...j}=s,l=Y(!0),f=js(d)??l;if(!f)throw new Error(ne(82));const m=vs(h),C=f.useState("isTriggerActive",m),N=f.useState("isOpenedByTrigger",m),v=f.useState("floatingRootContext"),y=o.useRef(null),R=c??_e,P=b??0,{registerTrigger:p,isMountedByThisTrigger:k}=ns(m,y,f,{payload:i,closeOnClick:g,closeDelay:P}),A=Cn(),{delayRef:$,isInstantPhase:F,hasProvider:D}=ln(v,{open:N}),U=ys(v);f.useSyncedValue("isInstantPhase",F);const de=f.useState("disabled"),q=x??de,Pe=as(q),Re=f.useState("trackCursorAxis"),lt=f.useState("disableHoverablePopup"),V=o.useRef(!1),W=rs(),X=o.useRef(void 0);function Me(){return D?me($.current,"open")===0?0:c??A??_e:R}function Ee(T){const z=y.current;if(!z||!T)return!1;const H=kn(T);return H!==null&&H!==z&&xe(z,H)}function dt(T){const z=Ee(T);return V.current=z,z&&(U.openChangeTimeout.clear(),U.restTimeout.clear(),U.restTimeoutPending=!1,W.clear()),z}const ct=Ss(v,{enabled:!q,mouseOnly:!0,move:!1,handleClose:!lt&&Re!=="both"?ws():null,restMs:Me,delay(){return b==null&&D?{close:me($.current,"close")}:{close:P}},triggerElementRef:y,isActiveTrigger:C,isClosing:()=>f.select("transitionStatus")==="ending",shouldOpen(){return!V.current}}),ut=Ns(v,{enabled:!q}).reference,pt=T=>{const z=V.current,H=ze(T),Oe=dt(H),Q=y.current,ft=Q&&H&&xe(Q,H);if(Oe&&f.select("open")&&f.select("lastOpenChangeReason")===ue){f.setOpen(!1,B(ue,T));return}if(z&&!Oe&&ft&&!Pe.current&&!f.select("open")&&Q&&Ve(X.current)){const De=()=>{!V.current&&!Pe.current&&!f.select("open")&&f.setOpen(!0,B(ue,T,Q))},Ie=Me();Ie===0?(W.clear(),De()):W.start(Ie,De)}},gt=f.useState("triggerProps",k);return Se("button",s,{state:{open:N},ref:[n,p,y],props:[ct,ut,k||Re!=="none"?gt:void 0,{onMouseOver(T){pt(T.nativeEvent)},onFocus(T){Ee(ze(T.nativeEvent))&&T.preventBaseUIHandler()},onMouseLeave(){V.current=!1,W.clear(),X.current=void 0},onPointerEnter(T){X.current=T.pointerType},onPointerDown(T){X.current=T.pointerType,f.set("closeOnClick",g),g&&!f.select("open")&&f.cancelPendingOpen(T.nativeEvent)},onClick(T){g&&!f.select("open")&&f.cancelPendingOpen(T.nativeEvent)},id:m,"data-trigger-disabled":q?"":void 0,[st]:q?void 0:""},j],stateAttributesMapping:os})}),nt=o.createContext(void 0);function Pn(){const t=o.useContext(nt);if(t===void 0)throw new Error(ne(70));return t}const Rn=o.forwardRef(function(s,n){const{children:a,container:r,className:u,render:d,style:i,...x}=s,{node:c,subtree:g}=is({container:r,ref:n,componentProps:s,elementProps:x});return!g&&!c?null:e.jsxs(o.Fragment,{children:[g,c&&jt.createPortal(a,c)]})}),Mn=o.forwardRef(function(s,n){const{keepMounted:a=!1,...r}=s;return Y().useState("mounted")||a?e.jsx(nt.Provider,{value:a,children:e.jsx(Rn,{ref:n,...r})}):null}),at=o.createContext(void 0);function rt(){const t=o.useContext(at);if(t===void 0)throw new Error(ne(71));return t}const En=o.forwardRef(function(s,n){const{render:a,className:r,anchor:u,positionMethod:d="absolute",side:i="top",align:x="center",sideOffset:c=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:h=5,arrowPadding:j=5,sticky:l=!1,disableAnchorTracking:S=!1,collisionAvoidance:f=ls,style:m,...C}=s,N=Y(),v=Pn(),y=N.useState("open"),R=N.useState("mounted"),P=N.useState("trackCursorAxis"),p=N.useState("disableHoverablePopup"),k=N.useState("floatingRootContext"),A=N.useState("instantType"),$=N.useState("transitionStatus"),F=N.useState("adaptiveOrigin"),D=Ts({anchor:u,positionMethod:d,floatingRootContext:k,mounted:R,side:i,sideOffset:c,align:x,alignOffset:g,collisionBoundary:b,collisionPadding:h,sticky:l,arrowPadding:j,disableAnchorTracking:S,keepMounted:v,collisionAvoidance:f,adaptiveOrigin:F}),U=o.useMemo(()=>({open:y,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P!=="none"?"tracking-cursor":A}),[y,D.side,D.align,D.anchorHidden,P,A]),de=Ps(s,U,{styles:D.positionerStyles,transitionStatus:$,props:C,refs:[n,N.useStateSetter("positionerElement")],hidden:!R,inert:!y||P==="both"||p});return e.jsx(at.Provider,{value:D,children:de})}),On=o.forwardRef(function(s,n){const{render:a,className:r,style:u,...d}=s,i=Y(),{side:x,align:c}=rt(),g=i.useState("open"),b=i.useState("instantType"),h=i.useState("transitionStatus"),j=i.useState("popupProps"),l=i.useState("floatingRootContext"),S=i.useState("disabled"),f=i.useState("closeDelay");Ms({open:g,ref:i.context.popupRef,onComplete(){g&&i.context.onOpenChangeComplete?.(!0)}}),Cs(l,{enabled:!S,closeDelay:f});const m=i.useStateSetter("popupElement");return Se("div",s,{state:{open:g,side:x,align:c,instant:b,transitionStatus:h},ref:[n,i.context.popupRef,m],props:[ds,j,Rs(h),d],stateAttributesMapping:cs})}),Dn=o.forwardRef(function(s,n){const{render:a,className:r,style:u,...d}=s,i=Y(),{arrowRef:x,side:c,align:g,arrowUncentered:b,arrowStyles:h}=rt(),j=i.useState("open"),l=i.useState("instantType");return Se("div",s,{state:{open:j,side:c,align:g,uncentered:b,instant:l},ref:[n,x],props:[{style:h,"aria-hidden":!0},d],stateAttributesMapping:us})});function In({...t}){return e.jsx(Sn,{"data-slot":"tooltip",...t})}function An({...t}){return e.jsx(Tn,{"data-slot":"tooltip-trigger",...t})}function _n({className:t,side:s="top",sideOffset:n=4,align:a="center",alignOffset:r=0,children:u,...d}){return e.jsx(Mn,{children:e.jsx(En,{align:a,alignOffset:r,side:s,sideOffset:n,className:"isolate z-50",children:e.jsxs(On,{"data-slot":"tooltip-content",className:w("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...d,children:[u,e.jsx(Dn,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const zn="sidebar_state",Hn=3600*24*7,Ln="16rem",$n="18rem",Bn="3rem",Fn="b",ot=o.createContext(null);function Te(){const t=o.useContext(ot);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Un({defaultOpen:t=!0,open:s,onOpenChange:n,className:a,style:r,children:u,...d}){const i=an(),[x,c]=o.useState(!1),[g,b]=o.useState(t),h=s??g,j=o.useCallback(m=>{const C=typeof m=="function"?m(h):m;n?n(C):b(C),document.cookie=`${zn}=${C}; path=/; max-age=${Hn}`},[n,h]),l=o.useCallback(()=>i?c(m=>!m):j(m=>!m),[i,j,c]);o.useEffect(()=>{const m=C=>{C.key===Fn&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),l())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l]);const S=h?"expanded":"collapsed",f=o.useMemo(()=>({state:S,open:h,setOpen:j,isMobile:i,openMobile:x,setOpenMobile:c,toggleSidebar:l}),[S,h,j,i,x,c,l]);return e.jsx(ot.Provider,{value:f,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Ln,"--sidebar-width-icon":Bn,...r},className:w("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...d,children:u})})}function qn({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",className:a,children:r,dir:u,...d}){const{isMobile:i,state:x,openMobile:c,setOpenMobile:g}=Te();return n==="none"?e.jsx("div",{"data-slot":"sidebar",className:w("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...d,children:r}):i?e.jsx(un,{open:c,onOpenChange:g,...d,children:e.jsxs(fn,{dir:u,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":$n},side:t,children:[e.jsxs(hn,{className:"sr-only",children:[e.jsx(xn,{children:"Sidebar"}),e.jsx(mn,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:r})]})}):e.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":x,"data-collapsible":x==="collapsed"?n:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:w("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:w("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...d,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:r})})]})}function Vn({className:t,onClick:s,...n}){const{toggleSidebar:a}=Te();return e.jsxs(Z,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:w(t),onClick:r=>{s?.(r),a()},...n,children:[e.jsx(Zs,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Gn({className:t,...s}){return e.jsx("main",{"data-slot":"sidebar-inset",className:w("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...s})}function Kn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:w("flex flex-col gap-2 p-2",t),...s})}function Yn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:w("flex flex-col gap-2 p-2",t),...s})}function Wn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:w("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s})}function He({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:w("relative flex w-full min-w-0 flex-col p-2",t),...s})}function Xn({className:t,render:s,...n}){return Ye({defaultTagName:"div",props:ye({className:w("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",t)},n),render:s,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function Le({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:w("w-full text-sm",t),...s})}function fe({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:w("flex w-full min-w-0 flex-col gap-0",t),...s})}function M({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:w("group/menu-item relative",t),...s})}const Qn=yt("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function E({render:t,isActive:s=!1,variant:n="default",size:a="default",tooltip:r,className:u,...d}){const{isMobile:i,state:x}=Te(),c=Ye({defaultTagName:"button",props:ye({className:w(Qn({variant:n,size:a}),u)},d),render:r?e.jsx(An,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:s}});return r?(typeof r=="string"&&(r={children:r}),e.jsxs(In,{children:[c,e.jsx(_n,{side:"right",align:"center",hidden:x!=="collapsed"||i,...r})]})):c}function Jn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:w("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",t),...s})}function Zn({open:t,onOpenChange:s}){const n=le(),a=ae(),[r,u]=o.useState(""),[d,i]=o.useState(0),x=o.useRef(null),c=r.trim(),[g,b]=o.useState("");o.useEffect(()=>{const p=setTimeout(()=>b(c),180);return()=>clearTimeout(p)},[c]);const h=we({queryKey:["activity","search",g],queryFn:()=>ee.activity({q:g,status:"all",limit:8}),enabled:t&&g.length>=2,staleTime:3e4});o.useEffect(()=>{t||(u(""),i(0))},[t]);const j=K(n.user.role,"settings"),l=o.useMemo(()=>[{id:"s:sites",label:"Sites",icon:e.jsx(se,{className:"size-4"}),go:()=>void a({to:"/sites"})},{id:"s:activity",label:"Activity",hint:"every site, newest first",icon:e.jsx(Xe,{className:"size-4"}),go:()=>void a({to:"/activity"})},...j?[{id:"s:members",label:"Members",icon:e.jsx(be,{className:"size-4"}),go:()=>void a({to:"/studio/members"})},{id:"s:integrations",label:"Integrations",icon:e.jsx(Qe,{className:"size-4"}),go:()=>void a({to:"/studio/integrations"})},{id:"s:studio",label:"Studio settings",icon:e.jsx(Ce,{className:"size-4"}),go:()=>void a({to:"/studio"})}]:[],{id:"s:you",label:"You",icon:e.jsx(et,{className:"size-4"}),go:()=>void a({to:"/you"})}],[a,j]),S=o.useMemo(()=>n.projects.map(p=>({id:`p:${p.uid}`,label:p.name,hint:p.unresolved>0?`${p.unresolved} open`:"nothing open",icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:p.uid}})})),[n.projects,a]),f=p=>!c||p.toLowerCase().includes(c.toLowerCase()),m=[],C=S.filter(p=>f(p.label)),N=l.filter(p=>f(p.label));C.length&&m.push({title:"Sites",items:C}),N.length&&m.push({title:"Go to",items:N});const v=(h.data?.data??[]).map(p=>({id:`t:${p.id}`,label:p.latest?.body?.trim()||p.route,hint:`${p.site.name} · ${gs(p.status)?ps[p.status]:p.status} · ${p.key}`,icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:p.site.uid},search:{thread:p.key}})}));v.length&&m.push({title:"Comments",items:v});const y=m.flatMap(p=>p.items),R=Math.min(d,Math.max(0,y.length-1)),P=p=>{p&&(s(!1),p.go())};return o.useEffect(()=>{x.current?.querySelector(`[data-at="${R}"]`)?.scrollIntoView({block:"nearest"})},[R]),e.jsx(Fe,{open:t,onOpenChange:s,children:e.jsxs(Ue,{showCloseButton:!1,className:"top-[15%] max-h-[70dvh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg",children:[e.jsx(qe,{className:"sr-only",children:"Search and go"}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[e.jsx(Ke,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:r,onChange:p=>{u(p.target.value),i(0)},onKeyDown:p=>{p.key==="ArrowDown"?(p.preventDefault(),i(k=>Math.min(k+1,y.length-1))):p.key==="ArrowUp"?(p.preventDefault(),i(k=>Math.max(k-1,0))):p.key==="Enter"&&(p.preventDefault(),P(y[R]))},placeholder:"Go to a site or a screen, or search every comment…","aria-label":"Search and go",className:"h-11 w-full bg-transparent text-[14px] outline-none placeholder:text-muted-foreground"})]}),e.jsxs("div",{ref:x,className:"min-h-0 flex-1 overflow-auto py-1.5",children:[y.length===0&&e.jsx("p",{className:"m-0 px-3 py-6 text-center text-[13px] text-muted-foreground",children:h.isFetching?"Looking…":c?`Nothing matches “${c}”.`:"Nothing here."}),m.map(p=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:p.title}),p.items.map(k=>{const A=y.indexOf(k);return e.jsxs("button",{type:"button","data-at":A,onMouseMove:()=>i(A),onClick:()=>P(k),className:w("flex w-full items-center gap-2.5 border-0 bg-transparent px-3 py-2 text-left text-[13px] text-foreground",A===R&&"bg-muted"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:k.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.label}),k.hint&&e.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:k.hint})]},k.id)})]},p.title)),h.isFetching&&y.length>0&&e.jsxs("p",{className:"m-0 flex items-center gap-1.5 px-3 py-1.5 text-[12px] text-muted-foreground",children:[e.jsx(St,{className:"size-3"}),"Searching every site…"]})]})]})})}function ea(){const[t,s]=o.useState(!1);return o.useEffect(()=>{const n=a=>{a.key.toLowerCase()!=="k"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),s(r=>!r))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),[t,s]}const it="https://snagset.com/docs/",ta="https://www.npmjs.com/package/@snagset/server?activeTab=versions",sa="https://snagset.com/docs/self-hosting/#upgrade";function na({children:t}){const s=le(),n=$e(s),a=wt(s),[r,u]=ea();return nn(),e.jsxs(Un,{children:[e.jsx(oa,{me:s,site:a}),e.jsxs(Gn,{className:"min-w-0",children:[e.jsx(ua,{onSearch:()=>u(!0)}),n&&e.jsx(aa,{names:s.pendingMigrations??[],owner:s.user.role==="owner"}),n&&s.regionMismatch&&K(s.user.role,"settings")&&e.jsx(ra,{...s.regionMismatch}),e.jsx("div",{className:"min-h-0 flex-1",children:t})]}),e.jsx(Zn,{open:r,onOpenChange:u})]})}function aa({names:t,owner:s}){return t.length?e.jsxs("div",{role:"alert",className:"mx-7 mt-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:[e.jsxs("p",{className:"m-0 font-medium",children:["The database needs an update for this version (",t.length," ",t.length===1?"migration":"migrations",")."]}),e.jsx("p",{className:"m-0 mt-0.5",children:s?e.jsxs(e.Fragment,{children:["Run ",e.jsx("code",{className:"font-mono",children:"snagset migrate"})," with this instance's ",e.jsx("code",{className:"font-mono",children:"DATABASE_URL"})," — from the project, ",e.jsx("code",{className:"font-mono",children:"pnpm migrate"}),". Until then, parts of this version may fail."]}):"Ask the studio's owner to run snagset migrate. Until then, parts of this version may fail."})]}):null}function ra({functions:t,database:s,suggest:n}){return e.jsxs("div",{role:"status",className:"mx-7 mt-4 rounded-md border border-border bg-warn-soft px-3 py-2 text-[13px]",children:[e.jsxs("p",{className:"m-0 font-medium",children:["This server runs in ",t,", but its database is in ",s," — every page waits on that distance."]}),e.jsx("p",{className:"m-0 mt-0.5 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Add ",e.jsxs("code",{className:"font-mono",children:['"regions": ["',n,'"]']})," to ",e.jsx("code",{className:"font-mono",children:"vercel.json"})," and redeploy."]}):"Run the server in the same region as the database."})]})}function oa({me:t,site:s}){const n=Ls({select:i=>i.location.pathname}),a=i=>n===i||n.startsWith(i+"/"),r=K(t.user.role,"settings"),u=we(Be.setupState()),d=t.user.role==="owner"?u.data?.billingUrl:null;return e.jsxs(qn,{children:[e.jsx(Kn,{className:"px-3 pb-1 pt-3",children:e.jsx(ia,{me:t})}),e.jsxs(Wn,{children:[e.jsxs(He,{children:[e.jsx(la,{me:t,site:s}),s&&e.jsx(Le,{children:e.jsxs(fe,{children:[e.jsxs(M,{children:[e.jsxs(E,{isActive:a(`/s/${s.uid}/comments`),render:e.jsx(_,{to:"/s/$site/comments",params:{site:s.uid}}),children:[e.jsx(ve,{}),e.jsx("span",{children:"Comments"})]}),s.unresolved>0&&e.jsx(Jn,{children:s.unresolved})]}),e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/reviewers`),render:e.jsx(_,{to:"/s/$site/reviewers",params:{site:s.uid}}),children:[e.jsx(be,{}),e.jsx("span",{children:"Reviewers"})]})}),r&&e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/settings`),render:e.jsx(_,{to:"/s/$site/settings",params:{site:s.uid}}),children:[e.jsx(Ze,{}),e.jsx("span",{children:"Site settings"})]})})]})})]}),e.jsxs(He,{children:[e.jsx(Xn,{children:"Studio"}),e.jsx(Le,{children:e.jsxs(fe,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/sites"),render:e.jsx(_,{to:"/sites"}),children:[e.jsx(se,{}),e.jsx("span",{children:"Sites"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/activity"),render:e.jsx(_,{to:"/activity"}),children:[e.jsx(Xe,{}),e.jsx("span",{children:"Activity"})]})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/members"),render:e.jsx(_,{to:"/studio/members"}),children:[e.jsx(be,{}),e.jsx("span",{children:"Members"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/integrations"),render:e.jsx(_,{to:"/studio/integrations"}),children:[e.jsx(Qe,{}),e.jsx("span",{children:"Integrations"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:n==="/studio",render:e.jsx(_,{to:"/studio"}),children:[e.jsx(Ce,{}),e.jsx("span",{children:"Studio settings"})]})})]})]})})]})]}),e.jsx(Yn,{children:e.jsxs(fe,{children:[d&&e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/plan"),render:e.jsx(_,{to:"/studio/plan"}),children:[e.jsx(Ys,{}),e.jsx("span",{children:"Plan & billing"})]})}),e.jsx(M,{children:e.jsxs(E,{render:e.jsx("a",{href:it,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Je,{}),e.jsx("span",{children:"Docs"}),e.jsx(J,{className:"ml-auto size-3.5 text-muted-foreground"})]})}),e.jsx(M,{children:e.jsx(da,{})}),e.jsx(M,{children:e.jsx(ca,{me:t})})]})})]})}function ia({me:t}){const s=ae(),n=je(),[a,r]=o.useState(!1),[u,d]=o.useState(""),[i,x]=o.useState(""),[c,g]=o.useState(!1),b=e.jsxs(e.Fragment,{children:[e.jsx(Ct,{size:20}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"block truncate text-[14px] font-semibold leading-tight tracking-tight",children:t.org.name}),e.jsx("span",{className:"block truncate text-[11.5px] text-muted-foreground",children:location.host})]})]}),h=K(t.user.role,"settings");if(t.orgs.length<=1&&!t.signupOpen)return h?e.jsx(_,{to:"/studio",className:"flex items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":`${t.org.name} — studio settings`,children:b}):e.jsx("div",{className:"flex items-center gap-2.5 px-1 py-0.5 text-foreground",children:b});const j=async l=>{g(!0),x("");try{await l(),n.clear(),r(!1),d(""),s({to:"/sites",replace:!0})}catch(S){x(S instanceof Error?S.message:"Something went wrong. Try again.")}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":"Switch studio"}),children:[b,e.jsx(ke,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Studios"}),t.orgs.map(l=>e.jsxs(I,{disabled:l.current,onClick:()=>void j(()=>ee.switchOrg(l.slug)),children:[e.jsx(Ce,{}),e.jsx("span",{className:"truncate",children:l.name}),l.current&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},l.slug))]}),(h||t.signupOpen)&&e.jsx(G,{}),h&&e.jsxs(I,{onClick:()=>void s({to:"/studio"}),children:[e.jsx(Ze,{}),"Studio settings"]}),t.signupOpen&&e.jsxs(I,{onClick:()=>r(!0),children:[e.jsx(We,{}),"New studio…"]})]})]}),e.jsx(Fe,{open:a,onOpenChange:l=>!c&&r(l),children:e.jsx(Ue,{className:"sm:max-w-[420px]",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:l=>{l.preventDefault(),j(()=>ee.createOrg(u.trim()||"My studio"))},children:[e.jsxs(Bt,{children:[e.jsx(qe,{children:"New studio"}),e.jsx(Ft,{children:"Its own sites, members and settings. You are its owner, and you move to it now — this one stays in the menu."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ds,{htmlFor:"new-studio-name",children:"Studio name"}),e.jsx(Is,{id:"new-studio-name",value:u,onChange:l=>d(l.target.value),placeholder:"My studio",autoFocus:!0})]}),i&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:i}),e.jsxs(Ut,{children:[e.jsx(Z,{type:"button",variant:"outline",onClick:()=>r(!1),disabled:c,children:"Cancel"}),e.jsx(Z,{type:"submit",loading:c,children:c?"Creating…":"Create studio"})]})]})})})]})}function la({me:t,site:s}){const n=ae();return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"mb-1 flex h-[34px] w-full items-center justify-between rounded-md border border-border bg-card px-2.5 text-[13px] font-semibold text-foreground","aria-label":"Switch site"}),children:[e.jsx("span",{className:"truncate",children:s?.name??"No sites yet"}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Sites"}),t.projects.filter(a=>!a.archived||a.uid===s?.uid).map(a=>e.jsxs(I,{onClick:()=>void n({to:"/s/$site/comments",params:{site:a.uid}}),children:[e.jsx(se,{}),e.jsx("span",{className:"truncate",children:a.name}),a.uid===s?.uid&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},a.uid))]}),e.jsx(G,{}),K(t.user.role,"settings")&&e.jsxs(I,{onClick:()=>void n({to:"/sites",search:{add:!0}}),children:[e.jsx(We,{}),"Add a site"]}),e.jsxs(I,{onClick:()=>void n({to:"/sites"}),children:[e.jsx(se,{}),"All sites"]})]})]})}function da(){const t=$e(le()),s=we(Be.meta()),n=s.data?.version??"",[a,r]=o.useState({state:"idle"}),u=async()=>{r({state:"checking"});try{r({state:"done",result:await As(n)})}catch{r({state:"failed"})}};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{}),children:[e.jsx(Gs,{}),e.jsx("span",{children:"Help"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[240px]",children:[e.jsxs(I,{render:e.jsx("a",{href:it,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Je,{}),"Docs",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsxs(I,{render:e.jsx("a",{href:ta,target:"_blank",rel:"noreferrer"}),children:["Changelog",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),s.data?.sourceUrl&&e.jsxs(I,{render:e.jsx("a",{href:s.data.sourceUrl,target:"_blank",rel:"noreferrer"}),children:["Source · AGPL",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsx(G,{}),e.jsxs("div",{className:"px-2 py-1.5 text-[12px] text-muted-foreground",children:["Snagset ",n||"—",t&&a.state==="idle"&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>void u(),children:"Check for updates"})]}),a.state==="checking"&&" · checking…",a.state==="failed"&&" · could not reach npm",a.state==="done"&&a.result&&e.jsxs(e.Fragment,{children:[" · ",a.result.newer?e.jsxs("a",{href:sa,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:[a.result.latest," is out — how to upgrade"]}):"up to date"]})]})]})]})}function ca({me:t}){const s=ae(),n=je(),[a,r]=o.useState(kt),u=t.user.name||t.user.email,d=t.user.name?t.user.email:t.user.role,i=async()=>{await ee.logout().catch(()=>{}),Pt("out"),n.clear(),s({to:"/sign-in",replace:!0})};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{size:"lg"}),children:[e.jsx(Es,{className:"size-8 rounded-full",children:e.jsx(Os,{className:"bg-primary text-[12px] font-semibold text-primary-foreground",children:fs(t.user.name,t.user.email)})}),e.jsxs("div",{className:"min-w-0 flex-1 text-left leading-tight",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold",children:u}),e.jsx("div",{className:"truncate text-[11.5px] text-muted-foreground",children:d})]}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[250px]",children:[e.jsx(Ne,{children:e.jsxs(te,{className:"flex flex-col",children:[e.jsx("span",{className:"text-[13px] font-semibold",children:u}),e.jsx("span",{className:"text-[11.5px] font-normal text-muted-foreground",children:t.user.name?`${t.user.email} · ${t.user.role}`:t.user.role})]})}),e.jsx(G,{}),e.jsxs(ks,{value:a,onValueChange:x=>{const c=x;Tt(c),r(c)},children:[e.jsx(te,{children:"Theme"}),e.jsxs(pe,{value:"system",children:[e.jsx(_s,{}),"System"]}),e.jsxs(pe,{value:"light",children:[e.jsx(zs,{}),"Light"]}),e.jsxs(pe,{value:"dark",children:[e.jsx(Hs,{}),"Dark"]})]}),e.jsx(G,{}),e.jsxs(I,{onClick:()=>void s({to:"/you"}),children:[e.jsx(et,{}),"You"]}),e.jsxs(I,{onClick:()=>void i(),children:[e.jsx(Xs,{}),"Sign out"]})]})]})}function ua({onSearch:t}){const n=Nt().map(a=>a.loaderData?.crumb).filter(a=>typeof a=="string"&&a.length>0);return e.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx(Vn,{className:"-ml-1"}),e.jsx("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-2 text-[13.5px] font-medium text-muted-foreground",children:n.map((a,r)=>e.jsxs("span",{className:"flex items-center gap-2",children:[r>0&&e.jsx("span",{className:"text-line-strong",children:"/"}),e.jsx("span",{className:r===n.length-1?"text-foreground":void 0,children:a})]},r))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",onClick:t,"aria-label":"Search and go",className:"flex h-7 items-center gap-2 rounded-md border border-border bg-card px-2 text-[12.5px] text-muted-foreground",children:[e.jsx(Ke,{className:"size-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"}),e.jsx("kbd",{className:"hidden rounded border border-border px-1 font-mono text-[11px] sm:inline",children:"⌘K"})]})]})}const Ha=()=>e.jsx(na,{children:e.jsx(Rt,{})});export{Ha as component};
@@ -0,0 +1 @@
1
+ import{Y as p,Z as f,_ as g,p as v,j as e,B as x,$ as N,L as P,a0 as j}from"./index-_7kIe8FW.js";import{P as y}from"./Picker-CtjWzkpT.js";import{Q as b,u as w}from"./useBaseQuery-DVrotnH-.js";import{P as S,S as R}from"./parts-DGVjMHe8.js";import{v as E,w as k,S as F}from"./useScrollLock-DdWilGdG.js";import{u as M}from"./me-BDpKAhA-.js";import"./select-DjpYopV7.js";import"./chevron-down-BFQamcZy.js";import"./check-Dfkv0gma.js";import"./isElementDisabled-CwHw_lZC.js";import"./createBaseUIEventDetails-DviWdj-N.js";import"./inertValue-BSe8K39O.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-Cm4_pRNG.js";import"./getPseudoElementBounds-Bv3Ra6Wj.js";import"./CompositeList-w7YcjHbo.js";import"./card-DwOk-mSd.js";var A=class extends b{constructor(s,r){super(s,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,r){const{state:n}=s,l=super.createResult(s,r),{isFetching:o,isRefetching:i,isError:u,isRefetchError:d}=l,t=n.fetchMeta?.fetchMore?.direction,c=u&&t==="forward",a=o&&t==="forward",m=u&&t==="backward",h=o&&t==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:f(r,n.data),hasPreviousPage:p(r,n.data),isFetchNextPageError:c,isFetchingNextPage:a,isFetchPreviousPageError:m,isFetchingPreviousPage:h,isRefetchError:d&&!c&&!m,isRefetching:i&&!a&&!h}}};function C(s,r){return w(s,A)}const D=[{value:"unresolved",label:"Needs attention"},...k.map(s=>({value:s,label:F[s]})),{value:"all",label:"Everything"}];function L(s,r=new Date){const n=new Date(s),l=i=>new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),o=Math.round((l(r)-l(n))/864e5);return o<=0?"Today":o===1?"Yesterday":o<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function W(){const s=M(),{status:r="unresolved",site:n}=g.useSearch(),l=v({from:"/activity"}),o=t=>void l({search:c=>({...c,...t}),replace:!0}),i=C(j(r,n)),u=i.data?.pages.flatMap(t=>t.data)??[],d=[];for(const t of u){const c=L(t.updatedAt),a=d[d.length-1];a?.day===c?a.rows.push(t):d.push({day:c,rows:[t]})}return e.jsxs("div",{className:"flex flex-col gap-5 p-7",children:[e.jsx(S,{title:"Activity",sub:`Every site, newest first${n?"":" — all of them"}`}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[D.map(t=>e.jsx(x,{size:"sm",variant:r===t.value?"default":"outline",onClick:()=>o({status:t.value}),children:t.label},t.value)),e.jsx("div",{className:"flex-1"}),e.jsxs("label",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:["Site",e.jsx(y,{"aria-label":"Site",size:"sm",className:"w-auto min-w-40 text-foreground",value:n??"",onChange:t=>o({site:t||void 0}),options:[{value:"",label:"All sites"},...s.projects.map(t=>({value:t.uid,label:t.name}))]})]})]}),i.isPending&&e.jsx(N,{rows:4}),i.isError&&e.jsx("p",{className:"m-0 text-[13px] text-destructive",children:"Could not read the feed. Reload to try again."}),i.isSuccess&&u.length===0&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:r==="resolved"?"Nothing has been resolved yet — this is where finished comments go.":r==="unresolved"?"Nothing needs attention. Every comment on every site is resolved.":"No comments yet on any site."}),d.map(({day:t,rows:c})=>e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx("h2",{className:"m-0 text-[12px] font-medium uppercase tracking-wide text-muted-foreground",children:t}),e.jsx("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:c.map(a=>e.jsx("li",{children:e.jsxs(P,{to:"/s/$site/comments",params:{site:a.site.uid},search:{thread:a.key},className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2.5 no-underline transition-colors hover:bg-muted/60",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[13px]",children:[e.jsx(R,{status:a.status}),e.jsx("span",{className:"font-medium text-foreground",children:a.site.name}),e.jsx("code",{className:"font-mono text-[12px] text-muted-foreground",children:a.route}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:E(a.updatedAt)})]}),a.latest?.body&&e.jsxs("span",{className:"line-clamp-2 text-[13px] text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[a.latest.author??a.createdBy.name,": "]}),a.latest.body]}),e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:a.key}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[a.commentCount," ",a.commentCount===1?"comment":"comments"]}),a.assignee&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:a.assignee})]})]})]})},a.id))})]},t)),i.hasNextPage&&e.jsx("div",{children:e.jsx(x,{variant:"outline",size:"sm",disabled:i.isFetchingNextPage,onClick:()=>void i.fetchNextPage(),children:i.isFetchingNextPage?"Reading…":"Show older"})})]})}export{W as component};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-DXj5DU-z.js";/**
1
+ import{c as o}from"./index-_7kIe8FW.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{r as a,i as b,k as f,j as d,h as m}from"./index-_7kIe8FW.js";import{m as A}from"./useScrollLock-DdWilGdG.js";const x=a.createContext(void 0);function k(){const e=a.useContext(x);if(e===void 0)throw new Error(b(13));return e}const g={imageLoadingStatus:()=>null},z=a.forwardRef(function(t,r){const{className:v,render:p,style:s,...c}=t,[n,o]=a.useState("idle"),i={imageLoadingStatus:n},u=a.useMemo(()=>({imageLoadingStatus:n,setImageLoadingStatus:o}),[n,o]),l=f("span",t,{state:i,ref:r,props:c,stateAttributesMapping:g});return d.jsx(x.Provider,{value:u,children:l})}),R=a.forwardRef(function(t,r){const{className:v,render:p,delay:s=0,style:c,...n}=t,{imageLoadingStatus:o}=k(),[i,u]=a.useState(s===0),l=A();return a.useEffect(()=>(s>0?l.start(s,()=>u(!0)):u(!0),l.clear),[l,s]),f("span",t,{state:{imageLoadingStatus:o},ref:r,props:n,stateAttributesMapping:g,enabled:o!=="loaded"&&(s===0||i)})});function h({className:e,size:t="default",...r}){return d.jsx(z,{"data-slot":"avatar","data-size":t,className:m("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),...r})}function M({className:e,...t}){return d.jsx(R,{"data-slot":"avatar-fallback",className:m("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...t})}export{h as A,M as a};
@@ -1 +1 @@
1
- import{m as a,h as n,o}from"./index-DXj5DU-z.js";import{u as d}from"./useRender-0SJIdv0u.js";const s=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function v({className:r,variant:e="default",render:t,...i}){return d({defaultTagName:"span",props:a({className:n(s({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{v as B};
1
+ import{m as a,h as n,o}from"./index-_7kIe8FW.js";import{u as d}from"./useRender-BO4-nlty.js";const s=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function v({className:r,variant:e="default",render:t,...i}){return d({defaultTagName:"span",props:a({className:n(s({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{v as B};
@@ -1 +1 @@
1
- import{j as s,h as t}from"./index-DXj5DU-z.js";function c({className:a,size:d="default",...r}){return s.jsx("div",{"data-slot":"card","data-size":d,className:t("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...r})}export{c as C};
1
+ import{j as s,h as t}from"./index-_7kIe8FW.js";function c({className:a,size:d="default",...r}){return s.jsx("div",{"data-slot":"card","data-size":d,className:t("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...r})}export{c as C};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-DXj5DU-z.js";/**
1
+ import{c}from"./index-_7kIe8FW.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-DXj5DU-z.js";/**
1
+ import{c as o}from"./index-_7kIe8FW.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-DXj5DU-z.js";/**
1
+ import{c as o}from"./index-_7kIe8FW.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-DXj5DU-z.js";/**
1
+ import{c}from"./index-_7kIe8FW.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{r,al as o,i as R,E as v,bb as w,ag as C,f as T,e as m,l as h,b6 as D}from"./index-_7kIe8FW.js";function k(e){return e?.ownerDocument||document}const F={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},x={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},S={disabled:!1,...x},B={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},y={invalid:void 0,name:void 0,validityData:{state:F,errors:[],error:"",value:"",initialValue:null},setValidityData:o,disabled:void 0,setTouched:o,setDirty:o,setFilled:o,setFocused:o,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:S,registerFieldControl:o,validation:{getValidationProps:(e,t=v)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:o,getInputControl:()=>null,commit:async()=>{},change:o}},L=r.createContext(y);function A(e=!0){const t=r.useContext(L);if(t.setValidityData===o&&!e)throw new Error(R(28));return t}const P=r.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:o,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function $(){return r.useContext(P)}let b=0;function _(e,t="mui"){const[n,s]=r.useState(e),i=e||n;return r.useEffect(()=>{n==null&&(b+=1,s(`${t}-${b}`))},[n,t]),i}const E=w.useId;function M(e,t){if(E!==void 0){const n=E();return e??(t?`${t}-${n}`:n)}return _(e,t)}function O(e){return M(e,"base-ui")}const U=r.createContext({controlId:void 0,registerControlId:o,labelId:void 0,setLabelId:o,messageIds:[],setMessageIds:o,getDescriptionProps:e=>e});function V(){return r.useContext(U)}function z(e={}){const{id:t,implicit:n=!1,controlRef:s}=e,{controlId:i,registerControlId:l}=V(),a=O(t),u=n?i:void 0,c=C(()=>Symbol()),d=r.useRef(!1),I=r.useRef(t!=null),g=T(()=>{!d.current||l===o||(d.current=!1,l(c.current,void 0))});return m(()=>{if(l===o)return;let f;if(n){const p=s?.current;h(p)&&p.closest("label")!=null?f=t??null:f=u??a}else if(t!=null)I.current=!0,f=t;else if(I.current)f=a;else{g();return}if(f===void 0){g();return}d.current=!0,l(c.current,f)},[t,s,u,l,n,a,c,g]),r.useEffect(()=>g,[g]),i??a}function Y(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function j(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&D(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function q(e){return"composedPath"in e?e.composedPath()[0]:e.target}function G({controlled:e,default:t,name:n,state:s="value"}){const{current:i}=r.useRef(e!==void 0),[l,a]=r.useState(t),u=i?e:l,c=r.useCallback(d=>{i||a(d)},[]);return[u,c]}function H(e,t,n,s,i=!0,l){const{registerFieldControl:a}=A(),u=C(()=>Symbol());m(()=>{const c=u.current;if(!i){a(c,void 0);return}a(c,{controlRef:e,getValue:s,id:t,name:l,value:n})},[e,i,s,t,l,a,u,n]),m(()=>{const c=u.current;return()=>{a(c,void 0)}},[a,u])}const J="none",K="trigger-press",W="trigger-hover",X="trigger-focus",Q="outside-press",Z="item-press",ee="close-press",te="focus-out",ne="escape-key",se="list-navigation",oe="cancel-open",ae="sibling-open",re="disabled",ie="missing",le="initial",ue="imperative-action",ce="window-resize";function de(e,t,n,s){let i=!1,l=!1;const a=s??v;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){l=!0},get isCanceled(){return i},get isPropagationAllowed(){return l},trigger:n,...a}}export{ae as A,se as B,le as C,ie as D,ee as E,j as a,W as b,de as c,re as d,M as e,$ as f,q as g,A as h,ue as i,z as j,G as k,H as l,te as m,J as n,Q as o,V as p,B as q,k as r,oe as s,K as t,O as u,Z as v,ce as w,Y as x,X as y,ne as z};
@@ -0,0 +1,6 @@
1
+ import{c as q,r as g,i as A,k as I,aj as X,E as N,j as a,e as G,B as _,h as O}from"./index-_7kIe8FW.js";import{p as Q,y as z,P as L,q as Z,an as ee,F as te,J as ne,E as oe,I as se,g as ae,al as re,h as ie,R as le,a1 as ue,u as de,ao as pe,c as ce,d as ge,e as fe}from"./useScrollLock-DdWilGdG.js";import{c as V,E as me,u as H,g as xe,a as Pe,i as Ce}from"./createBaseUIEventDetails-DviWdj-N.js";import{t as he,u as Se,C as De,i as Oe}from"./inertValue-BSe8K39O.js";/**
2
+ * @license lucide-react v1.39.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Ee=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Re=q("x",Ee),K=g.createContext(void 0);function S(e){const t=g.useContext(K);if(!e&&t===void 0)throw new Error(A(27));return t}const be=g.forwardRef(function(t,n){const{render:s,className:d,style:u,forceRender:i=!1,...p}=t,r=S(),o=r.useState("open"),m=r.useState("nested"),P=r.useState("mounted"),x=r.useState("transitionStatus");return I("div",t,{state:{open:o,transitionStatus:x},ref:[r.context.backdropRef,n],stateAttributesMapping:Q,props:[{role:"presentation",hidden:!P,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:i||!m})}),W=g.forwardRef(function(t,n){const{render:s,className:d,style:u,disabled:i=!1,nativeButton:p=!0,...r}=t,o=S(),m=o.useState("open"),{getButtonProps:P,buttonRef:x}=X({disabled:i,native:p}),C={disabled:i};function c(f){m&&o.setOpen(!1,V(me,f.nativeEvent))}return I("button",t,{state:C,ref:[n,x],props:[{onClick:c},r,P]})}),Ie=g.forwardRef(function(t,n){const{render:s,className:d,style:u,id:i,...p}=t,r=S(),o=H(i);return r.useSyncedValueWithCleanup("descriptionElementId",o),I("p",t,{ref:n,props:[{id:o},p]})});function ve(){return new z({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new L,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function ye(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:ve(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:N,inactiveTriggerProps:N,popupProps:N}}function we(e,t,n=!1){return new z({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const b=e=>e.triggerIdProp??e.activeTriggerId,M=e=>e.openProp??e.open,U=e=>(e.popupElement?.id??e.floatingId)||void 0;function $(e,t){return t!==void 0&&M(e)&&b(e)===t}function Te(e,t){return $(e,t)?!0:t!==void 0&&M(e)&&b(e)==null&&e.triggerCount===1}const ke={open:M,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:b,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:U,isTriggerActive:(e,t)=>t!==void 0&&b(e)===t,isOpenedByTrigger:(e,t)=>$(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&b(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Te(e,t)?U(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement},J=g.createContext(void 0);function je(){const e=g.useContext(J);if(e===void 0)throw new Error(A(26));return e}const Ne={...Z,...he,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},Me=g.forwardRef(function(t,n){const{render:s,className:d,style:u,finalFocus:i,initialFocus:p,...r}=t,o=S(),m=o.useState("descriptionElementId"),P=o.useState("disablePointerDismissal"),x=o.useState("floatingRootContext"),C=o.useState("popupProps"),c=o.useState("modal"),f=o.useState("mounted"),D=o.useState("nested"),h=o.useState("nestedOpenDialogCount"),E=o.useState("open"),v=o.useState("openMethod"),l=o.useState("titleElementId"),R=o.useState("transitionStatus"),w=o.useState("role"),T=x.useState("floatingId");je(),Se({open:E,ref:o.context.popupRef,onComplete(){E&&o.context.onOpenChangeComplete?.(!0)}});const y=p===void 0?ee(o.context.popupRef):p,k=h>0,j=o.useStateSetter("popupElement"),Y=I("div",t,{state:{open:E,nested:D,transitionStatus:R,nestedDialogOpen:k},props:[C,{id:T,"aria-labelledby":l,"aria-describedby":m,role:w,...te,hidden:!f,onKeyDown(F){De.has(F.key)&&F.stopPropagation()},style:{"--nested-dialogs":h}},r],ref:[n,o.context.popupRef,j],stateAttributesMapping:Ne});return a.jsx(ne,{context:x,openInteractionType:v,disabled:!f,closeOnFocusOut:!P,initialFocus:y,returnFocus:i,modal:c!==!1,restoreFocus:"popup",children:Y})}),Be=g.forwardRef(function(t,n){const{keepMounted:s=!1,...d}=t,u=S(),i=u.useState("mounted"),p=u.useState("modal"),r=u.useState("open");return i||s?a.jsx(J.Provider,{value:s,children:a.jsxs(oe,{ref:n,...d,children:[i&&p===!0&&a.jsx(se,{ref:u.context.internalBackdropRef,inert:Oe(!r)}),t.children]})}):null});function Fe({store:e,parentContext:t,isDrawer:n}){const s=e.useState("open"),d=e.useState("disablePointerDismissal"),u=e.useState("modal"),i=e.useState("popupElement"),p=e.useState("floatingRootContext"),[r,o]=g.useState(0),[m,P]=g.useState(0),x=r===0,C=ae(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(c){if(!e.context.outsidePressEnabledRef.current||"button"in c&&c.button!==0)return!1;if("touches"in c){if(c.type==="touchend"){if(c.changedTouches.length!==1||c.touches.length!==0)return!1}else if(c.touches.length!==1)return!1}const f=xe(c);if(x&&!d){if(u){const D=e.context.internalBackdropRef.current,h=e.context.backdropRef.current;return D||h?D===f||h===f||Pe(f,i)&&!f?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:x});return re(s&&u===!0,i),e.useContextCallback("onNestedDialogOpen",(c,f)=>{o(c),P(f)}),G(()=>(t?.onNestedDialogOpen&&(s?t.onNestedDialogOpen(r+1,m+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&s&&t.onNestedDialogOpen(0,0)}),[n,s,r,m,t]),ie(e,{activeTriggerProps:C.reference,inactiveTriggerProps:C.trigger,popupProps:C.floating,nestedOpenDialogCount:r,nestedOpenDrawerCount:m}),null}const Ue={...ke,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class Ae extends le{constructor(t,n,s){const d=new L,u=_e(t,d,n,s);super(u,ze(d),Ue)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const s={open:t};ue(s,t,n.trigger),this.update(s)}}function _e(e,t,n,s=!1){const d={...ye(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return d.floatingRootContext=we(t,n,s),d}function ze(e){return{popupRef:g.createRef(),backdropRef:g.createRef(),internalBackdropRef:g.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Le(e,t){const{children:n,open:s,defaultOpen:d=!1,onOpenChange:u,onOpenChangeComplete:i,disablePointerDismissal:p=!1,modal:r=!0,actionsRef:o,handle:m,triggerId:P,defaultTriggerId:x=null}=t,C=e==="drawer",c=r,f=p,D="dialog",h=S(!0),E=h!=null,v={modal:c,disablePointerDismissal:f,nested:E,role:D},l=de((j,B)=>new Ae({open:d,openProp:s,activeTriggerId:x,triggerIdProp:P,...v},j,B),!0);l.useControlledProp("openProp",s),l.useControlledProp("triggerIdProp",P),l.useSyncedValues(v),l.useContextCallback("onOpenChange",u),l.useContextCallback("onOpenChangeComplete",i);const R=l.useState("open"),w=l.useState("mounted"),T=l.useState("payload");pe(l,R),ce(l);const{forceUnmount:y}=ge(R,l);g.useImperativeHandle(o,()=>({unmount:y,close:()=>l.setOpen(!1,V(Ce))}),[y,l]);const k=R||w;return a.jsxs(K.Provider,{value:l,children:[m&&a.jsx(fe,{handle:m,store:l}),k&&a.jsx(Fe,{store:l,parentContext:h?.context,isDrawer:C}),typeof n=="function"?n({payload:T}):n]})}function Ve(e){return Le("dialog",e)}const He=g.forwardRef(function(t,n){const{render:s,className:d,style:u,id:i,...p}=t,r=S(),o=H(i);return r.useSyncedValueWithCleanup("titleElementId",o),I("h2",t,{ref:n,props:[{id:o},p]})});function Xe({...e}){return a.jsx(Ve,{"data-slot":"dialog",...e})}function Ke({...e}){return a.jsx(Be,{"data-slot":"dialog-portal",...e})}function We({className:e,...t}){return a.jsx(be,{"data-slot":"dialog-overlay",className:O("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Ge({className:e,children:t,showCloseButton:n=!0,...s}){return a.jsxs(Ke,{children:[a.jsx(We,{}),a.jsxs(Me,{"data-slot":"dialog-content",className:O("fixed top-1/2 left-1/2 z-50 grid grid-cols-[minmax(0,1fr)] max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...s,children:[t,n&&a.jsxs(W,{"data-slot":"dialog-close",render:a.jsx(_,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[a.jsx(Re,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Qe({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:O("flex flex-col gap-2",e),...t})}function Ze({className:e,showCloseButton:t=!1,children:n,...s}){return a.jsxs("div",{"data-slot":"dialog-footer",className:O("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...s,children:[n,t&&a.jsx(W,{render:a.jsx(_,{variant:"outline"}),children:"Close"})]})}function et({className:e,...t}){return a.jsx(He,{"data-slot":"dialog-title",className:O("font-heading text-base leading-none font-medium",e),...t})}function tt({className:e,...t}){return a.jsx(Ie,{"data-slot":"dialog-description",className:O("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}export{Ve as D,Re as X,Me as a,W as b,He as c,Ie as d,Be as e,be as f,ye as g,we as h,Xe as i,Ge as j,et as k,Qe as l,tt as m,Ze as n,ke as p};