@snagset/server 0.1.48 → 0.1.49

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 (86) hide show
  1. package/package.json +1 -1
  2. package/static/dashboard/assets/CompositeItem-Dlay6yU9.js +1 -0
  3. package/static/dashboard/assets/{CompositeList-mtQNqoEk.js → CompositeList-Dwya2aET.js} +1 -1
  4. package/static/dashboard/assets/{ConfirmDialog-0AAEj87y.js → ConfirmDialog-CI4lfGTy.js} +1 -1
  5. package/static/dashboard/assets/{CopyButton-SKsj8T-U.js → CopyButton-C-KCr0MF.js} +1 -1
  6. package/static/dashboard/assets/{FieldItemContext-Co44CWks.js → FieldItemContext-CgKFsCxF.js} +1 -1
  7. package/static/dashboard/assets/InstallTag-m5sxp8bY.js +17 -0
  8. package/static/dashboard/assets/InstanceRows-Bzwj6LZ6.js +1 -0
  9. package/static/dashboard/assets/{McpTokens-zKXG6hus.js → McpTokens-DKqRkxCT.js} +1 -1
  10. package/static/dashboard/assets/{SaveState-Cm1lse3W.js → SaveState-BfVze7xL.js} +1 -1
  11. package/static/dashboard/assets/{_app-BmENyWPI.js → _app-CMWnhNah.js} +2 -2
  12. package/static/dashboard/assets/{_app-DsElKgcr.js → _app-wDjbs9TO.js} +1 -1
  13. package/static/dashboard/assets/{activity-3RgBB7Ym.js → activity-B0i6FGLk.js} +1 -1
  14. package/static/dashboard/assets/{arrow-left-DJMsLCm0.js → arrow-left-BdulZ2N2.js} +1 -1
  15. package/static/dashboard/assets/avatar-CaEv2hMS.js +1 -0
  16. package/static/dashboard/assets/{badge-DCAtXinr.js → badge-CTKpfsRI.js} +1 -1
  17. package/static/dashboard/assets/{card-D7_e6s9k.js → card-CGjT73CQ.js} +1 -1
  18. package/static/dashboard/assets/{check-6rTEdn4e.js → check-DOzkll0G.js} +1 -1
  19. package/static/dashboard/assets/{chevron-down-DmbQVjuJ.js → chevron-down-C-tz7Ypu.js} +1 -1
  20. package/static/dashboard/assets/{chevron-right-CGy7PKlX.js → chevron-right-DoJvWwhg.js} +1 -1
  21. package/static/dashboard/assets/{copy-BdKRO_6P.js → copy-CeZ_egx3.js} +1 -1
  22. package/static/dashboard/assets/dialog-BQKOXDHO.js +6 -0
  23. package/static/dashboard/assets/{dropdown-menu-B2sNOB_4.js → dropdown-menu-JwoQU2iu.js} +3 -3
  24. package/static/dashboard/assets/{forgot-Bxa_0p7_.js → forgot-B0XXho6c.js} +1 -1
  25. package/static/dashboard/assets/{image-off-DhoUHAUP.js → image-off-Bqobgs6b.js} +1 -1
  26. package/static/dashboard/assets/{index-CpZelV1d.js → index-DAdE1N-R.js} +3 -3
  27. package/static/dashboard/assets/inertValue-C7RCWgtk.js +1 -0
  28. package/static/dashboard/assets/{invite-BHUvOvP3.js → invite-BnuAkGJV.js} +1 -1
  29. package/static/dashboard/assets/isElementDisabled-CwHw_lZC.js +1 -0
  30. package/static/dashboard/assets/{label-BiZMzk6M.js → label-ComnO04i.js} +1 -1
  31. package/static/dashboard/assets/{layout-grid-DPEmad0M.js → layout-grid-DFwgnnTY.js} +1 -1
  32. package/static/dashboard/assets/me-CPtVQtAA.js +1 -0
  33. package/static/dashboard/assets/{parts-BkYmVS7_.js → parts-CmbgXJj-.js} +1 -1
  34. package/static/dashboard/assets/{plus-5tGvow8N.js → plus-BvOlN259.js} +1 -1
  35. package/static/dashboard/assets/{reset-D50LaU8s.js → reset-Bh0sMyz7.js} +1 -1
  36. package/static/dashboard/assets/{s._site-B2u8oM7J.js → s._site-CWq3mZQw.js} +1 -1
  37. package/static/dashboard/assets/{s._site.comments-DrRufLGX.js → s._site.comments-CeTjN5Kp.js} +3 -3
  38. package/static/dashboard/assets/s._site.reviewers-Bug-Q-ge.js +1 -0
  39. package/static/dashboard/assets/s._site.settings-DKcZEHhs.js +1 -0
  40. package/static/dashboard/assets/serializeValue-B8e3iXO-.js +1 -0
  41. package/static/dashboard/assets/{setup-Dq336EvQ.js → setup-Iu06TDZs.js} +1 -1
  42. package/static/dashboard/assets/{sign-in-DAjAlDpU.js → sign-in-B0OEOoe5.js} +1 -1
  43. package/static/dashboard/assets/{sign-up-Dvxszmvc.js → sign-up-BeFiwRrx.js} +1 -1
  44. package/static/dashboard/assets/sites-BE9RqJnf.js +1 -0
  45. package/static/dashboard/assets/{studio-DG3kKx9a.js → studio-Cg1Oy1vK.js} +1 -1
  46. package/static/dashboard/assets/studio-DllMPJ8r.js +1 -0
  47. package/static/dashboard/assets/studio.index-DLNyob4p.js +1 -0
  48. package/static/dashboard/assets/studio.integrations-Db87XYUB.js +1 -0
  49. package/static/dashboard/assets/{studio.members-cxypTb70.js → studio.members-KAqQDCv5.js} +2 -2
  50. package/static/dashboard/assets/studio.plan-5xTPUYos.js +1 -0
  51. package/static/dashboard/assets/{sun-CSVVDe1X.js → sun-BlID8y0w.js} +1 -1
  52. package/static/dashboard/assets/{switch-ySGaYAH0.js → switch-BnkPAxu8.js} +1 -1
  53. package/static/dashboard/assets/{table-CGtu9q6t.js → table-BBCwsDcH.js} +1 -1
  54. package/static/dashboard/assets/{useAriaLabelledBy-gMwuRSdn.js → useAriaLabelledBy-DBIPA8TM.js} +1 -1
  55. package/static/dashboard/assets/{useBaseQuery-B_HwoqBR.js → useBaseQuery-CgPeQebj.js} +1 -1
  56. package/static/dashboard/assets/useCompositeItem-CU7GSvP-.js +1 -0
  57. package/static/dashboard/assets/useQuery-Bt47w3ja.js +1 -0
  58. package/static/dashboard/assets/useRender-DQYQmhIj.js +1 -0
  59. package/static/dashboard/assets/{useValueChanged-Cx2et9hZ.js → useValueChanged-uYr-YTth.js} +1 -1
  60. package/static/dashboard/assets/{users-DWBXaGm0.js → users-CDypTaZ2.js} +1 -1
  61. package/static/dashboard/assets/welcome-CFlCPiEh.js +11 -0
  62. package/static/dashboard/assets/{widget-signin-CLJ-K-FY.js → widget-signin-BL4LoDmO.js} +1 -1
  63. package/static/dashboard/assets/you-BFacaF4g.js +1 -0
  64. package/static/dashboard/assets/{zod-DNHyQCPk.js → zod-BfBWjDq8.js} +1 -1
  65. package/static/dashboard/index.html +1 -1
  66. package/static/widget/build.json +2 -2
  67. package/static/widget/snag.js +1 -1
  68. package/static/widget/snag.runtime.js +1 -1
  69. package/static/dashboard/assets/CompositeItem-Cgwb0AUm.js +0 -1
  70. package/static/dashboard/assets/InstallTag-_Jm2Ff1g.js +0 -1
  71. package/static/dashboard/assets/InstanceRows-BqwDUoGv.js +0 -1
  72. package/static/dashboard/assets/avatar-CU4IfWze.js +0 -1
  73. package/static/dashboard/assets/dialog-CVhVRkOj.js +0 -6
  74. package/static/dashboard/assets/me-CaNy_lRf.js +0 -1
  75. package/static/dashboard/assets/s._site.reviewers-B_i-TVSC.js +0 -1
  76. package/static/dashboard/assets/s._site.settings-DbZsXPqa.js +0 -1
  77. package/static/dashboard/assets/serializeValue-DRMAHja_.js +0 -1
  78. package/static/dashboard/assets/sites-DP5iKU1h.js +0 -1
  79. package/static/dashboard/assets/studio-ByRkLhpa.js +0 -1
  80. package/static/dashboard/assets/studio.index-JyIGSxHS.js +0 -1
  81. package/static/dashboard/assets/studio.integrations-BgH-8eEj.js +0 -1
  82. package/static/dashboard/assets/studio.plan-DcgvVMoO.js +0 -1
  83. package/static/dashboard/assets/useQuery-DxI1qRhV.js +0 -1
  84. package/static/dashboard/assets/useRender-DqFln9km.js +0 -1
  85. package/static/dashboard/assets/welcome-CtwHnU8a.js +0 -11
  86. package/static/dashboard/assets/you-OTV4EFPf.js +0 -1
@@ -1 +1 @@
1
- import{d as o,A as s,a5 as u,s as i,a6 as y,a2 as c}from"./index-CpZelV1d.js";function Q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,org:{...r.org,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,user:{...r.user,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:t}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>i.changePassword(e.current,e.next)})}function l(){const e=o();return u({mutationFn:t=>i.createInvite(t),onSuccess:()=>void e.invalidateQueries({queryKey:s.invites().queryKey})})}function w(){const e=o(),t=s.invites().queryKey;return u({mutationFn:a=>i.revokeInvite(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,data:r.data.filter(n=>n.id!==a)}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function v(){return u({mutationFn:e=>i.sendInvite(e.id,e.token)})}function K(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.setMemberRole(a.email,a.role),onMutate:async({email:a,role:r})=>{await e.cancelQueries({queryKey:t});const n=e.getQueryData(t);return n&&e.setQueryData(t,{data:n.data.map(m=>m.email===a?{...m,role:r}:m)}),{was:n}},onSuccess:(a,{email:r})=>{e.setQueryData(t,a),a.data.find(n=>n.email===r)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}function D(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{data:r.data.filter(n=>n.email!==a)}),{was:r}},onSuccess:a=>e.setQueryData(t,a),onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}export{f as a,Q as b,K as c,D as d,w as e,l as f,v as g,q as u};
1
+ import{d as o,A as s,a5 as u,s as i,a6 as y,a2 as c}from"./index-DAdE1N-R.js";function Q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,org:{...r.org,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,user:{...r.user,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:t}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>i.changePassword(e.current,e.next)})}function l(){const e=o();return u({mutationFn:t=>i.createInvite(t),onSuccess:()=>void e.invalidateQueries({queryKey:s.invites().queryKey})})}function w(){const e=o(),t=s.invites().queryKey;return u({mutationFn:a=>i.revokeInvite(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,data:r.data.filter(n=>n.id!==a)}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function v(){return u({mutationFn:e=>i.sendInvite(e.id,e.token)})}function K(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.setMemberRole(a.email,a.role),onMutate:async({email:a,role:r})=>{await e.cancelQueries({queryKey:t});const n=e.getQueryData(t);return n&&e.setQueryData(t,{data:n.data.map(m=>m.email===a?{...m,role:r}:m)}),{was:n}},onSuccess:(a,{email:r})=>{e.setQueryData(t,a),a.data.find(n=>n.email===r)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}function D(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{data:r.data.filter(n=>n.email!==a)}),{was:r}},onSuccess:a=>e.setQueryData(t,a),onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}export{f as a,Q as b,K as c,D as d,w as e,l as f,v as g,q as u};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-DAdE1N-R.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -0,0 +1 @@
1
+ import{q as N,j as e,w as k,a4 as w,r as d,B as p,S as A,d as C,a5 as F,a2 as E,A as m,a6 as R,s as D}from"./index-DAdE1N-R.js";import{u as h}from"./useQuery-Bt47w3ja.js";import{L as O,I as v}from"./label-ComnO04i.js";import{I as P,S as q}from"./InstanceRows-Bzwj6LZ6.js";import{A as z,P as G,a as g}from"./parts-CmbgXJj-.js";import{u as S}from"./me-CPtVQtAA.js";import{S as I}from"./SaveState-BfVze7xL.js";import{b as L}from"./studio-Cg1Oy1vK.js";import{c as T}from"./update-duXzIzFS.js";import"./useBaseQuery-CgPeQebj.js";import"./dialog-BQKOXDHO.js";import"./inertValue-C7RCWgtk.js";import"./ConfirmDialog-CI4lfGTy.js";import"./labels--UUyt9uB.js";import"./card-CGjT73CQ.js";function U(){const s=S(),t=h(m.meta()),i=h(m.members()),r=L(),n=N(s.user.role,"studio"),u=k(s),c=w(s),o=!h(m.setupState()).data?.billingUrl,[l,a]=d.useState(s.org.name),[b,y]=d.useState(null);d.useEffect(()=>a(s.org.name),[s.org.name]);const j=n&&l.trim().length>0&&l.trim()!==s.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(G,{title:"General",sub:s.org.name,actions:e.jsx(I,{saving:r.isPending,savedAt:b})}),e.jsx(g,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:f=>{f.preventDefault(),j&&r.mutate(l.trim(),{onSuccess:()=>y(Date.now())})},children:[e.jsx(O,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{id:"studio-name",value:l,readOnly:!n,onChange:f=>a(f.target.value)}),j&&e.jsx(p,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:n?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),u?e.jsx(g,{title:"This instance",description:"What is running, and where.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[t.data?.version??"—"," ",e.jsx(_,{version:t.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(B,{owner:n})}),t.data?.commit&&t.data.commit!=="unknown"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[t.data.commit.slice(0,12),t.data.modified?" · modified":""]})]}),o&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[s.projects.length," · ",i.data?.data.length??"—"]})]})]})}):o?e.jsx(g,{title:"This studio",description:"What is in it.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites"}),e.jsx("dd",{className:"m-0",children:s.projects.length}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:i.data?.data.length??"—"})]})}):null,c==="instance"?e.jsx(P,{owner:n}):c==="usage"?e.jsx(q,{}):null]})}function _({version:s}){const[t,i]=d.useState({s:"idle"});return t.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),T(s).then(r=>i({s:"done",r})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):t.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(A,{className:"size-3"})," checking…"]}):t.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:t.r?.newer?`· ${t.r.latest} is out`:"· up to date"})}function B({owner:s}){const t=C(),i=h(m.instance()),[r,n]=d.useState(null),[u,c]=d.useState(""),x=F({mutationFn:a=>D.setAddress(a),onSuccess:a=>{t.setQueryData(m.instance().queryKey,a),n(null),c(""),R.success("Address saved — every new link is built from it")},onError:a=>c(E(a))}),o=i.data?.address;if(!o)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const l=o.source==="env";return r===null||!s||l?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:o.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:l?"· set by the environment (SNAGSET_BASE_URL)":o.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),s&&!l&&e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>n(o.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(r.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(v,{"aria-label":"Address",value:r,onChange:a=>n(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(p,{type:"submit",size:"sm",loading:x.isPending,disabled:!r.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(p,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),children:"Cancel"})]}),u&&e.jsx("span",{className:"text-[12px] text-destructive",children:u}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}const ne=()=>N(S().user.role,"settings")?e.jsx(U,{}):e.jsx(z,{title:"General"});export{ne as component};
@@ -0,0 +1 @@
1
+ import{q as K,j as e,L as U,w as te,d as se,r as i,a5 as P,a6 as T,a2 as M,s as F,a7 as D,B as x,$ as ne,C as G,A as oe}from"./index-DAdE1N-R.js";import{u as q}from"./useQuery-Bt47w3ja.js";import{B as _}from"./badge-CTKpfsRI.js";import{C as E,E as O,H as R,G as W,I as J,J as H}from"./dialog-BQKOXDHO.js";import{L as S,I}from"./label-ComnO04i.js";import{C as ae}from"./ConfirmDialog-CI4lfGTy.js";import{A as re,P as ie,a as ce}from"./parts-CmbgXJj-.js";import{u as V}from"./me-CPtVQtAA.js";import{C as B}from"./CopyButton-C-KCr0MF.js";import{b as le}from"./labels--UUyt9uB.js";import{M as de}from"./McpTokens-DKqRkxCT.js";import"./useBaseQuery-CgPeQebj.js";import"./useRender-DQYQmhIj.js";import"./inertValue-C7RCWgtk.js";import"./card-CGjT73CQ.js";import"./check-DOzkll0G.js";import"./copy-CeZ_egx3.js";import"./switch-BnkPAxu8.js";import"./useAriaLabelledBy-DBIPA8TM.js";import"./useValueChanged-uYr-YTth.js";const he={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function me(){const o=V(),l=K(o.user.role,"settings"),f=K(o.user.role,"studio")&&te(o),j=q(oe.integrations()),A=se(),N=()=>A.invalidateQueries({queryKey:["integrations"]}),[d,g]=i.useState(null),[c,b]=i.useState(null),[k,u]=i.useState(null),v=P({mutationFn:t=>F.regenerateGitHubWebhook(t),onSuccess:({webhook:t},r)=>u({site:r,provider:"github",hook:t,fresh:!1}),onError:t=>T.error(M(t))}),C=P({mutationFn:({uid:t,provider:r})=>F.testTracker(t,r).then(L=>({...L,provider:r})),onSuccess:t=>{T[t.ok?"success":"error"](t.ok?`${D[t.provider]} can see ${t.target}`:t.detail??`${D[t.provider]} refused the token`),N()},onError:t=>T.error(M(t))}),y=P({mutationFn:({uid:t,provider:r})=>F.disconnectTracker(t,r),onSuccess:()=>{b(null),N()},onError:t=>T.error(M(t))}),w=j.data?.data??[],m=t=>w.filter(r=>r.provider===t),p=o.projects.filter(t=>!t.archived&&!t.locked),a=t=>p.filter(r=>!m(t).some(L=>L.site===r.uid)),s=l?o.limits.integrations?p.length===0?"site":null:"plan":null;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(ie,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),s&&e.jsxs("div",{role:"note",className:"flex max-w-[1040px] flex-wrap items-center gap-x-4 gap-y-2 rounded-lg border border-border bg-muted/40 px-4 py-3 text-[13px]",children:[e.jsx("span",{className:"min-w-0 flex-1",children:s==="plan"?o.user.role==="owner"?"This studio's plan does not include integrations. A plan that does lets you connect each site to GitHub, Linear, Jira and Slack.":"This studio's plan does not include integrations. An owner can change the plan.":o.projects.length===0?"An integration connects one site to one repository, team, project or channel. Add a site first, then connect it here.":"An integration connects one site at a time, and every site here is archived or read-only. Restore one, or add a site, then connect it here."}),s==="plan"?o.user.role==="owner"&&e.jsx(x,{variant:"outline",size:"sm",render:e.jsx(U,{to:"/studio/plan"}),children:"See plans"}):e.jsx(x,{variant:"outline",size:"sm",render:e.jsx(U,{to:"/sites"}),children:"Go to Sites"})]}),["github","linear","jira","slack"].map(t=>{const r=m(t),L=a(t);return e.jsxs(ce,{title:D[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[j.isPending&&e.jsx(ne,{rows:2}),j.isSuccess&&r.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),r.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:r.map(n=>{const h=he[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(_,{variant:"outline",className:h.tone==="ok"?"border-ok text-ok":h.tone==="bad"?"border-destructive text-destructive":"",children:h.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${D[n.provider]} cannot move comments here`:""," · ",le(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),l&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(x,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(x,{variant:"ghost",size:"sm",loading:C.isPending,onClick:()=>C.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>b(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),l&&!s&&L.length>0&&e.jsx("div",{children:e.jsx(x,{variant:"outline",size:"sm",onClick:()=>g(t),children:"Connect a site…"})})]},t)}),e.jsx(de,{owner:l,instanceOwner:f,sites:o.projects}),e.jsx(ue,{open:d==="github",onOpenChange:t=>!t&&g(null),sites:a("github"),onDone:(t,r)=>{N(),r&&u({site:t,provider:"github",hook:r,fresh:!0})}}),e.jsx(xe,{open:d==="linear",onOpenChange:t=>!t&&g(null),sites:a("linear"),onDone:(t,r)=>{N(),u({site:t,provider:"linear",hook:r,fresh:!0})}}),e.jsx(ge,{open:d==="jira",onOpenChange:t=>!t&&g(null),sites:a("jira"),onDone:(t,r)=>{N(),u({site:t,provider:"jira",hook:r,fresh:!0})}}),e.jsx(fe,{open:d==="slack",onOpenChange:t=>!t&&g(null),sites:a("slack"),onDone:()=>void N()}),e.jsx(pe,{state:k,onClose:()=>u(null),siteName:t=>w.find(r=>r.site===t)?.siteName??"the site"}),e.jsx(ae,{open:c!==null,onOpenChange:t=>!t&&b(null),title:`Disconnect ${c?.siteName??"this site"} from ${c?D[c.provider]:"the tracker"}?`,description:c?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:y.isPending,onConfirm:async()=>{c&&await y.mutateAsync({uid:c.site,provider:c.provider})}})]})}function ue({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(!1),[y,w]=i.useState(""),m=P({mutationFn:s=>F.connectTracker(s,"github",{repository:d.trim(),token:c.trim(),labels:k,createOn:v?"thread.created":"manual"})}),p=A||f[0]?.uid||"",a=async s=>{s.preventDefault(),w("");try{const t=await m.mutateAsync(p);g(""),b(""),u(""),C(!1),l(!1),j(p,t.webhook&&"secret"in t.webhook?t.webhook:void 0),T.success("GitHub connected")}catch(t){w(t instanceof G?t.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void a(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to GitHub"}),e.jsxs(J,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:p,onChange:s=>N(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(I,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-token",children:"Token"}),e.jsx(I,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:c,onChange:s=>b(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(I,{id:"gh-labels",placeholder:"review, bug",value:k,onChange:s=>u(s.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>C(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:m.isPending,disabled:!d.trim()||!c.trim()||!p,children:m.isPending?"Checking…":"Connect"})]})]})})})}function pe({state:o,onClose:l,siteName:f}){const j=o&&"secret"in o.hook?o.hook.secret:null;return e.jsx(E,{open:o!==null,onOpenChange:A=>!A&&l(),children:e.jsxs(O,{children:[e.jsxs(R,{children:[e.jsx(W,{children:o?.fresh?"Connected — now the webhook":"Webhook for "+(o?f(o.site):"")}),e.jsx(J,{children:o?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":o?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${o?.fresh?"":", and the previous one has stopped working"}.`})]}),o&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:o.hook.url}),e.jsx(B,{text:o.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),j&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:j}),e.jsx(B,{text:j,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:o.provider==="linear"?"Issues":o.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(H,{children:e.jsx(x,{type:"button",onClick:l,children:"Done"})})]})})}function xe({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(!1),[y,w]=i.useState(""),m=P({mutationFn:s=>F.connectTracker(s,"linear",{team:d.trim(),apiKey:c.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:v?"thread.created":"manual"})}),p=A||f[0]?.uid||"",a=async s=>{s.preventDefault(),w("");try{const t=await m.mutateAsync(p);g(""),b(""),u(""),C(!1),l(!1),j(p,t.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),T.success("Linear connected")}catch(t){w(t instanceof G?t.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void a(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Linear"}),e.jsx(J,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:p,onChange:s=>N(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-team",children:"Team key"}),e.jsx(I,{id:"ln-team",placeholder:"ENG",value:d,onChange:s=>g(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-key",children:"API key"}),e.jsx(I,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:c,onChange:s=>b(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(I,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:k,onChange:s=>u(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>C(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:m.isPending,disabled:!d.trim()||!c.trim()||!p,children:m.isPending?"Checking…":"Connect"})]})]})})})}function ge({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(""),[y,w]=i.useState(""),[m,p]=i.useState(!1),[a,s]=i.useState(""),t=P({mutationFn:h=>F.connectTracker(h,"jira",{siteUrl:d.trim(),project:c.trim(),email:k.trim(),apiToken:v.trim(),...y.trim()?{webhookSecret:y.trim()}:{},createOn:m?"thread.created":"manual"})}),r=A||f[0]?.uid||"",L=async h=>{h.preventDefault(),s("");try{const $=await t.mutateAsync(r);b(""),C(""),w(""),p(!1),l(!1),j(r,$.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),T.success("Jira connected")}catch($){s($ instanceof G?$.message:"Could not reach the server.")}},n=(h,$,Q,Y,X,Z="text",z)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:`jr-${h}`,children:$}),e.jsx(I,{id:`jr-${h}`,type:Z,placeholder:X,value:Q,onChange:ee=>Y(ee.target.value),autoComplete:"off"}),z&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:z})]});return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:h=>void L(h),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Jira"}),e.jsx(J,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),a&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:r,onChange:h=>N(h.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(h=>e.jsx("option",{value:h.uid,children:h.name},h.uid))})]}),n("url","Jira site",d,g,"https://kilnwork.atlassian.net"),n("project","Project key",c,b,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),n("email","Account email",k,u,"you@kilnwork.studio","email"),n("token","API token",v,C,"","password"),n("secret","Webhook secret",y,w,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:m,onChange:h=>p(h.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:t.isPending,disabled:!d.trim()||!c.trim()||!k.trim()||!v.trim()||!r,children:t.isPending?"Checking…":"Connect"})]})]})})})}function fe({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(!0),[v,C]=i.useState(""),y=q({queryKey:["integrations","slack","manifest"],queryFn:()=>F.slackManifest(),enabled:o,staleTime:1/0}),w=P({mutationFn:a=>F.connectTracker(a,"slack",{channel:d.trim(),token:c.trim(),createOn:k?"thread.created":"manual"})}),m=A||f[0]?.uid||"",p=async a=>{a.preventDefault(),C("");try{await w.mutateAsync(m),g(""),b(""),u(!0),l(!1),j(m),T.success("Slack connected")}catch(s){C(s instanceof G?s.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:a=>void p(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Slack"}),e.jsx(J,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:m,onChange:a=>N(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(x,{type:"button",variant:"outline",size:"sm",disabled:!y.data,render:e.jsx("a",{href:y.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(I,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:c,onChange:a=>b(a.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(I,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:a=>g(a.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:k,onChange:a=>u(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:w.isPending,disabled:!d.trim()||!c.trim()||!m,children:w.isPending?"Checking…":"Connect"})]})]})})})}const We=()=>K(V().user.role,"settings")?e.jsx(me,{}):e.jsx(re,{title:"Integrations",children:e.jsxs("p",{className:"m-0",children:["Connecting a site to GitHub, Linear, Jira or Slack is done by an owner or an admin. Your own agent tokens are on"," ",e.jsx(U,{to:"/you",className:"text-brand hover:underline",children:"You"}),"."]})});export{We as component};
@@ -1,4 +1,4 @@
1
- import{c as Wt,a9 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,aa as Vt,f as Fe,m as St,E as bn,ab as vn,ac as Gt,k as Ce,g as bt,q as Xt,ad as yn,B as He,ae as it,af as Kt,a2 as kt,I as Sn,D as wn,ag as Rn,ah as In,ai as jn,F as Tn,A as Lt}from"./index-CpZelV1d.js";import{u as Ot}from"./useQuery-DxI1qRhV.js";import{u as Cn,a as An}from"./zod-DNHyQCPk.js";import{c as Mn,d as En,e as Pn,f as Nn,i as Vn,h as kn,u as Ln,a as On,j as Dn,p as Fn,r as Hn,g as Bn,A as Un,b as _n}from"./avatar-CU4IfWze.js";import{B as zn}from"./badge-DCAtXinr.js";import{C as Jt}from"./card-D7_e6s9k.js";import{L as $n,M as qn,P as Wn,N as Tt,R as Yn,O as p,v as Qt,A as pt,q as Gn,F as Xn,Q as Kn,S as Jn,w as rt,U as Qn,V as Zn,x as es,W as ts,Y as ns,Z as ss,_ as os,$ as rs,a0 as ls,a as is,a1 as as,a2 as Ct,C as cs,a3 as us,a4 as ds,X as fs,E as ps,G as ms,I as Dt,H as Ft,J as Ht,K as Bt}from"./dialog-CVhVRkOj.js";import{e as gs,f as hs,h as Zt,j as en,k as Ut,l as xs,m as bs,o as vs,c as Te,n as at,p as ys,q as Ss,r as wt,a as vt,s as ws,w as Rs,v as yt,L as _t,I as Is}from"./label-BiZMzk6M.js";import{T as tn,a as nn,b as ct,c as Ie,d as sn,e as je}from"./table-CGtu9q6t.js";import{C as js}from"./ConfirmDialog-0AAEj87y.js";import{C as Ts}from"./CopyButton-SKsj8T-U.js";import{C as on}from"./chevron-down-DmbQVjuJ.js";import{C as Cs}from"./check-6rTEdn4e.js";import{s as Rt,i as As}from"./serializeValue-DRMAHja_.js";import{u as Ms}from"./useValueChanged-Cx2et9hZ.js";import{C as Es,u as Ps,a as Ns}from"./CompositeList-mtQNqoEk.js";import{A as Vs,P as ks,b as Ls}from"./parts-BkYmVS7_.js";import{u as rn}from"./me-CaNy_lRf.js";import{a as Os}from"./labels--UUyt9uB.js";import{c as Ds,d as Fs,e as Hs,f as Bs,g as Us}from"./studio-DG3kKx9a.js";import{P as _s}from"./plus-5tGvow8N.js";import"./useBaseQuery-B_HwoqBR.js";import"./useRender-DqFln9km.js";import"./copy-BdKRO_6P.js";/**
1
+ import{c as Wt,a9 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,aa as Vt,f as Fe,m as St,E as bn,ab as vn,ac as Gt,k as Ce,g as bt,q as Xt,ad as yn,B as He,ae as it,af as Kt,a2 as kt,I as Sn,D as wn,ag as Rn,ah as In,ai as jn,F as Tn,A as Lt}from"./index-DAdE1N-R.js";import{u as Ot}from"./useQuery-Bt47w3ja.js";import{u as Cn,a as An}from"./zod-BfBWjDq8.js";import{c as Mn,d as En,e as Pn,f as Nn,i as Vn,h as kn,u as Ln,a as On,j as Dn,p as Fn,r as Hn,g as Bn,A as Un,b as _n}from"./avatar-CaEv2hMS.js";import{B as zn}from"./badge-CTKpfsRI.js";import{C as Jt}from"./card-CGjT73CQ.js";import{K as $n,L as qn,P as Wn,R as Yn,M as p,v as Qt,q as Gn,F as Xn,N as Kn,O as Jn,w as rt,Q as Qn,S as Zn,x as es,U as ts,V as ns,W as ss,Y as os,a as rs,Z as ls,B as is,_ as as,X as cs,C as us,E as ds,H as Dt,G as Ft,I as Ht,J as Bt}from"./dialog-BQKOXDHO.js";import{e as fs,f as ps,h as Zt,j as en,k as Ut,l as ms,m as gs,o as hs,c as Te,n as at,p as xs,q as bs,r as wt,a as vt,s as vs,w as ys,v as yt,L as _t,I as Ss}from"./label-ComnO04i.js";import{T as tn,a as nn,b as ct,c as Ie,d as sn,e as je}from"./table-BBCwsDcH.js";import{C as ws}from"./ConfirmDialog-CI4lfGTy.js";import{C as Rs}from"./CopyButton-C-KCr0MF.js";import{C as on}from"./chevron-down-C-tz7Ypu.js";import{C as Is}from"./check-DOzkll0G.js";import{i as js}from"./isElementDisabled-CwHw_lZC.js";import{a as Tt,u as pt,i as Ts,b as Cs,t as Ct,C as As}from"./inertValue-C7RCWgtk.js";import{s as Rt}from"./serializeValue-B8e3iXO-.js";import{u as Ms}from"./useValueChanged-uYr-YTth.js";import{C as Es,u as Ps,a as Ns}from"./CompositeList-Dwya2aET.js";import{A as Vs,P as ks,b as Ls}from"./parts-CmbgXJj-.js";import{u as rn}from"./me-CPtVQtAA.js";import{a as Os}from"./labels--UUyt9uB.js";import{c as Ds,d as Fs,e as Hs,f as Bs,g as Us}from"./studio-Cg1Oy1vK.js";import{P as _s}from"./plus-BvOlN259.js";import"./useBaseQuery-CgPeQebj.js";import"./useRender-DQYQmhIj.js";import"./copy-CeZ_egx3.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as Wt,a9 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,aa as Vt,f
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const qs=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Ws=Wt("mail",qs);function Ys(e){const{open:t=!1,onOpenChange:s,elements:o={}}=e,i=gs(),f=$n()!=null,r=Yt(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Wn,floatingId:i,syncOnly:!1,nested:f})).current;return xe(()=>{const u={open:t,floatingId:i};o.reference!==void 0&&(u.referenceElement=o.reference,u.domReferenceElement=xn(o.reference)?o.reference:null),o.floating!==void 0&&(u.floatingElement=o.floating),r.update(u)},[t,i,o.reference,o.floating,r]),r.context.onOpenChange=s,r.context.nested=f,r}function Gs(e){const[t,s]=l.useState({current:e,previous:null});return Object.is(e,t.current)||s({current:e,previous:t.current}),t.previous}function Xs({className:e,...t}){return n.jsx("select",{className:Be("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",e),...t})}function Ks(e){const t=l.useRef(!0);t.current&&(t.current=!1,e())}const ln=l.createContext(null);function be(){const e=l.useContext(ln);if(e===null)throw new Error(jt(60));return e}const Js=(e,t)=>Object.is(e,t);function Ye(e,t,s){return e==null||t==null?Object.is(e,t):s(e,t)}function lt(e,t,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ye(o,t,s))}function Qs(e,t,s){return e.filter(o=>!Ye(t,o,s))}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Zs(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const s of t)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of t)if(s&&s.value==null&&s.label!=null)return!0;return!1}function cn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Rt(e)}function We(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Rt(e.value):Rt(e)}function un(e,t,s){function o(){return cn(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const i=t,f=an(i)?i.flatMap(r=>r.items):i;if(e==null||typeof e!="object"){const r=f.find(u=>u.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=f.find(u=>u&&u.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function eo(e,t,s){return e.reduce((o,i,f)=>(f>0&&o.push(", "),o.push(n.jsx(l.Fragment,{children:un(i,t,s)},f)),o),[])}const d={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:s,itemToStringValue:o}=e;return t==null?!1:s&&Array.isArray(t)?t.length>0:We(t,o)!==""},hasNullItemLabel:(e,t)=>t?Zs(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const s=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(i=>Ye(t,i,s)):Ye(t,o,s)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function to(e,t,s=(o,i)=>o===i){return e.length===t.length&&e.every((o,i)=>s(o,t[i]))}function Ke(e,t=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,s))}const me=1;function At(e,t){return Math.max(0,e-t)}function ut(e,t){if(t<=0)return 0;const s=Ke(e,0,t),o=s,i=t-s,f=o<=me,r=i<=me;return f&&r?o<=i?0:t:f?0:r?t:s}function no(e){const{id:t,value:s,defaultValue:o=null,onValueChange:i,open:f,defaultOpen:r=!1,onOpenChange:u,name:c,form:m,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:R=!1,modal:v=!0,actionsRef:D,inputRef:S,onOpenChangeComplete:_,items:N,multiple:I=!1,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w=Js,highlightItemOnHover:k=!0,children:W}=e,{clearErrors:O}=hs(),{setDirty:ue,setTouched:Y,setFocused:le,validityData:K,setFilled:F,name:L,disabled:J,validation:C,validationMode:ne}=Zt(),z=en({id:t}),P=J||b,a=L??c,[h,Q]=Ut({controlled:s,default:I?o??Vt:o,name:"Select",state:"value"}),[H,se]=Ut({controlled:f,default:r,name:"Select",state:"open"}),g=l.useRef([]),T=l.useRef([]),B=l.useRef(null),ee=l.useRef(null),ve=l.useRef(0),M=l.useRef(null),G=l.useRef([]),$=l.useRef(!1),de=l.useRef(null),Z=l.useRef(null),oe=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=l.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:q}=Tt(H),{openMethod:X,triggerProps:ae}=Mn(H),E=Yt(()=>new Yn({id:z,labelId:void 0,modal:v,multiple:I,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,value:h,open:H,mounted:ie,transitionStatus:q,items:N,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ae=p(E,d.activeIndex),ye=p(E,d.selectedIndex),Se=p(E,d.triggerElement),ce=p(E,d.positionerElement),ke=Gs(X),Le=X??ke,te=l.useMemo(()=>I?"":We(h,V),[I,h,V]),mt=l.useMemo(()=>I&&Array.isArray(h)?h.map(A=>We(A,V)):We(h,V),[I,h,V]),Qe=Qt(Se),we=Fe(()=>mt);xs(Qe,z,h,we,!P,c);const gt=l.useRef(h),Ge=I?Array.isArray(h)&&h.length>0:h!=null&&te!=="";xe(()=>{F(Ge)},[Ge,F]),xe(function(){let U=h,Re=!1;if(I){const De=Array.isArray(h)?h:[];Re=De.length===0,U=De[De.length-1]}const Ne=Re?-1:lt(G.current,U,w),Ve=Ne===-1?null:Ne;Ve===null&&(Z.current=null),!H&&E.set("selectedIndex",Ve)},[I,H,h,w,E]);function ge(A){const U=K.initialValue;return Array.isArray(A)&&Array.isArray(U)?!to(A,U,(Re,Ne)=>Ye(Re,Ne,w)):A!==U}Ms(h,()=>{O(a),ue(ge(h)),C.change(h)});const Ue=Fe((A,U)=>{u?.(A,U),!U.isCanceled&&(se(A),!A&&(U.reason===bs||U.reason===vs)&&(Y(!0),le(!1),ne==="onBlur"&&C.commit(h)))}),_e=Fe(()=>{fe(!1),E.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});pt({enabled:!D,open:H,ref:B,onComplete(){H||_e()}}),l.useImperativeHandle(D,()=>({unmount:_e}),[_e]);const Me=Fe((A,U)=>{i?.(A,U),!U.isCanceled&&Q(A)}),he=Fe(A=>{const U=At(A.scrollHeight,A.clientHeight),Re=ut(A.scrollTop,U),Ne=Re>0,Ve=Re<U;E.set("scrollUpArrowVisible",Ne),E.set("scrollDownArrowVisible",Ve)}),Ee=Ys({open:H,onOpenChange:Ue,elements:{reference:Se,floating:ce}}),ze=En(Ee,{enabled:!y&&!P,event:"mousedown"}),$e=Gn(Ee),Pe=Pn(Ee,{enabled:!y&&!P,listRef:g,activeIndex:Ae,selectedIndex:ye,disabledIndices:Vt,onNavigate(A){A===null&&!H||E.set("activeIndex",A)},focusItemOnHover:k}),Oe=Nn(Ee,{enabled:!y&&!P&&(H||!I),listRef:T,activeIndex:Ae,selectedIndex:ye,disabledIndices:A=>As(g.current[A]),onMatch(A){H?E.set("activeIndex",A):Me(G.current[A],Te(at))},onTyping(A){$.current=A}}),Ze=l.useMemo(()=>St(Oe.reference,Pe.reference,$e.reference,ze.reference,ae),[ze.reference,Oe.reference,Pe.reference,$e.reference,ae]),et=l.useMemo(()=>St(Xn,Oe.floating,Pe.floating,$e.floating),[Oe.floating,Pe.floating,$e.floating]),tt=Pe.item??bn;Ks(()=>{E.update({popupProps:et,triggerProps:Ze})}),E.useSyncedValues({id:z,modal:v,multiple:I,value:h,open:H,mounted:ie,transitionStatus:q,popupProps:et,triggerProps:Ze,items:N,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,openMethod:Le});const pe=l.useMemo(()=>({store:E,floatingContext:Ee,required:R,disabled:P,readOnly:y,multiple:I,highlightItemOnHover:k,setValue:Me,setOpen:Ue,listRef:g,popupRef:B,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:ve,itemProps:tt,valueRef:M,valuesRef:G,labelsRef:T,typingRef:$,selectionRef:oe,firstItemTextRef:de,selectedItemTextRef:Z,validation:C,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:re,initialValueRef:gt}),[E,Ee,R,P,y,I,k,Me,Ue,tt,C,_,he]),qe=vn(S,C.inputRef),Xe=I?void 0:a,ht=l.useMemo(()=>!I||!Array.isArray(h)||!a?null:h.map(A=>{const U=We(A,V);return n.jsx("input",{type:"hidden",form:m,name:a,value:U,disabled:P},U)}),[I,h,m,a,V,P]);return n.jsxs(ln.Provider,{value:pe,children:[W,n.jsx("input",{...C.getValidationProps(P,{onFocus(){E.state.triggerElement?.focus({focusVisible:!0})},onChange(A){if(A.nativeEvent.defaultPrevented||P||y)return;const U=A.currentTarget.value,Re=Te(at,A.nativeEvent);function Ne(){if(I)return;const Ve=U.toLowerCase();let De=G.current.findIndex(xt=>We(xt,V).toLowerCase()===Ve||cn(xt,j).toLowerCase()===Ve);De===-1&&(De=G.current.findIndex((xt,hn)=>{const Nt=T.current[hn];return Nt!=null&&Nt.toLowerCase()===Ve}));const Pt=G.current[De];Pt!=null&&Me(Pt,Re)}E.set("forceMount",!0),queueMicrotask(Ne)}}),id:z&&Xe==null?`${z}-hidden-input`:void 0,form:m,name:Xe,autoComplete:x,value:te,disabled:P,required:R&&!(I&&Ge),readOnly:y,ref:qe,style:a?Kn:Jn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ht]})}function so(e,t){return e??t}const oo=400,ro={...Zn,...Ss,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},lo=l.forwardRef(function(t,s){const{render:o,className:i,id:f,disabled:r=!1,nativeButton:u=!0,style:c,...m}=t,{setTouched:x,setFocused:b,validationMode:y,state:R,disabled:v}=Zt(),{labelId:D}=ys(),{store:S,setOpen:_,selectionRef:N,validation:I,readOnly:j,required:V,alignItemWithTriggerActiveRef:w,disabled:k}=be(),W=v||k||r,O=p(S,d.open),ue=p(S,d.mounted),Y=p(S,d.value),le=p(S,d.triggerProps),K=p(S,d.positionerElement),F=p(S,d.listElement),L=p(S,d.popupSide),J=p(S,d.id),C=p(S,d.labelId),ne=p(S,d.hasSelectedValue),z=ue&&K?L:null,P=f??J,a=so(D,C);en({id:P});const h=Qt(K),Q=l.useRef(null),{getButtonProps:H,buttonRef:se}=Gt({disabled:W,native:u}),g=S.useStateSetter("triggerElement"),T=rt(),B=rt(),ee=rt();l.useEffect(()=>{if(O)return ee.start(oo,()=>{N.current.allowUnselectedMouseUp=!0,N.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};N.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},B.clear()},[O,N,B,ee]);const ve=St(le,{id:P,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?F?.id??Qn(K)?.id:void 0,"aria-labelledby":a,"aria-readonly":j||void 0,"aria-required":V||void 0,tabIndex:W?-1:0,onFocus($){b(!0),O&&w.current&&_(!1,Te(at,$.nativeEvent)),T.start(0,()=>{S.set("forceMount",!0)})},onBlur($){vt(K,$.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&I.commit(Y))},onMouseDown($){if(O)return;const de=wt($.currentTarget);function Z(oe){if(!Q.current)return;const re=oe.target;vt(Q.current,re)||vt(h.current,re)||Vn(oe,Q.current)||_(!1,Te(ws,oe))}B.start(0,()=>{de.addEventListener("mouseup",Z,{once:!0})})}},m,H),M=I.getValidationProps(W,ve);M.role="combobox";const G={...R,open:O,disabled:W,value:Y,readOnly:j,popupSide:z,placeholder:!ne};return Ce("button",t,{ref:[s,Q,se,g],state:G,stateAttributesMapping:ro,props:M})}),io={value:()=>null},ao=l.forwardRef(function(t,s){const{className:o,render:i,children:f,placeholder:r,style:u,...c}=t,{store:m,valueRef:x}=be(),b=p(m,d.value),y=p(m,d.items),R=p(m,d.itemToStringLabel),v=p(m,d.hasSelectedValue),D=!v&&r!=null&&f==null,S=p(m,d.hasNullItemLabel,D),_={value:b,placeholder:!v};let N=null;return typeof f=="function"?N=f(b):f!=null?N=f:D&&!S?N=r:Array.isArray(b)?N=eo(b,y,R):N=un(b,y,R),Ce("span",t,{state:_,ref:[s,x],props:[{children:N},c],stateAttributesMapping:io})}),co=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u}=be(),m={open:p(u,d.open)};return Ce("span",t,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:es})}),uo=l.forwardRef(function(t,s){const{store:o}=be(),i=p(o,d.mounted),f=p(o,d.forceMount);return i||f?n.jsx(ts,{ref:s,...t}):null}),dn=l.createContext(void 0);function Mt(){const e=l.useContext(dn);if(!e)throw new Error(jt(59));return e}function dt(e,t){e&&Object.assign(e.style,t)}const fn={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},fo={position:"fixed"},po=l.forwardRef(function(t,s){const{anchor:o,className:i,render:f,positionMethod:r,side:u,align:c,sideOffset:m,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:R,sticky:v,disableAnchorTracking:D,alignItemWithTrigger:S=!0,collisionAvoidance:_=ns,style:N,...I}=t,{store:j,listRef:V,labelsRef:w,alignItemWithTriggerActiveRef:k,selectedItemTextRef:W,valuesRef:O,initialValueRef:ue,popupRef:Y,setValue:le,floatingContext:K}=be(),F=p(j,d.open),L=p(j,d.mounted),J=p(j,d.modal),C=p(j,d.value),ne=p(j,d.openMethod),z=p(j,d.positionerElement),P=p(j,d.triggerElement),a=p(j,d.isItemEqualToValue),h=p(j,d.transitionStatus),Q=l.useRef(null),H=l.useRef(null),[se,g]=l.useState(S),T=L&&se&&ne!=="touch";!L&&se!==S&&g(S),l.useImperativeHandle(k,()=>T),kn((T||J)&&F,ne==="touch",z,P);const B=Ln({anchor:o,floatingRootContext:K,positionMethod:r,mounted:L,side:u,sideOffset:m,align:c,alignOffset:x,arrowPadding:R,collisionBoundary:b,collisionPadding:y,sticky:v,disableAnchorTracking:D??T,collisionAvoidance:_,keepMounted:!0}),ee=T?"none":B.side,ve=T?fo:B.positionerStyles,M={open:F,side:ee,align:B.align,anchorHidden:B.anchorHidden};xe(()=>{j.set("popupSide",B.side)},[j,B.side]);const G=j.useStateSetter("positionerElement"),$=On(t,M,{styles:ve,transitionStatus:h,props:I,refs:[s,G],hidden:!L,inert:!F}),de=l.useRef(0),Z=Fe(re=>{if(O.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Te(at);if(ie!==0&&!j.state.multiple&&C!==null&&lt(O.current,C,a)===-1){const X=ue.current,E=X!=null&&lt(O.current,X,a)!==-1?X:null;le(E,fe),E===null&&(j.set("selectedIndex",null),W.current=null)}if(ie!==0&&j.state.multiple&&Array.isArray(C)){const q=C.filter(X=>lt(O.current,X,a)!==-1);q.length!==C.length&&(le(q,fe),q.length===0&&(j.set("selectedIndex",null),W.current=null))}if(F&&T){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const q={height:""};dt(z,q),dt(Y.current,q)}}),oe=l.useMemo(()=>({...B,side:ee,alignItemWithTriggerActive:T,setControlledAlignItemWithTrigger:g,scrollUpArrowRef:Q,scrollDownArrowRef:H}),[B,ee,T,g]);return n.jsx(Es,{elementsRef:V,labelsRef:w,onMapChange:Z,children:n.jsxs(dn.Provider,{value:oe,children:[L&&J&&n.jsx(ss,{inert:os(!F),cutout:P}),$]})})}),nt="base-ui-disable-scrollbar",It={className:nt,getElement(e){return n.jsx("style",{nonce:e,href:nt,precedence:"base-ui:low",children:`.${nt}{scrollbar-width:none}.${nt}::-webkit-scrollbar{display:none}`})}},mo=l.createContext(void 0),go={disableStyleElements:!1};function ho(){return l.useContext(mo)??go}const xo={...cs,...Ct},bo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,finalFocus:r,...u}=t,{store:c,popupRef:m,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:R,selectedItemTextRef:v,multiple:D,handleScrollArrowVisibility:S,scrollHandlerRef:_,listRef:N,highlightItemOnHover:I,floatingContext:j}=be(),{side:V,align:w,alignItemWithTriggerActive:k,isPositioned:W,setControlledAlignItemWithTrigger:O}=Mt(),ue=Dn()!=null,Y=Ps(),{nonce:le,disableStyleElements:K}=ho(),F=p(c,d.id),L=p(c,d.open),J=p(c,d.openMethod),C=p(c,d.mounted),ne=p(c,d.popupProps),z=p(c,d.transitionStatus),P=p(c,d.triggerElement),a=p(c,d.positionerElement),h=p(c,d.listElement),Q=l.useRef(!1),H=l.useRef(!1),se=l.useRef({}),g=rs(),T=Fe(M=>{if(!a||!m.current||!H.current)return;const G=a.style.top==="0px",$=a.style.bottom==="0px";if(Q.current||!k||!G&&!$){S(M);return}const de=$t(a),Z=Je(a.getBoundingClientRect().height,"y",de),oe=wt(a),re=bt(a),ie=re.getComputedStyle(a),fe=parseFloat(ie.marginTop),q=parseFloat(ie.marginBottom),X=zt(re.getComputedStyle(m.current)),ae=Math.min(oe.documentElement.clientHeight-fe-q,X),E=M.scrollTop,Ae=st(M);let ye=null;const Se=te=>{a.style.height=`${te}px`},ce=G?Ae-E:E,ke=Math.min(Z+ce,ae);if(ce<=me){const te=Ke(ce,0,ae-Z);te>0&&Se(Z+te),M.scrollTop=G?Ae:0,ae-(Z+te)<=me&&(Q.current=!0),S(M);return}if(ae-ke>me)ye=G?1/0:0;else if($&&E<Ae){const te=Z+ce-ae;ye=E-(ce-te)}const Le=Math.ceil(ke);if(Le!==0&&Se(Le),ye!=null){const te=Ke(ye,0,st(M));Math.abs(M.scrollTop-te)>me&&(M.scrollTop=te)}Le>=ae-me&&(Q.current=!0),S(M)});l.useImperativeHandle(_,()=>T,[T]),pt({open:L,ref:m,onComplete(){L&&x?.(!0)}});const B={open:L,transitionStatus:z,side:V,align:w};xe(()=>{!a||!m.current||Object.keys(se.current).length||(se.current={top:a.style.top||"0",left:a.style.left||"0",right:a.style.right,height:a.style.height,bottom:a.style.bottom,minHeight:a.style.minHeight,maxHeight:a.style.maxHeight,marginTop:a.style.marginTop,marginBottom:a.style.marginBottom})},[m,a]),xe(()=>{L||k||(H.current=!1,Q.current=!1,dt(a,se.current))},[L,k,a,m]),xe(()=>{const M=m.current;if(!L||!P||!a||!M||k&&!W||c.state.transitionStatus==="ending")return;if(H.current=!0,M.style.removeProperty("--transform-origin"),!k){g.request(()=>S(h||M));return}const G=vo(M);try{let $=v.current;$?.isConnected||($=!d.hasSelectedValue(c.state)&&R.current?.isConnected?R.current:null);const de=y.current,Z=bt(a),oe=Z.getComputedStyle(a),re=Z.getComputedStyle(M),ie=wt(P),fe=$t(P),q=ot(P.getBoundingClientRect(),fe),X=ot(a.getBoundingClientRect(),fe),ae=q.height,E=h||M,Ae=E.scrollHeight,ye=parseFloat(re.borderBottomWidth),Se=parseFloat(oe.marginTop)||10,ce=parseFloat(oe.marginBottom)||10,ke=parseFloat(oe.minHeight)||100,Le=zt(re),te=5,mt=5,Qe=20,we=ie.documentElement.clientHeight-Se-ce,gt=ie.documentElement.clientWidth,Ge=we-q.bottom+ae;let ge,Ue=Y==="rtl"?q.right-X.width:q.left,_e=0;if($&&de){const pe=ot(de.getBoundingClientRect(),fe);ge=ot($.getBoundingClientRect(),fe),Ue=X.left+(Y==="rtl"?pe.right-ge.right:pe.left-ge.left);const qe=pe.top-q.top+pe.height/2;_e=ge.top-X.top+ge.height/2-qe}const Me=Ge+_e+ce+ye;let he=Math.min(we,Me);const Ee=we-Se-ce,ze=Me-he,$e=gt-mt;a.style.left=`${Ke(Ue,te,$e-X.width)}px`,a.style.height=`${he}px`,a.style.maxHeight="none",a.style.marginTop=`${Se}px`,a.style.marginBottom=`${ce}px`,M.style.height="100%";const Pe=st(E),Oe=ze>=Pe-me;Oe&&(he=Math.min(we,X.height)-(ze-Pe));const Ze=q.top<Qe||q.bottom>we-Qe||Math.ceil(he)+me<Math.min(Ae,ke),et=(Z.visualViewport?.scale??1)!==1&&ls;if(Ze||et){dt(a,se.current),O(!1);return}const tt=Math.max(ke,he);if(Oe){const pe=Math.max(0,we-Me);a.style.top=X.height>=Ee?"0":`${pe}px`,a.style.height=`${he}px`,E.scrollTop=st(E)}else a.style.bottom="0",E.scrollTop=ze;if(ge){const pe=X.top,qe=X.height,Xe=ge.top+ge.height/2,ht=Ke(qe>0?(Xe-pe)/qe*100:50,0,100);M.style.setProperty("--transform-origin",`50% ${ht}%`)}(tt===we||he>=Le)&&(Q.current=!0),S(E),I&&c.state.selectedIndex===null&&c.state.activeIndex===null&&N.current[0]!=null&&c.set("activeIndex",0)}finally{G()}},[c,L,a,P,y,R,v,m,S,k,O,g,h,N,I,Y,W]),l.useEffect(()=>{if(!k||!a||!L)return;const M=bt(a);function G($){b(!1,Te(Rs,$))}return is(M,"resize",G)},[b,k,a,L]);const ee={...h?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":D||void 0,id:`${F}-list`},onKeyDown(M){ue&&us.has(M.key)&&M.stopPropagation()},onScroll(M){h||T(M.currentTarget)},...k&&{style:h?{height:"100%"}:fn},className:!h&&k?It.className:void 0},ve=Ce("div",t,{ref:[s,m],state:B,stateAttributesMapping:xo,props:[ne,ee,Bn(z),u]});return n.jsxs(l.Fragment,{children:[!K&&It.getElement(le),n.jsx(as,{context:j,modal:!1,disabled:!C,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:ve})]})});function zt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function st(e){return At(e.scrollHeight,e.clientHeight)}function $t(e){return Fn.getScale(e)}function Je(e,t,s){return e/s[t]}function ot(e,t){return Hn({x:Je(e.x,"x",t),y:Je(e.y,"y",t),width:Je(e.width,"x",t),height:Je(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function vo(e){const{style:t}=e,s={};for(const[o,i]of qt)s[o]=t.getPropertyValue(o),t.setProperty(o,i,"important");return()=>{for(const[o]of qt){const i=s[o];i?t.setProperty(o,i):t.removeProperty(o)}}}const yo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u,scrollHandlerRef:c,multiple:m}=be(),{alignItemWithTriggerActive:x}=Mt(),b=p(u,d.hasScrollArrows),y=p(u,d.openMethod),v={id:`${p(u,d.id)}-list`,role:"listbox","aria-multiselectable":m||void 0,onScroll(S){c.current?.(S.currentTarget)},...x&&{style:fn},className:b&&y!=="touch"?It.className:void 0},D=u.useStateSetter("listElement");return Ce("div",t,{ref:[s,D],props:[v,r]})}),pn=l.createContext(void 0);function Et(){const e=l.useContext(pn);if(!e)throw new Error(jt(57));return e}const So=l.memo(l.forwardRef(function(t,s){const{render:o,className:i,style:f,value:r=null,label:u,disabled:c=!1,nativeButton:m=!1,...x}=t,b=l.useRef(null),y=Ns({guess:!0,label:u,textRef:b}),{store:R,itemProps:v,setOpen:D,setValue:S,selectionRef:_,typingRef:N,valuesRef:I,multiple:j,selectedItemTextRef:V,disabled:w,readOnly:k}=be(),W=w||c,O=p(R,d.isActive,y.index),ue=p(R,d.open),Y=p(R,d.isSelected,r),le=p(R,d.isSelectedByFocus,y.index),K=p(R,d.isItemEqualToValue),F=y.index,L=l.useRef(null);xe(()=>{const g=I.current;return g[F]=r,()=>{delete g[F]}},[F,r,I]),xe(()=>{const g=R.state.value;let T=g;j&&Array.isArray(g)&&(T=g.length>0?g[g.length-1]:void 0),T!==void 0&&Ye(r,T,K)&&(R.set("selectedIndex",F),b.current&&(V.current=b.current))},[F,j,K,R,r,V]);const J=l.useRef("mouse"),C=l.useRef(!1),{getButtonProps:ne,buttonRef:z}=Gt({disabled:W,focusableWhenDisabled:!0,native:m,composite:!0}),P={disabled:W,selected:Y,highlighted:O};function a(g){if(w||k)return;const T=R.state.value;if(j){const B=Array.isArray(T)?T:[],ee=Y?Qs(B,r,K):[...B,r];S(ee,Te(yt,g))}else S(r,Te(yt,g)),D(!1,Te(yt,g))}function h(){_.current.dragY=0}const Q={role:"option","aria-selected":Y,tabIndex:ue&&O?0:-1,onKeyDown(g){R.set("activeIndex",F),g.key===" "&&N.current&&g.preventDefault()},onClick(g){const T=J.current!=="touch",B=g.nativeEvent.pointerType,ee=T&&ds(g.nativeEvent)&&(B!==void 0||O),ve=T&&!ee&&!C.current;C.current=!1,!(W||ve)&&a(g.nativeEvent)},onPointerEnter(g){J.current=g.pointerType},onPointerMove(g){if(g.pointerType==="mouse"&&g.buttons===1){const T=_.current;T.dragY+=g.movementY,T.dragY**2>=64&&(T.allowUnselectedMouseUp=!0)}},onPointerDown(g){J.current=g.pointerType,C.current=!0,h()},onMouseUp(){if(h(),W||J.current==="touch"||C.current)return;const g=!_.current.allowSelectedMouseUp&&Y,T=!_.current.allowUnselectedMouseUp&&!Y;g||T||(C.current=!0,L.current?.click(),C.current=!1)}},H=Ce("div",t,{ref:[z,s,y.ref,L],state:P,props:[v,Q,x,ne]}),se=l.useMemo(()=>({selected:Y,index:F,textRef:b,selectedByFocus:le}),[Y,F,b,le]);return n.jsx(pn.Provider,{value:se,children:H})})),wo=l.forwardRef(function(t,s){const{selected:o}=Et();return t.keepMounted||o?n.jsx(Ro,{...t,ref:s}):null}),Ro=l.memo(l.forwardRef((e,t)=>{const{render:s,className:o,style:i,keepMounted:f,...r}=e,{selected:u}=Et(),c=l.useRef(null),{transitionStatus:m,setMounted:x}=Tt(u),y=Ce("span",e,{ref:[t,c],state:{selected:u,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Ct});return pt({open:u,ref:c,onComplete(){u||x(!1)}}),y})),Io=l.memo(l.forwardRef(function(t,s){const{index:o,textRef:i,selectedByFocus:f}=Et(),{firstItemTextRef:r,selectedItemTextRef:u}=be(),{render:c,className:m,style:x,...b}=t,y=l.useCallback(v=>{v&&(o===0&&(r.current=v),f&&(u.current=v))},[r,u,o,f]);return Ce("div",t,{ref:[y,s,i],props:b})})),mn=l.forwardRef(function(t,s){const{render:o,className:i,style:f,direction:r,keepMounted:u,...c}=t,m=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:R,scrollArrowsMountedCountRef:v}=be(),{side:D,scrollDownArrowRef:S,scrollUpArrowRef:_}=Mt(),N=m?d.scrollUpArrowVisible:d.scrollDownArrowVisible,I=p(x,N),j=p(x,d.openMethod),V=I&&j!=="touch",w=rt(),k=m?_:S,{mounted:W,transitionStatus:O,setMounted:ue}=Tt(V);xe(()=>(v.current+=1,x.set("hasScrollArrows",!0),()=>{v.current=Math.max(0,v.current-1),v.current===0&&x.set("hasScrollArrows",!1)}),[x,v]),pt({open:V,ref:k,onComplete(){V||ue(!1)}});const K=Ce("div",t,{ref:[s,k],state:{direction:r,visible:V,side:D,transitionStatus:O},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(L){if(L.movementX===0&&L.movementY===0||w.isStarted())return;x.set("activeIndex",null);function J(){const C=x.state.listElement??b.current;if(!C)return;x.set("activeIndex",null),R(C);const ne=At(C.scrollHeight,C.clientHeight),z=ut(C.scrollTop,ne),P=z===(m?0:ne),a=y.current;if(z!==C.scrollTop&&(C.scrollTop=z),P){w.clear();return}if(a.length>0){const h=k.current?.offsetHeight||0;C.scrollTop=jo(a,m,z,C.clientHeight,h,ne)}w.start(40,J)}w.start(40,J)},onMouseLeave(){w.clear()}},c],stateAttributesMapping:Ct});return W||u?K:null});function jo(e,t,s,o,i,f){if(t){let x=0;const b=s+i-me;for(let v=0;v<e.length;v+=1){const D=e[v];if(D&&D.offsetTop>=b){x=v;break}}const y=Math.max(0,x-1),R=e[y];return y<x&&R?ut(R.offsetTop-i,f):0}let r=e.length-1;const u=s+o-i+me;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>u){r=Math.max(0,x-1);break}}const c=Math.min(e.length-1,r+1),m=e[c];return c>r&&m?ut(m.offsetTop+m.offsetHeight-o+i,f):f}const To=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"down"})}),Co=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"up"})}),Ao=no;function Mo({className:e,...t}){return n.jsx(ao,{"data-slot":"select-value",className:Be("flex flex-1 text-left",e),...t})}function Eo({className:e,size:t="default",children:s,...o}){return n.jsxs(lo,{"data-slot":"select-trigger","data-size":t,className:Be("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,n.jsx(co,{render:n.jsx(on,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Po({className:e,children:t,side:s="bottom",sideOffset:o=4,align:i="center",alignOffset:f=0,alignItemWithTrigger:r=!0,...u}){return n.jsx(uo,{children:n.jsx(po,{side:s,sideOffset:o,align:i,alignOffset:f,alignItemWithTrigger:r,className:"isolate z-50",children:n.jsxs(bo,{"data-slot":"select-content","data-align-trigger":r,className:Be("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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-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),...u,children:[n.jsx(Vo,{}),n.jsx(yo,{children:t}),n.jsx(ko,{})]})})})}function No({className:e,children:t,...s}){return n.jsxs(So,{"data-slot":"select-item",className:Be("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[n.jsx(Io,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),n.jsx(wo,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Cs,{className:"pointer-events-none"})})]})}function Vo({className:e,...t}){return n.jsx(Co,{"data-slot":"select-scroll-up-button",className:Be("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx($s,{})})}function ko({className:e,...t}){return n.jsx(To,{"data-slot":"select-scroll-down-button",className:Be("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(on,{})})}function Lo(){const e=rn(),t=Xt(e.user.role,"people"),s=yn(e.user.role),o=Ot(Lt.members()),i=Ot(Lt.invites()),[f,r]=l.useState(!1),u=e.limits.members.limit,c=u!==null&&e.limits.members.used>=u;return n.jsxs("div",{className:"p-7",children:[n.jsx(ks,{title:"Members",sub:`${t?"Only owners change roles or remove people.":"Admins invite members. Ask an owner to change a role or remove someone."}${u!==null?` ${e.limits.members.used} of ${u} members.`:""}`,actions:s.length?n.jsxs(He,{onClick:()=>r(!0),disabled:c,title:c?`This studio's plan allows ${u} members.`:void 0,children:[n.jsx(_s,{}),"Invite"]}):void 0}),n.jsx(Jt,{className:"max-w-[1040px] overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"Name"}),n.jsx(Ie,{children:"Email"}),n.jsx(Ie,{children:"Role"}),t&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:(o.data?.data??[]).map(m=>n.jsx(Fo,{m,owner:t},m.email))})]})}),n.jsx(Oo,{}),(i.data?.data.length??0)>0&&n.jsx(Do,{invites:i.data.data,roles:s}),n.jsxs("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:["People join through an invite link and choose their own password. A forgotten one is reset on the server with ",n.jsx("code",{className:"font-mono text-[12px]",children:"snagset passwd"}),"."]}),s.length>0&&n.jsx(Bo,{open:f,onOpenChange:r,mail:i.data?.mail??!1,roles:s})]})}const gn=e=>new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short"}),ft={owner:"Owner",admin:"Admin",member:"Member"};function Oo(){return n.jsx("dl",{className:"m-0 mt-3 grid max-w-[1040px] grid-cols-[70px_1fr] gap-x-3 gap-y-1 text-[12.5px]","aria-label":"Roles",children:it.map(e=>n.jsxs("div",{className:"contents",children:[n.jsx("dt",{className:"font-medium",children:ft[e]}),n.jsx("dd",{className:"m-0 text-muted-foreground",children:Kt[e]})]},e))})}function Do({invites:e,roles:t}){const s=Hs(),o=t.length>0;return n.jsxs("section",{className:"mt-6 max-w-[1040px]","aria-labelledby":"pending-invites",children:[n.jsx("div",{id:"pending-invites",className:"mb-2",children:n.jsx(Ls,{children:"Pending invites"})}),n.jsx(Jt,{className:"overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"For"}),n.jsx(Ie,{children:"Role"}),n.jsx(Ie,{children:"Invited by"}),n.jsx(Ie,{children:"Expires"}),o&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:e.map(i=>n.jsxs(ct,{children:[n.jsx(je,{className:i.email?"":"text-muted-foreground",children:i.email??"Anyone with the link"}),n.jsx(je,{className:"capitalize",children:i.role}),n.jsx(je,{className:"text-muted-foreground",children:i.createdBy?i.createdBy.name||i.createdBy.email:"—"}),n.jsx(je,{className:"text-muted-foreground",children:gn(i.expiresAt)}),o&&n.jsx(je,{className:"text-right",children:t.includes(i.role)&&n.jsx(He,{variant:"ghost",size:"sm","aria-label":`Revoke the invite for ${i.email??"anyone with the link"}`,disabled:s.isPending&&s.variables===i.id,onClick:()=>s.mutate(i.id),children:"Revoke"})})]},i.id))})]})})]})}function Fo({m:e,owner:t}){const s=Ds(),o=Fs(),[i,f]=l.useState(!1);return n.jsxs(ct,{children:[n.jsx(je,{children:n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsx(Un,{className:"size-6",children:n.jsx(_n,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:Os(e.name,e.email)})}),n.jsx("span",{className:"font-medium",children:e.name||e.email}),e.you&&n.jsx(zn,{variant:"outline",className:"text-[11px]",children:"you"})]})}),n.jsx(je,{className:"text-muted-foreground",children:e.email}),n.jsx(je,{children:t?n.jsxs(Ao,{items:it.map(r=>({value:r,label:ft[r]})),value:e.role,onValueChange:r=>r&&r!==e.role&&s.mutate({email:e.email,role:r}),children:[n.jsx(Eo,{size:"sm","aria-label":`Role for ${e.email}`,className:"min-w-[104px] bg-card",children:n.jsx(Mo,{})}),n.jsx(Po,{children:it.map(r=>n.jsx(No,{value:r,children:ft[r]},r))})]}):n.jsx("span",{className:"capitalize",children:e.role})}),t&&n.jsxs(je,{className:"text-right",children:[!e.you&&n.jsx(He,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${e.email}`,onClick:()=>f(!0),children:n.jsx(fs,{})}),n.jsx(js,{open:i,onOpenChange:f,title:`Remove ${e.name||e.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:o.isPending,onConfirm:()=>{f(!1),o.mutate(e.email)}})]})]})}const Ho=wn({email:In([jn(""),Tn().trim().email("An email address, or leave it empty")]),role:Rn(it)});function Bo({open:e,onOpenChange:t,mail:s,roles:o}){const i=Bs(),f=Us(),[r,u]=l.useState(""),[c,m]=l.useState(null),[x,b]=l.useState(null),{register:y,handleSubmit:R,formState:v,reset:D,watch:S}=Cn({resolver:An(Ho),defaultValues:{role:"member",email:""}}),_=S("role"),N=w=>{t(w),w||(m(null),b(null),u(""),f.reset(),D())},I=R(async w=>{u("");try{m(await i.mutateAsync({role:w.role,...w.email?{email:w.email}:{}}))}catch(k){u(kt(k))}}),j=async()=>{if(c){u("");try{b((await f.mutateAsync({id:c.invite.id,token:c.token})).to)}catch(w){u(kt(w))}}},V=(c?.mail??s)&&!!c?.invite.email;return n.jsx(ps,{open:e,onOpenChange:N,children:n.jsx(ms,{children:c?n.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[n.jsxs(Dt,{children:[n.jsx(Ft,{children:"Invite link"}),n.jsxs(Ht,{children:[c.invite.email?`${c.invite.email} can`:"Anyone with this link can"," join as ",Sn(c.invite.role)," ","until ",gn(c.invite.expiresAt),". It works once, and this is the only time it is shown."]})]}),r&&n.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:r}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"invite-url",children:c.url}),n.jsx(Ts,{text:c.url,label:"Copy link",withText:!0})]}),V&&(x?n.jsxs("p",{role:"status",className:"m-0 text-[13px] [overflow-wrap:anywhere] text-muted-foreground",children:["Sent to ",x,"."]}):n.jsxs(He,{type:"button",variant:"outline",className:"max-w-full min-w-0 self-start",title:c.invite.email?`Send by email to ${c.invite.email}`:void 0,loading:f.isPending,onClick:()=>void j(),children:[n.jsx(Ws,{}),n.jsx("span",{className:"min-w-0 truncate",children:f.isPending?"Sending…":`Send by email to ${c.invite.email}`})]})),n.jsx(Bt,{children:n.jsx(He,{type:"button",onClick:()=>N(!1),children:"Done"})})]}):n.jsxs("form",{onSubmit:I,className:"flex flex-col gap-4",noValidate:!0,children:[n.jsxs(Dt,{children:[n.jsx(Ft,{children:"Invite someone"}),n.jsx(Ht,{children:"You get a link to send them. Whoever opens it chooses their own name and password, and is signed in. It works once and lasts seven days."})]}),r&&n.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:r}),n.jsxs("fieldset",{disabled:v.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(_t,{htmlFor:"invite-role",children:"Role"}),n.jsx(Xs,{id:"invite-role",className:"w-full",...y("role"),children:["member","admin","owner"].filter(w=>o.includes(w)).map(w=>n.jsx("option",{value:w,children:ft[w]},w))}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground","data-testid":"invite-role-summary",children:Kt[_]??""})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs(_t,{htmlFor:"invite-email",children:["Email ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),n.jsx(Is,{id:"invite-email",type:"email",autoComplete:"off","aria-invalid":!!v.errors.email,...y("email")}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:v.errors.email?.message??(s?"Given, only that address can use the link, and you can mail it to them.":"Given, only that address can use the link.")})]}),n.jsxs(Bt,{children:[n.jsx(He,{type:"button",variant:"outline",onClick:()=>N(!1),children:"Cancel"}),n.jsx(He,{type:"submit",loading:v.isSubmitting,children:v.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}const dr=()=>Xt(rn().user.role,"settings")?n.jsx(Lo,{}):n.jsx(Vs,{title:"Members"});export{dr as component};
11
+ */const qs=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Ws=Wt("mail",qs);function Ys(e){const{open:t=!1,onOpenChange:s,elements:o={}}=e,i=fs(),f=$n()!=null,r=Yt(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Wn,floatingId:i,syncOnly:!1,nested:f})).current;return xe(()=>{const u={open:t,floatingId:i};o.reference!==void 0&&(u.referenceElement=o.reference,u.domReferenceElement=xn(o.reference)?o.reference:null),o.floating!==void 0&&(u.floatingElement=o.floating),r.update(u)},[t,i,o.reference,o.floating,r]),r.context.onOpenChange=s,r.context.nested=f,r}function Gs(e){const[t,s]=l.useState({current:e,previous:null});return Object.is(e,t.current)||s({current:e,previous:t.current}),t.previous}const Xs=l.createContext(void 0),Ks={disableStyleElements:!1};function Js(){return l.useContext(Xs)??Ks}function Qs({className:e,...t}){return n.jsx("select",{className:Be("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",e),...t})}function Zs(e){const t=l.useRef(!0);t.current&&(t.current=!1,e())}const ln=l.createContext(null);function be(){const e=l.useContext(ln);if(e===null)throw new Error(jt(60));return e}const eo=(e,t)=>Object.is(e,t);function Ye(e,t,s){return e==null||t==null?Object.is(e,t):s(e,t)}function lt(e,t,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ye(o,t,s))}function to(e,t,s){return e.filter(o=>!Ye(t,o,s))}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function no(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const s of t)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of t)if(s&&s.value==null&&s.label!=null)return!0;return!1}function cn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Rt(e)}function We(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Rt(e.value):Rt(e)}function un(e,t,s){function o(){return cn(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const i=t,f=an(i)?i.flatMap(r=>r.items):i;if(e==null||typeof e!="object"){const r=f.find(u=>u.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=f.find(u=>u&&u.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function so(e,t,s){return e.reduce((o,i,f)=>(f>0&&o.push(", "),o.push(n.jsx(l.Fragment,{children:un(i,t,s)},f)),o),[])}const d={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:s,itemToStringValue:o}=e;return t==null?!1:s&&Array.isArray(t)?t.length>0:We(t,o)!==""},hasNullItemLabel:(e,t)=>t?no(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const s=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(i=>Ye(t,i,s)):Ye(t,o,s)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function oo(e,t,s=(o,i)=>o===i){return e.length===t.length&&e.every((o,i)=>s(o,t[i]))}function Ke(e,t=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,s))}const me=1;function At(e,t){return Math.max(0,e-t)}function ut(e,t){if(t<=0)return 0;const s=Ke(e,0,t),o=s,i=t-s,f=o<=me,r=i<=me;return f&&r?o<=i?0:t:f?0:r?t:s}function ro(e){const{id:t,value:s,defaultValue:o=null,onValueChange:i,open:f,defaultOpen:r=!1,onOpenChange:u,name:c,form:m,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:R=!1,modal:v=!0,actionsRef:D,inputRef:S,onOpenChangeComplete:_,items:N,multiple:I=!1,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w=eo,highlightItemOnHover:k=!0,children:W}=e,{clearErrors:O}=ps(),{setDirty:ue,setTouched:Y,setFocused:le,validityData:K,setFilled:F,name:L,disabled:J,validation:C,validationMode:ne}=Zt(),z=en({id:t}),P=J||b,a=L??c,[h,Q]=Ut({controlled:s,default:I?o??Vt:o,name:"Select",state:"value"}),[H,se]=Ut({controlled:f,default:r,name:"Select",state:"open"}),g=l.useRef([]),T=l.useRef([]),B=l.useRef(null),ee=l.useRef(null),ve=l.useRef(0),M=l.useRef(null),G=l.useRef([]),$=l.useRef(!1),de=l.useRef(null),Z=l.useRef(null),oe=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=l.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:q}=Tt(H),{openMethod:X,triggerProps:ae}=Mn(H),E=Yt(()=>new Yn({id:z,labelId:void 0,modal:v,multiple:I,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,value:h,open:H,mounted:ie,transitionStatus:q,items:N,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ae=p(E,d.activeIndex),ye=p(E,d.selectedIndex),Se=p(E,d.triggerElement),ce=p(E,d.positionerElement),ke=Gs(X),Le=X??ke,te=l.useMemo(()=>I?"":We(h,V),[I,h,V]),mt=l.useMemo(()=>I&&Array.isArray(h)?h.map(A=>We(A,V)):We(h,V),[I,h,V]),Qe=Qt(Se),we=Fe(()=>mt);ms(Qe,z,h,we,!P,c);const gt=l.useRef(h),Ge=I?Array.isArray(h)&&h.length>0:h!=null&&te!=="";xe(()=>{F(Ge)},[Ge,F]),xe(function(){let U=h,Re=!1;if(I){const De=Array.isArray(h)?h:[];Re=De.length===0,U=De[De.length-1]}const Ne=Re?-1:lt(G.current,U,w),Ve=Ne===-1?null:Ne;Ve===null&&(Z.current=null),!H&&E.set("selectedIndex",Ve)},[I,H,h,w,E]);function ge(A){const U=K.initialValue;return Array.isArray(A)&&Array.isArray(U)?!oo(A,U,(Re,Ne)=>Ye(Re,Ne,w)):A!==U}Ms(h,()=>{O(a),ue(ge(h)),C.change(h)});const Ue=Fe((A,U)=>{u?.(A,U),!U.isCanceled&&(se(A),!A&&(U.reason===gs||U.reason===hs)&&(Y(!0),le(!1),ne==="onBlur"&&C.commit(h)))}),_e=Fe(()=>{fe(!1),E.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});pt({enabled:!D,open:H,ref:B,onComplete(){H||_e()}}),l.useImperativeHandle(D,()=>({unmount:_e}),[_e]);const Me=Fe((A,U)=>{i?.(A,U),!U.isCanceled&&Q(A)}),he=Fe(A=>{const U=At(A.scrollHeight,A.clientHeight),Re=ut(A.scrollTop,U),Ne=Re>0,Ve=Re<U;E.set("scrollUpArrowVisible",Ne),E.set("scrollDownArrowVisible",Ve)}),Ee=Ys({open:H,onOpenChange:Ue,elements:{reference:Se,floating:ce}}),ze=En(Ee,{enabled:!y&&!P,event:"mousedown"}),$e=Gn(Ee),Pe=Pn(Ee,{enabled:!y&&!P,listRef:g,activeIndex:Ae,selectedIndex:ye,disabledIndices:Vt,onNavigate(A){A===null&&!H||E.set("activeIndex",A)},focusItemOnHover:k}),Oe=Nn(Ee,{enabled:!y&&!P&&(H||!I),listRef:T,activeIndex:Ae,selectedIndex:ye,disabledIndices:A=>js(g.current[A]),onMatch(A){H?E.set("activeIndex",A):Me(G.current[A],Te(at))},onTyping(A){$.current=A}}),Ze=l.useMemo(()=>St(Oe.reference,Pe.reference,$e.reference,ze.reference,ae),[ze.reference,Oe.reference,Pe.reference,$e.reference,ae]),et=l.useMemo(()=>St(Xn,Oe.floating,Pe.floating,$e.floating),[Oe.floating,Pe.floating,$e.floating]),tt=Pe.item??bn;Zs(()=>{E.update({popupProps:et,triggerProps:Ze})}),E.useSyncedValues({id:z,modal:v,multiple:I,value:h,open:H,mounted:ie,transitionStatus:q,popupProps:et,triggerProps:Ze,items:N,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,openMethod:Le});const pe=l.useMemo(()=>({store:E,floatingContext:Ee,required:R,disabled:P,readOnly:y,multiple:I,highlightItemOnHover:k,setValue:Me,setOpen:Ue,listRef:g,popupRef:B,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:ve,itemProps:tt,valueRef:M,valuesRef:G,labelsRef:T,typingRef:$,selectionRef:oe,firstItemTextRef:de,selectedItemTextRef:Z,validation:C,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:re,initialValueRef:gt}),[E,Ee,R,P,y,I,k,Me,Ue,tt,C,_,he]),qe=vn(S,C.inputRef),Xe=I?void 0:a,ht=l.useMemo(()=>!I||!Array.isArray(h)||!a?null:h.map(A=>{const U=We(A,V);return n.jsx("input",{type:"hidden",form:m,name:a,value:U,disabled:P},U)}),[I,h,m,a,V,P]);return n.jsxs(ln.Provider,{value:pe,children:[W,n.jsx("input",{...C.getValidationProps(P,{onFocus(){E.state.triggerElement?.focus({focusVisible:!0})},onChange(A){if(A.nativeEvent.defaultPrevented||P||y)return;const U=A.currentTarget.value,Re=Te(at,A.nativeEvent);function Ne(){if(I)return;const Ve=U.toLowerCase();let De=G.current.findIndex(xt=>We(xt,V).toLowerCase()===Ve||cn(xt,j).toLowerCase()===Ve);De===-1&&(De=G.current.findIndex((xt,hn)=>{const Nt=T.current[hn];return Nt!=null&&Nt.toLowerCase()===Ve}));const Pt=G.current[De];Pt!=null&&Me(Pt,Re)}E.set("forceMount",!0),queueMicrotask(Ne)}}),id:z&&Xe==null?`${z}-hidden-input`:void 0,form:m,name:Xe,autoComplete:x,value:te,disabled:P,required:R&&!(I&&Ge),readOnly:y,ref:qe,style:a?Kn:Jn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ht]})}function lo(e,t){return e??t}const io=400,ao={...Zn,...bs,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},co=l.forwardRef(function(t,s){const{render:o,className:i,id:f,disabled:r=!1,nativeButton:u=!0,style:c,...m}=t,{setTouched:x,setFocused:b,validationMode:y,state:R,disabled:v}=Zt(),{labelId:D}=xs(),{store:S,setOpen:_,selectionRef:N,validation:I,readOnly:j,required:V,alignItemWithTriggerActiveRef:w,disabled:k}=be(),W=v||k||r,O=p(S,d.open),ue=p(S,d.mounted),Y=p(S,d.value),le=p(S,d.triggerProps),K=p(S,d.positionerElement),F=p(S,d.listElement),L=p(S,d.popupSide),J=p(S,d.id),C=p(S,d.labelId),ne=p(S,d.hasSelectedValue),z=ue&&K?L:null,P=f??J,a=lo(D,C);en({id:P});const h=Qt(K),Q=l.useRef(null),{getButtonProps:H,buttonRef:se}=Gt({disabled:W,native:u}),g=S.useStateSetter("triggerElement"),T=rt(),B=rt(),ee=rt();l.useEffect(()=>{if(O)return ee.start(io,()=>{N.current.allowUnselectedMouseUp=!0,N.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};N.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},B.clear()},[O,N,B,ee]);const ve=St(le,{id:P,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?F?.id??Qn(K)?.id:void 0,"aria-labelledby":a,"aria-readonly":j||void 0,"aria-required":V||void 0,tabIndex:W?-1:0,onFocus($){b(!0),O&&w.current&&_(!1,Te(at,$.nativeEvent)),T.start(0,()=>{S.set("forceMount",!0)})},onBlur($){vt(K,$.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&I.commit(Y))},onMouseDown($){if(O)return;const de=wt($.currentTarget);function Z(oe){if(!Q.current)return;const re=oe.target;vt(Q.current,re)||vt(h.current,re)||Vn(oe,Q.current)||_(!1,Te(vs,oe))}B.start(0,()=>{de.addEventListener("mouseup",Z,{once:!0})})}},m,H),M=I.getValidationProps(W,ve);M.role="combobox";const G={...R,open:O,disabled:W,value:Y,readOnly:j,popupSide:z,placeholder:!ne};return Ce("button",t,{ref:[s,Q,se,g],state:G,stateAttributesMapping:ao,props:M})}),uo={value:()=>null},fo=l.forwardRef(function(t,s){const{className:o,render:i,children:f,placeholder:r,style:u,...c}=t,{store:m,valueRef:x}=be(),b=p(m,d.value),y=p(m,d.items),R=p(m,d.itemToStringLabel),v=p(m,d.hasSelectedValue),D=!v&&r!=null&&f==null,S=p(m,d.hasNullItemLabel,D),_={value:b,placeholder:!v};let N=null;return typeof f=="function"?N=f(b):f!=null?N=f:D&&!S?N=r:Array.isArray(b)?N=so(b,y,R):N=un(b,y,R),Ce("span",t,{state:_,ref:[s,x],props:[{children:N},c],stateAttributesMapping:uo})}),po=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u}=be(),m={open:p(u,d.open)};return Ce("span",t,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:es})}),mo=l.forwardRef(function(t,s){const{store:o}=be(),i=p(o,d.mounted),f=p(o,d.forceMount);return i||f?n.jsx(ts,{ref:s,...t}):null}),dn=l.createContext(void 0);function Mt(){const e=l.useContext(dn);if(!e)throw new Error(jt(59));return e}function dt(e,t){e&&Object.assign(e.style,t)}const fn={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},go={position:"fixed"},ho=l.forwardRef(function(t,s){const{anchor:o,className:i,render:f,positionMethod:r,side:u,align:c,sideOffset:m,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:R,sticky:v,disableAnchorTracking:D,alignItemWithTrigger:S=!0,collisionAvoidance:_=ns,style:N,...I}=t,{store:j,listRef:V,labelsRef:w,alignItemWithTriggerActiveRef:k,selectedItemTextRef:W,valuesRef:O,initialValueRef:ue,popupRef:Y,setValue:le,floatingContext:K}=be(),F=p(j,d.open),L=p(j,d.mounted),J=p(j,d.modal),C=p(j,d.value),ne=p(j,d.openMethod),z=p(j,d.positionerElement),P=p(j,d.triggerElement),a=p(j,d.isItemEqualToValue),h=p(j,d.transitionStatus),Q=l.useRef(null),H=l.useRef(null),[se,g]=l.useState(S),T=L&&se&&ne!=="touch";!L&&se!==S&&g(S),l.useImperativeHandle(k,()=>T),kn((T||J)&&F,ne==="touch",z,P);const B=Ln({anchor:o,floatingRootContext:K,positionMethod:r,mounted:L,side:u,sideOffset:m,align:c,alignOffset:x,arrowPadding:R,collisionBoundary:b,collisionPadding:y,sticky:v,disableAnchorTracking:D??T,collisionAvoidance:_,keepMounted:!0}),ee=T?"none":B.side,ve=T?go:B.positionerStyles,M={open:F,side:ee,align:B.align,anchorHidden:B.anchorHidden};xe(()=>{j.set("popupSide",B.side)},[j,B.side]);const G=j.useStateSetter("positionerElement"),$=On(t,M,{styles:ve,transitionStatus:h,props:I,refs:[s,G],hidden:!L,inert:!F}),de=l.useRef(0),Z=Fe(re=>{if(O.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Te(at);if(ie!==0&&!j.state.multiple&&C!==null&&lt(O.current,C,a)===-1){const X=ue.current,E=X!=null&&lt(O.current,X,a)!==-1?X:null;le(E,fe),E===null&&(j.set("selectedIndex",null),W.current=null)}if(ie!==0&&j.state.multiple&&Array.isArray(C)){const q=C.filter(X=>lt(O.current,X,a)!==-1);q.length!==C.length&&(le(q,fe),q.length===0&&(j.set("selectedIndex",null),W.current=null))}if(F&&T){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const q={height:""};dt(z,q),dt(Y.current,q)}}),oe=l.useMemo(()=>({...B,side:ee,alignItemWithTriggerActive:T,setControlledAlignItemWithTrigger:g,scrollUpArrowRef:Q,scrollDownArrowRef:H}),[B,ee,T,g]);return n.jsx(Es,{elementsRef:V,labelsRef:w,onMapChange:Z,children:n.jsxs(dn.Provider,{value:oe,children:[L&&J&&n.jsx(ss,{inert:Ts(!F),cutout:P}),$]})})}),nt="base-ui-disable-scrollbar",It={className:nt,getElement(e){return n.jsx("style",{nonce:e,href:nt,precedence:"base-ui:low",children:`.${nt}{scrollbar-width:none}.${nt}::-webkit-scrollbar{display:none}`})}},xo={...is,...Ct},bo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,finalFocus:r,...u}=t,{store:c,popupRef:m,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:R,selectedItemTextRef:v,multiple:D,handleScrollArrowVisibility:S,scrollHandlerRef:_,listRef:N,highlightItemOnHover:I,floatingContext:j}=be(),{side:V,align:w,alignItemWithTriggerActive:k,isPositioned:W,setControlledAlignItemWithTrigger:O}=Mt(),ue=Dn()!=null,Y=Ps(),{nonce:le,disableStyleElements:K}=Js(),F=p(c,d.id),L=p(c,d.open),J=p(c,d.openMethod),C=p(c,d.mounted),ne=p(c,d.popupProps),z=p(c,d.transitionStatus),P=p(c,d.triggerElement),a=p(c,d.positionerElement),h=p(c,d.listElement),Q=l.useRef(!1),H=l.useRef(!1),se=l.useRef({}),g=Cs(),T=Fe(M=>{if(!a||!m.current||!H.current)return;const G=a.style.top==="0px",$=a.style.bottom==="0px";if(Q.current||!k||!G&&!$){S(M);return}const de=$t(a),Z=Je(a.getBoundingClientRect().height,"y",de),oe=wt(a),re=bt(a),ie=re.getComputedStyle(a),fe=parseFloat(ie.marginTop),q=parseFloat(ie.marginBottom),X=zt(re.getComputedStyle(m.current)),ae=Math.min(oe.documentElement.clientHeight-fe-q,X),E=M.scrollTop,Ae=st(M);let ye=null;const Se=te=>{a.style.height=`${te}px`},ce=G?Ae-E:E,ke=Math.min(Z+ce,ae);if(ce<=me){const te=Ke(ce,0,ae-Z);te>0&&Se(Z+te),M.scrollTop=G?Ae:0,ae-(Z+te)<=me&&(Q.current=!0),S(M);return}if(ae-ke>me)ye=G?1/0:0;else if($&&E<Ae){const te=Z+ce-ae;ye=E-(ce-te)}const Le=Math.ceil(ke);if(Le!==0&&Se(Le),ye!=null){const te=Ke(ye,0,st(M));Math.abs(M.scrollTop-te)>me&&(M.scrollTop=te)}Le>=ae-me&&(Q.current=!0),S(M)});l.useImperativeHandle(_,()=>T,[T]),pt({open:L,ref:m,onComplete(){L&&x?.(!0)}});const B={open:L,transitionStatus:z,side:V,align:w};xe(()=>{!a||!m.current||Object.keys(se.current).length||(se.current={top:a.style.top||"0",left:a.style.left||"0",right:a.style.right,height:a.style.height,bottom:a.style.bottom,minHeight:a.style.minHeight,maxHeight:a.style.maxHeight,marginTop:a.style.marginTop,marginBottom:a.style.marginBottom})},[m,a]),xe(()=>{L||k||(H.current=!1,Q.current=!1,dt(a,se.current))},[L,k,a,m]),xe(()=>{const M=m.current;if(!L||!P||!a||!M||k&&!W||c.state.transitionStatus==="ending")return;if(H.current=!0,M.style.removeProperty("--transform-origin"),!k){g.request(()=>S(h||M));return}const G=vo(M);try{let $=v.current;$?.isConnected||($=!d.hasSelectedValue(c.state)&&R.current?.isConnected?R.current:null);const de=y.current,Z=bt(a),oe=Z.getComputedStyle(a),re=Z.getComputedStyle(M),ie=wt(P),fe=$t(P),q=ot(P.getBoundingClientRect(),fe),X=ot(a.getBoundingClientRect(),fe),ae=q.height,E=h||M,Ae=E.scrollHeight,ye=parseFloat(re.borderBottomWidth),Se=parseFloat(oe.marginTop)||10,ce=parseFloat(oe.marginBottom)||10,ke=parseFloat(oe.minHeight)||100,Le=zt(re),te=5,mt=5,Qe=20,we=ie.documentElement.clientHeight-Se-ce,gt=ie.documentElement.clientWidth,Ge=we-q.bottom+ae;let ge,Ue=Y==="rtl"?q.right-X.width:q.left,_e=0;if($&&de){const pe=ot(de.getBoundingClientRect(),fe);ge=ot($.getBoundingClientRect(),fe),Ue=X.left+(Y==="rtl"?pe.right-ge.right:pe.left-ge.left);const qe=pe.top-q.top+pe.height/2;_e=ge.top-X.top+ge.height/2-qe}const Me=Ge+_e+ce+ye;let he=Math.min(we,Me);const Ee=we-Se-ce,ze=Me-he,$e=gt-mt;a.style.left=`${Ke(Ue,te,$e-X.width)}px`,a.style.height=`${he}px`,a.style.maxHeight="none",a.style.marginTop=`${Se}px`,a.style.marginBottom=`${ce}px`,M.style.height="100%";const Pe=st(E),Oe=ze>=Pe-me;Oe&&(he=Math.min(we,X.height)-(ze-Pe));const Ze=q.top<Qe||q.bottom>we-Qe||Math.ceil(he)+me<Math.min(Ae,ke),et=(Z.visualViewport?.scale??1)!==1&&os;if(Ze||et){dt(a,se.current),O(!1);return}const tt=Math.max(ke,he);if(Oe){const pe=Math.max(0,we-Me);a.style.top=X.height>=Ee?"0":`${pe}px`,a.style.height=`${he}px`,E.scrollTop=st(E)}else a.style.bottom="0",E.scrollTop=ze;if(ge){const pe=X.top,qe=X.height,Xe=ge.top+ge.height/2,ht=Ke(qe>0?(Xe-pe)/qe*100:50,0,100);M.style.setProperty("--transform-origin",`50% ${ht}%`)}(tt===we||he>=Le)&&(Q.current=!0),S(E),I&&c.state.selectedIndex===null&&c.state.activeIndex===null&&N.current[0]!=null&&c.set("activeIndex",0)}finally{G()}},[c,L,a,P,y,R,v,m,S,k,O,g,h,N,I,Y,W]),l.useEffect(()=>{if(!k||!a||!L)return;const M=bt(a);function G($){b(!1,Te(ys,$))}return rs(M,"resize",G)},[b,k,a,L]);const ee={...h?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":D||void 0,id:`${F}-list`},onKeyDown(M){ue&&As.has(M.key)&&M.stopPropagation()},onScroll(M){h||T(M.currentTarget)},...k&&{style:h?{height:"100%"}:fn},className:!h&&k?It.className:void 0},ve=Ce("div",t,{ref:[s,m],state:B,stateAttributesMapping:xo,props:[ne,ee,Bn(z),u]});return n.jsxs(l.Fragment,{children:[!K&&It.getElement(le),n.jsx(ls,{context:j,modal:!1,disabled:!C,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:ve})]})});function zt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function st(e){return At(e.scrollHeight,e.clientHeight)}function $t(e){return Fn.getScale(e)}function Je(e,t,s){return e/s[t]}function ot(e,t){return Hn({x:Je(e.x,"x",t),y:Je(e.y,"y",t),width:Je(e.width,"x",t),height:Je(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function vo(e){const{style:t}=e,s={};for(const[o,i]of qt)s[o]=t.getPropertyValue(o),t.setProperty(o,i,"important");return()=>{for(const[o]of qt){const i=s[o];i?t.setProperty(o,i):t.removeProperty(o)}}}const yo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u,scrollHandlerRef:c,multiple:m}=be(),{alignItemWithTriggerActive:x}=Mt(),b=p(u,d.hasScrollArrows),y=p(u,d.openMethod),v={id:`${p(u,d.id)}-list`,role:"listbox","aria-multiselectable":m||void 0,onScroll(S){c.current?.(S.currentTarget)},...x&&{style:fn},className:b&&y!=="touch"?It.className:void 0},D=u.useStateSetter("listElement");return Ce("div",t,{ref:[s,D],props:[v,r]})}),pn=l.createContext(void 0);function Et(){const e=l.useContext(pn);if(!e)throw new Error(jt(57));return e}const So=l.memo(l.forwardRef(function(t,s){const{render:o,className:i,style:f,value:r=null,label:u,disabled:c=!1,nativeButton:m=!1,...x}=t,b=l.useRef(null),y=Ns({guess:!0,label:u,textRef:b}),{store:R,itemProps:v,setOpen:D,setValue:S,selectionRef:_,typingRef:N,valuesRef:I,multiple:j,selectedItemTextRef:V,disabled:w,readOnly:k}=be(),W=w||c,O=p(R,d.isActive,y.index),ue=p(R,d.open),Y=p(R,d.isSelected,r),le=p(R,d.isSelectedByFocus,y.index),K=p(R,d.isItemEqualToValue),F=y.index,L=l.useRef(null);xe(()=>{const g=I.current;return g[F]=r,()=>{delete g[F]}},[F,r,I]),xe(()=>{const g=R.state.value;let T=g;j&&Array.isArray(g)&&(T=g.length>0?g[g.length-1]:void 0),T!==void 0&&Ye(r,T,K)&&(R.set("selectedIndex",F),b.current&&(V.current=b.current))},[F,j,K,R,r,V]);const J=l.useRef("mouse"),C=l.useRef(!1),{getButtonProps:ne,buttonRef:z}=Gt({disabled:W,focusableWhenDisabled:!0,native:m,composite:!0}),P={disabled:W,selected:Y,highlighted:O};function a(g){if(w||k)return;const T=R.state.value;if(j){const B=Array.isArray(T)?T:[],ee=Y?to(B,r,K):[...B,r];S(ee,Te(yt,g))}else S(r,Te(yt,g)),D(!1,Te(yt,g))}function h(){_.current.dragY=0}const Q={role:"option","aria-selected":Y,tabIndex:ue&&O?0:-1,onKeyDown(g){R.set("activeIndex",F),g.key===" "&&N.current&&g.preventDefault()},onClick(g){const T=J.current!=="touch",B=g.nativeEvent.pointerType,ee=T&&as(g.nativeEvent)&&(B!==void 0||O),ve=T&&!ee&&!C.current;C.current=!1,!(W||ve)&&a(g.nativeEvent)},onPointerEnter(g){J.current=g.pointerType},onPointerMove(g){if(g.pointerType==="mouse"&&g.buttons===1){const T=_.current;T.dragY+=g.movementY,T.dragY**2>=64&&(T.allowUnselectedMouseUp=!0)}},onPointerDown(g){J.current=g.pointerType,C.current=!0,h()},onMouseUp(){if(h(),W||J.current==="touch"||C.current)return;const g=!_.current.allowSelectedMouseUp&&Y,T=!_.current.allowUnselectedMouseUp&&!Y;g||T||(C.current=!0,L.current?.click(),C.current=!1)}},H=Ce("div",t,{ref:[z,s,y.ref,L],state:P,props:[v,Q,x,ne]}),se=l.useMemo(()=>({selected:Y,index:F,textRef:b,selectedByFocus:le}),[Y,F,b,le]);return n.jsx(pn.Provider,{value:se,children:H})})),wo=l.forwardRef(function(t,s){const{selected:o}=Et();return t.keepMounted||o?n.jsx(Ro,{...t,ref:s}):null}),Ro=l.memo(l.forwardRef((e,t)=>{const{render:s,className:o,style:i,keepMounted:f,...r}=e,{selected:u}=Et(),c=l.useRef(null),{transitionStatus:m,setMounted:x}=Tt(u),y=Ce("span",e,{ref:[t,c],state:{selected:u,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Ct});return pt({open:u,ref:c,onComplete(){u||x(!1)}}),y})),Io=l.memo(l.forwardRef(function(t,s){const{index:o,textRef:i,selectedByFocus:f}=Et(),{firstItemTextRef:r,selectedItemTextRef:u}=be(),{render:c,className:m,style:x,...b}=t,y=l.useCallback(v=>{v&&(o===0&&(r.current=v),f&&(u.current=v))},[r,u,o,f]);return Ce("div",t,{ref:[y,s,i],props:b})})),mn=l.forwardRef(function(t,s){const{render:o,className:i,style:f,direction:r,keepMounted:u,...c}=t,m=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:R,scrollArrowsMountedCountRef:v}=be(),{side:D,scrollDownArrowRef:S,scrollUpArrowRef:_}=Mt(),N=m?d.scrollUpArrowVisible:d.scrollDownArrowVisible,I=p(x,N),j=p(x,d.openMethod),V=I&&j!=="touch",w=rt(),k=m?_:S,{mounted:W,transitionStatus:O,setMounted:ue}=Tt(V);xe(()=>(v.current+=1,x.set("hasScrollArrows",!0),()=>{v.current=Math.max(0,v.current-1),v.current===0&&x.set("hasScrollArrows",!1)}),[x,v]),pt({open:V,ref:k,onComplete(){V||ue(!1)}});const K=Ce("div",t,{ref:[s,k],state:{direction:r,visible:V,side:D,transitionStatus:O},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(L){if(L.movementX===0&&L.movementY===0||w.isStarted())return;x.set("activeIndex",null);function J(){const C=x.state.listElement??b.current;if(!C)return;x.set("activeIndex",null),R(C);const ne=At(C.scrollHeight,C.clientHeight),z=ut(C.scrollTop,ne),P=z===(m?0:ne),a=y.current;if(z!==C.scrollTop&&(C.scrollTop=z),P){w.clear();return}if(a.length>0){const h=k.current?.offsetHeight||0;C.scrollTop=jo(a,m,z,C.clientHeight,h,ne)}w.start(40,J)}w.start(40,J)},onMouseLeave(){w.clear()}},c],stateAttributesMapping:Ct});return W||u?K:null});function jo(e,t,s,o,i,f){if(t){let x=0;const b=s+i-me;for(let v=0;v<e.length;v+=1){const D=e[v];if(D&&D.offsetTop>=b){x=v;break}}const y=Math.max(0,x-1),R=e[y];return y<x&&R?ut(R.offsetTop-i,f):0}let r=e.length-1;const u=s+o-i+me;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>u){r=Math.max(0,x-1);break}}const c=Math.min(e.length-1,r+1),m=e[c];return c>r&&m?ut(m.offsetTop+m.offsetHeight-o+i,f):f}const To=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"down"})}),Co=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"up"})}),Ao=ro;function Mo({className:e,...t}){return n.jsx(fo,{"data-slot":"select-value",className:Be("flex flex-1 text-left",e),...t})}function Eo({className:e,size:t="default",children:s,...o}){return n.jsxs(co,{"data-slot":"select-trigger","data-size":t,className:Be("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,n.jsx(po,{render:n.jsx(on,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Po({className:e,children:t,side:s="bottom",sideOffset:o=4,align:i="center",alignOffset:f=0,alignItemWithTrigger:r=!0,...u}){return n.jsx(mo,{children:n.jsx(ho,{side:s,sideOffset:o,align:i,alignOffset:f,alignItemWithTrigger:r,className:"isolate z-50",children:n.jsxs(bo,{"data-slot":"select-content","data-align-trigger":r,className:Be("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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-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),...u,children:[n.jsx(Vo,{}),n.jsx(yo,{children:t}),n.jsx(ko,{})]})})})}function No({className:e,children:t,...s}){return n.jsxs(So,{"data-slot":"select-item",className:Be("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[n.jsx(Io,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),n.jsx(wo,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Is,{className:"pointer-events-none"})})]})}function Vo({className:e,...t}){return n.jsx(Co,{"data-slot":"select-scroll-up-button",className:Be("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx($s,{})})}function ko({className:e,...t}){return n.jsx(To,{"data-slot":"select-scroll-down-button",className:Be("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(on,{})})}function Lo(){const e=rn(),t=Xt(e.user.role,"people"),s=yn(e.user.role),o=Ot(Lt.members()),i=Ot(Lt.invites()),[f,r]=l.useState(!1),u=e.limits.members.limit,c=u!==null&&e.limits.members.used>=u;return n.jsxs("div",{className:"p-7",children:[n.jsx(ks,{title:"Members",sub:`${t?"Only owners change roles or remove people.":"Admins invite members. Ask an owner to change a role or remove someone."}${u!==null?` ${e.limits.members.used} of ${u} members.`:""}`,actions:s.length?n.jsxs(He,{onClick:()=>r(!0),disabled:c,title:c?`This studio's plan allows ${u} members.`:void 0,children:[n.jsx(_s,{}),"Invite"]}):void 0}),n.jsx(Jt,{className:"max-w-[1040px] overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"Name"}),n.jsx(Ie,{children:"Email"}),n.jsx(Ie,{children:"Role"}),t&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:(o.data?.data??[]).map(m=>n.jsx(Fo,{m,owner:t},m.email))})]})}),n.jsx(Oo,{}),(i.data?.data.length??0)>0&&n.jsx(Do,{invites:i.data.data,roles:s}),n.jsxs("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:["People join through an invite link and choose their own password. A forgotten one is reset on the server with ",n.jsx("code",{className:"font-mono text-[12px]",children:"snagset passwd"}),"."]}),s.length>0&&n.jsx(Bo,{open:f,onOpenChange:r,mail:i.data?.mail??!1,roles:s})]})}const gn=e=>new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short"}),ft={owner:"Owner",admin:"Admin",member:"Member"};function Oo(){return n.jsx("dl",{className:"m-0 mt-3 grid max-w-[1040px] grid-cols-[70px_1fr] gap-x-3 gap-y-1 text-[12.5px]","aria-label":"Roles",children:it.map(e=>n.jsxs("div",{className:"contents",children:[n.jsx("dt",{className:"font-medium",children:ft[e]}),n.jsx("dd",{className:"m-0 text-muted-foreground",children:Kt[e]})]},e))})}function Do({invites:e,roles:t}){const s=Hs(),o=t.length>0;return n.jsxs("section",{className:"mt-6 max-w-[1040px]","aria-labelledby":"pending-invites",children:[n.jsx("div",{id:"pending-invites",className:"mb-2",children:n.jsx(Ls,{children:"Pending invites"})}),n.jsx(Jt,{className:"overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"For"}),n.jsx(Ie,{children:"Role"}),n.jsx(Ie,{children:"Invited by"}),n.jsx(Ie,{children:"Expires"}),o&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:e.map(i=>n.jsxs(ct,{children:[n.jsx(je,{className:i.email?"":"text-muted-foreground",children:i.email??"Anyone with the link"}),n.jsx(je,{className:"capitalize",children:i.role}),n.jsx(je,{className:"text-muted-foreground",children:i.createdBy?i.createdBy.name||i.createdBy.email:"—"}),n.jsx(je,{className:"text-muted-foreground",children:gn(i.expiresAt)}),o&&n.jsx(je,{className:"text-right",children:t.includes(i.role)&&n.jsx(He,{variant:"ghost",size:"sm","aria-label":`Revoke the invite for ${i.email??"anyone with the link"}`,disabled:s.isPending&&s.variables===i.id,onClick:()=>s.mutate(i.id),children:"Revoke"})})]},i.id))})]})})]})}function Fo({m:e,owner:t}){const s=Ds(),o=Fs(),[i,f]=l.useState(!1);return n.jsxs(ct,{children:[n.jsx(je,{children:n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsx(Un,{className:"size-6",children:n.jsx(_n,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:Os(e.name,e.email)})}),n.jsx("span",{className:"font-medium",children:e.name||e.email}),e.you&&n.jsx(zn,{variant:"outline",className:"text-[11px]",children:"you"})]})}),n.jsx(je,{className:"text-muted-foreground",children:e.email}),n.jsx(je,{children:t?n.jsxs(Ao,{items:it.map(r=>({value:r,label:ft[r]})),value:e.role,onValueChange:r=>r&&r!==e.role&&s.mutate({email:e.email,role:r}),children:[n.jsx(Eo,{size:"sm","aria-label":`Role for ${e.email}`,className:"min-w-[104px] bg-card",children:n.jsx(Mo,{})}),n.jsx(Po,{children:it.map(r=>n.jsx(No,{value:r,children:ft[r]},r))})]}):n.jsx("span",{className:"capitalize",children:e.role})}),t&&n.jsxs(je,{className:"text-right",children:[!e.you&&n.jsx(He,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${e.email}`,onClick:()=>f(!0),children:n.jsx(cs,{})}),n.jsx(ws,{open:i,onOpenChange:f,title:`Remove ${e.name||e.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:o.isPending,onConfirm:()=>{f(!1),o.mutate(e.email)}})]})]})}const Ho=wn({email:In([jn(""),Tn().trim().email("An email address, or leave it empty")]),role:Rn(it)});function Bo({open:e,onOpenChange:t,mail:s,roles:o}){const i=Bs(),f=Us(),[r,u]=l.useState(""),[c,m]=l.useState(null),[x,b]=l.useState(null),{register:y,handleSubmit:R,formState:v,reset:D,watch:S}=Cn({resolver:An(Ho),defaultValues:{role:"member",email:""}}),_=S("role"),N=w=>{t(w),w||(m(null),b(null),u(""),f.reset(),D())},I=R(async w=>{u("");try{m(await i.mutateAsync({role:w.role,...w.email?{email:w.email}:{}}))}catch(k){u(kt(k))}}),j=async()=>{if(c){u("");try{b((await f.mutateAsync({id:c.invite.id,token:c.token})).to)}catch(w){u(kt(w))}}},V=(c?.mail??s)&&!!c?.invite.email;return n.jsx(us,{open:e,onOpenChange:N,children:n.jsx(ds,{children:c?n.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[n.jsxs(Dt,{children:[n.jsx(Ft,{children:"Invite link"}),n.jsxs(Ht,{children:[c.invite.email?`${c.invite.email} can`:"Anyone with this link can"," join as ",Sn(c.invite.role)," ","until ",gn(c.invite.expiresAt),". It works once, and this is the only time it is shown."]})]}),r&&n.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:r}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"invite-url",children:c.url}),n.jsx(Rs,{text:c.url,label:"Copy link",withText:!0})]}),V&&(x?n.jsxs("p",{role:"status",className:"m-0 text-[13px] [overflow-wrap:anywhere] text-muted-foreground",children:["Sent to ",x,"."]}):n.jsxs(He,{type:"button",variant:"outline",className:"max-w-full min-w-0 self-start",title:c.invite.email?`Send by email to ${c.invite.email}`:void 0,loading:f.isPending,onClick:()=>void j(),children:[n.jsx(Ws,{}),n.jsx("span",{className:"min-w-0 truncate",children:f.isPending?"Sending…":`Send by email to ${c.invite.email}`})]})),n.jsx(Bt,{children:n.jsx(He,{type:"button",onClick:()=>N(!1),children:"Done"})})]}):n.jsxs("form",{onSubmit:I,className:"flex flex-col gap-4",noValidate:!0,children:[n.jsxs(Dt,{children:[n.jsx(Ft,{children:"Invite someone"}),n.jsx(Ht,{children:"You get a link to send them. Whoever opens it chooses their own name and password, and is signed in. It works once and lasts seven days."})]}),r&&n.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:r}),n.jsxs("fieldset",{disabled:v.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(_t,{htmlFor:"invite-role",children:"Role"}),n.jsx(Qs,{id:"invite-role",className:"w-full",...y("role"),children:["member","admin","owner"].filter(w=>o.includes(w)).map(w=>n.jsx("option",{value:w,children:ft[w]},w))}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground","data-testid":"invite-role-summary",children:Kt[_]??""})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs(_t,{htmlFor:"invite-email",children:["Email ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),n.jsx(Ss,{id:"invite-email",type:"email",autoComplete:"off","aria-invalid":!!v.errors.email,...y("email")}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:v.errors.email?.message??(s?"Given, only that address can use the link, and you can mail it to them.":"Given, only that address can use the link.")})]}),n.jsxs(Bt,{children:[n.jsx(He,{type:"button",variant:"outline",onClick:()=>N(!1),children:"Cancel"}),n.jsx(He,{type:"submit",loading:v.isSubmitting,children:v.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}const pr=()=>Xt(rn().user.role,"settings")?n.jsx(Lo,{}):n.jsx(Vs,{title:"Members"});export{pr as component};
@@ -0,0 +1 @@
1
+ import{j as e,aj as Y,r as d,p as M,d as A,A as $,S as B,h as m,B as P}from"./index-DAdE1N-R.js";import{u as _}from"./useQuery-Bt47w3ja.js";import{b as j}from"./InstanceRows-Bzwj6LZ6.js";import{A as D,P as K}from"./parts-CmbgXJj-.js";import{u as y}from"./me-CPtVQtAA.js";import{C as U}from"./check-DOzkll0G.js";import"./useBaseQuery-CgPeQebj.js";import"./dialog-BQKOXDHO.js";import"./label-ComnO04i.js";import"./inertValue-C7RCWgtk.js";import"./ConfirmDialog-CI4lfGTy.js";import"./labels--UUyt9uB.js";import"./card-CGjT73CQ.js";function L(){const s=y(),{said:r}=Y.useSearch(),[a,o]=d.useState(r),[c]=d.useState(()=>Date.now()),u=M(),p=A();d.useEffect(()=>{r&&u({to:"/studio/plan",search:{},replace:!0})},[r,u]);const w=_($.setupState()),i=w.data?.billingUrl??null,v=_({queryKey:["plan-state",i],enabled:!!i,refetchInterval:()=>a&&Date.now()-c<3e4?3e3:!1,queryFn:async()=>{const t=await fetch(`${i.replace(/\/+$/,"")}/state`,{credentials:"include",headers:{accept:"application/json"}});if(!t.ok)throw new Error(String(t.status));return await t.json()}}),n=v.data,b=d.useRef(null),f=n?.current?.name??null;d.useEffect(()=>{f&&(b.current===null?b.current=f:f!==b.current&&(o(void 0),p.invalidateQueries({queryKey:$.me().queryKey})))},[f,p]);const[h,R]=d.useState(!1),q=!!n?.plans.some(t=>t.yearly),S=n?.plans.find(t=>t.current);return e.jsxs("div",{className:"flex flex-col gap-8 p-7",children:[e.jsx(K,{title:"Plan & billing",sub:s.org.name}),a&&e.jsx("p",{role:"status",className:"m-0 max-w-[1040px] rounded-md border border-border bg-card px-3 py-2 text-[13px]",children:a}),w.isSuccess&&!i?e.jsx("p",{className:"m-0 text-muted-foreground",children:"This instance has no plans: everything is included."}):v.isError?e.jsx("p",{className:"m-0 text-muted-foreground",children:"The plans could not be loaded. Reload to try again."}):n?e.jsxs("div",{className:"flex max-w-[1040px] flex-col",children:[e.jsxs("section",{"aria-label":"Your plan",className:"grid grid-cols-1 gap-5 rounded-xl border border-border bg-card px-6 py-5 sm:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"m-0 text-[11.5px] font-medium uppercase tracking-wider text-muted-foreground",children:"Your plan"}),e.jsxs("p",{className:"m-0 mt-1 text-[28px] font-bold leading-tight",children:[n.current?.name??S?.name,e.jsx("span",{className:"ml-2 text-[15px] font-normal text-muted-foreground",children:n.current?.price??S?.price})]}),n.current?.period&&e.jsx("p",{className:"m-0 mt-1 text-[13px] text-ink-soft",children:n.current.period})]}),n.manage&&e.jsx("div",{children:e.jsx(g,{base:i,form:n.manage})}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(Q,{})}),n.current?.warning&&e.jsx("p",{role:"status",className:"m-0 rounded-md bg-warn-soft px-3.5 py-2.5 text-[13px] sm:col-span-2",children:n.current.warning}),n.nudge&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-lg bg-brand-soft px-3.5 py-2.5 sm:col-span-2",children:[e.jsx("p",{className:"m-0 min-w-[220px] flex-1 text-[13px]",children:n.nudge.text}),e.jsx(g,{base:i,form:n.nudge.action})]})]}),e.jsxs("div",{className:"mb-4 mt-9 flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h2",{id:"compare",className:"m-0 text-[17px] font-semibold",children:"Compare plans"}),q&&e.jsx("div",{role:"radiogroup","aria-label":"Billing period",className:"inline-flex rounded-full border border-border bg-card p-0.5",children:[!1,!0].map(t=>e.jsx("button",{type:"button",role:"radio","aria-checked":h===t,onClick:()=>R(t),className:m("rounded-full px-3.5 py-1 text-[13px]",h===t?"bg-foreground text-background":"text-ink-soft"),children:t?e.jsxs(e.Fragment,{children:["Yearly ",e.jsx("span",{className:m("font-medium",h?"opacity-80":"text-brand"),children:"2 months free"})]}):"Monthly"},String(t)))})]}),e.jsx("div",{"aria-labelledby":"compare",className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:n.plans.map(t=>{const x=h&&t.yearly?t.yearly:null,k=x?x.actions:t.actions,E=t.relation==="downgrade";return e.jsxs("div",{className:m("relative flex min-w-0 flex-col gap-4 rounded-xl border bg-card p-5",t.recommended?"border-brand shadow-[0_0_0_1px_var(--color-brand),0_10px_30px_rgb(61_97_217/.12)]":"border-border"),children:[(t.current||t.recommended)&&e.jsx("span",{className:m("absolute -top-2.5 left-5 rounded-full px-2.5 py-px text-[11.5px] font-semibold",t.current?"bg-foreground text-background":"bg-brand text-white"),children:t.current?"Your plan":"Recommended"}),e.jsxs("div",{children:[e.jsx("h3",{className:"m-0 text-[16px] font-semibold",children:t.name}),t.pitch&&e.jsx("p",{className:"m-0 mt-0.5 text-[13px] text-muted-foreground",children:t.pitch})]}),e.jsxs("p",{className:"m-0 text-[34px] font-bold leading-none tracking-tight",children:[x?.amount??t.amount??t.price,(x?.unit??t.unit)&&e.jsx("span",{className:"ml-1 text-[13px] font-normal tracking-normal text-muted-foreground",children:x?.unit??t.unit})]}),e.jsx("ul",{className:"m-0 flex flex-1 list-none flex-col gap-2 p-0",children:t.features.map(l=>e.jsxs("li",{className:m("flex gap-2 text-[13.5px]",t.added?.includes(l)&&"font-semibold"),children:[e.jsx(U,{className:"mt-0.5 size-4 shrink-0 text-ok","aria-hidden":!0}),l]},l))}),t.current?e.jsx(P,{type:"button",variant:"outline",disabled:!0,className:"w-full",children:"Current plan"}):E?k.map(l=>e.jsx(O,{base:i,form:l,warning:t.warning??null},l.label)):k.map(l=>e.jsx(g,{base:i,form:{...l,primary:!!t.recommended||l.primary},wide:!0},l.label))]},t.id)})}),e.jsxs("p",{className:"m-0 mt-5 text-center text-[13px] text-muted-foreground",children:[n.footer?e.jsxs("b",{className:"font-semibold text-foreground",children:[n.footer.split(". ")[0],"."]}):n.intro," ",n.footer?.split(". ").slice(1).join(". ")]}),n.notes.length>0&&e.jsx("p",{className:"m-0 mt-1.5 text-center text-[12px] text-muted-foreground",children:n.notes.join(" ")})]}):e.jsx(B,{})]})}function O({base:s,form:r,warning:a}){const[o,c]=d.useState(!1);return a&&o?e.jsxs("div",{className:"flex flex-col gap-2 rounded-md bg-warn-soft px-3 py-2.5 text-[12.5px]",children:[e.jsx("p",{className:"m-0",children:a}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{base:s,form:{...r,label:"Downgrade anyway",primary:!1}}),e.jsx("button",{type:"button",className:"text-[13px] text-muted-foreground underline underline-offset-2",onClick:()=>c(!1),children:"Keep my plan"})]})]}):a?e.jsx("button",{type:"button",className:"self-center text-[13px] text-muted-foreground underline underline-offset-[3px]",onClick:()=>c(!0),children:r.label}):e.jsxs("form",{method:"post",action:new URL(r.action,s).toString(),className:"m-0 self-center",children:[Object.entries(r.fields).map(([u,p])=>e.jsx("input",{type:"hidden",name:u,value:p},u)),e.jsx("button",{type:"submit",className:"text-[13px] text-muted-foreground underline underline-offset-[3px]",children:r.label})]})}function g({base:s,form:r,wide:a}){return e.jsxs("form",{method:"post",action:new URL(r.action,s).toString(),className:"m-0",children:[Object.entries(r.fields).map(([o,c])=>e.jsx("input",{type:"hidden",name:o,value:c},o)),e.jsx(P,{type:"submit",variant:r.primary?"default":"outline",className:a?"w-full":void 0,children:r.label})]})}function Q(){const{limits:s}=y(),r=[{label:"Sites",text:C(s.projects.used,s.projects.limit,"site","sites"),share:N(s.projects.used,s.projects.limit)},{label:"Members",text:C(s.members.used,s.members.limit,"member","members"),share:N(s.members.used,s.members.limit)},{label:"Screenshots",text:s.screenshots?s.storage.limit===null?`${j(s.storage.used)} used`:`${j(s.storage.used)} of ${j(s.storage.limit)}`:"Not on this plan",share:s.screenshots?N(s.storage.used,s.storage.limit):null}];return e.jsx("dl",{className:"m-0 grid grid-cols-1 gap-5 border-t border-border pt-4 sm:grid-cols-3",children:r.map(a=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("dt",{className:"text-[12px] text-muted-foreground",children:a.label}),e.jsx("dd",{className:"m-0 text-[13px]",children:a.text}),a.share!==null&&e.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted","aria-hidden":!0,children:e.jsx("div",{className:m("h-full rounded-full",a.share>=1?"bg-destructive":"bg-brand"),style:{width:`${Math.min(100,Math.round(a.share*100))}%`}})})]},a.label))})}const N=(s,r)=>r===null||r===0?null:s/r,C=(s,r,a,o)=>r===null?`${s} ${s===1?a:o}, unlimited`:`${s} of ${r} ${r===1?a:o}`,se=()=>y().user.role==="owner"?e.jsx(L,{}):e.jsx(D,{title:"Plan & billing"});export{se as component};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-CpZelV1d.js";/**
1
+ import{c as t}from"./index-DAdE1N-R.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as i,i as ae,ab as re,e as se,ac as ie,E as ne,k as j,j as f,al as oe,h as de}from"./index-CpZelV1d.js";import{q as ce,f as le,h as ue,p as fe,u as pe,j as he,k as be,l as ge,c as me,n as ve}from"./label-BiZMzk6M.js";import{Q as ke,S as xe}from"./dialog-CVhVRkOj.js";import{u as we}from"./useAriaLabelledBy-gMwuRSdn.js";import{u as ye}from"./useValueChanged-Cx2et9hZ.js";const M=i.createContext(void 0);function Ce(){const r=i.useContext(M);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":m,form:p,id:L,inputRef:T,name:w,nativeButton:h=!1,onCheckedChange:V,readOnly:d=!1,required:b=!1,disabled:N=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...q}=s,{clearErrors:H}=le(),{state:R,setTouched:A,setDirty:O,validityData:W,setFilled:v,setFocused:P,validationMode:J,disabled:Q,name:U,validation:c}=ue(),{labelId:Y}=fe(),t=Q||N,l=U??w,n=i.useRef(null),_=re(n,T,c.inputRef),g=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:g}),S=h?void 0:E,[a,G]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{H(l),O(a!==W.initialValue),v(a),c.change(a)});const{getButtonProps:K,buttonRef:X}=ie({disabled:t,native:h}),Z=we(m,Y,n,!h,S),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(A(!0),P(!1),J==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:S,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:_,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,I=me(ve,e.nativeEvent);V?.(u,I),!I.isCanceled&&G(u)},onClick(e){e.stopPropagation()},onFocus(){g.current?.focus()},...C!==void 0?{value:C}:ne},B=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=j("span",s,{state:B,ref:[o,g,X],props:[$,q,K,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(M.Provider,{value:B,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:k,className:F,style:x,...m}=s,p=Ce();return j("span",s,{state:p,ref:o,stateAttributesMapping:D,props:m})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
1
+ import{r as i,i as ae,ab as re,e as se,ac as ie,E as ne,k as j,j as f,al as oe,h as de}from"./index-DAdE1N-R.js";import{q as ce,f as le,h as ue,p as fe,u as pe,j as he,k as be,l as ge,c as me,n as ve}from"./label-ComnO04i.js";import{N as ke,O as xe}from"./dialog-BQKOXDHO.js";import{u as we}from"./useAriaLabelledBy-DBIPA8TM.js";import{u as ye}from"./useValueChanged-uYr-YTth.js";const M=i.createContext(void 0);function Ce(){const r=i.useContext(M);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":m,form:p,id:L,inputRef:N,name:w,nativeButton:h=!1,onCheckedChange:T,readOnly:d=!1,required:b=!1,disabled:V=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...q}=s,{clearErrors:H}=le(),{state:R,setTouched:O,setDirty:A,validityData:W,setFilled:v,setFocused:P,validationMode:J,disabled:U,name:Y,validation:c}=ue(),{labelId:_}=fe(),t=U||V,l=Y??w,n=i.useRef(null),G=re(n,N,c.inputRef),g=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:g}),B=h?void 0:E,[a,K]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{H(l),A(a!==W.initialValue),v(a),c.change(a)});const{getButtonProps:Q,buttonRef:X}=ie({disabled:t,native:h}),Z=we(m,_,n,!h,B),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(O(!0),P(!1),J==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:B,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:G,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,S=me(ve,e.nativeEvent);T?.(u,S),!S.isCanceled&&K(u)},onClick(e){e.stopPropagation()},onFocus(){g.current?.focus()},...C!==void 0?{value:C}:ne},I=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=j("span",s,{state:I,ref:[o,g,X],props:[$,q,Q,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(M.Provider,{value:I,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:k,className:F,style:x,...m}=s,p=Ce();return j("span",s,{state:p,ref:o,stateAttributesMapping:D,props:m})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
@@ -1 +1 @@
1
- import{j as t,h as l}from"./index-CpZelV1d.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function n({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",a),...e})}function b({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",a),...e})}function c({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",a),...e})}export{o as T,r as a,n as b,b as c,d,c as e};
1
+ import{j as t,h as l}from"./index-DAdE1N-R.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function n({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",a),...e})}function b({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",a),...e})}function c({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",a),...e})}export{o as T,r as a,n as b,b as c,d,c as e};
@@ -1 +1 @@
1
- import{r as u,e as l}from"./index-CpZelV1d.js";import{u as c}from"./label-BiZMzk6M.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};
1
+ import{r as u,e as l}from"./index-DAdE1N-R.js";import{u as c}from"./label-ComnO04i.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};
@@ -1 +1 @@
1
- import{bb as N,bc as h,bd as O,be as U,bf as k,bg as B,bh as A,bi as y,bj as H,bk as V,bl as M,bm as x,r as p,bn as F,d as j}from"./index-CpZelV1d.js";var st=class extends N{#e;#t=void 0;#f=void 0;#s=void 0;#n;#c;#i;#p;#u;#l;#a;#o;#r;#d=new Set;constructor(t,e){super(),this.options=e,this.#e=t,this.#i=null,this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Q(this.#t,this.options)?this.#h():this.updateResult(),this.#m())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return E(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return E(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#g(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof h(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!O(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&P(this.#t,s,this.options,e)&&this.#h(),this.updateResult(),i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(e.staleTime,this.#t))&&this.#R();const r=this.#v();i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||r!==this.#r)&&this.#y(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return O(this.getCurrentResult(),s)||(this.#s=s,this.#c=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#s}trackResult(t,e){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),e?.(i),Reflect.get(s,i))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);let i=()=>{},r;const c=new Promise(a=>{r=a,i=this.#e.getQueryCache().subscribe(u=>{u.type==="updated"&&u.query.queryHash===s.queryHash&&s.state.data!==void 0&&(i(),a(this.createResult(s,e)))})});return Promise.race([s.fetch().then(()=>{const a=this.createResult(s,e);return r?.(a),a}).finally(()=>{i()}),c])}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#h(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(U)),e}#b(t){return!k()&&h(this.options.enabled,this.#t)!==!1&&B(t)}#R(){this.#S();const t=h(this.options.staleTime,this.#t);if(this.#s.isStale||!this.#b(t))return;const e=A(this.#s.dataUpdatedAt,t)+1;this.#a=y.setTimeout(()=>{this.#s.isStale||this.updateResult()},e)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(t){this.#g(),this.#r=t,!(this.#r===0||!this.#b(this.#r))&&(this.#o=y.setInterval(()=>{(this.options.refetchIntervalInBackground||H.isFocused())&&this.#h()},this.#r))}#m(){this.#R(),this.#y(this.#v())}#S(){this.#a!==void 0&&(y.clearTimeout(this.#a),this.#a=void 0)}#g(){this.#o!==void 0&&(y.clearInterval(this.#o),this.#o=void 0)}createResult(t,e){const s=this.#t,i=this.options,r=this.#s,c=this.#n,a=this.#c,u=t!==s?t.state:this.#f,{state:l}=t;let n={...l},d=!1,o;if(e._optimisticResults){const f=this.hasListeners(),D=!f&&Q(t,e),L=f&&P(t,s,e,i);(D||L)&&(n={...n,...V(l.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:R,errorUpdatedAt:v,status:b}=n;o=n.data;let I=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let f;r?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(f=r.data,I=!0):f=typeof e.placeholderData=="function"?e.placeholderData(this.#l?.state.data,this.#l):e.placeholderData,f!==void 0&&(b="success",o=M(r?.data,f,e),d=!0)}if(e.select&&o!==void 0&&!I)if(r&&o===c?.data&&e.select===this.#p)o=this.#u;else try{this.#p=e.select,o=e.select(o),o=M(r?.data,o,e),this.#u=o,this.#i=null}catch(f){this.#i=f}else o===void 0&&(this.#i=null);this.#i&&(R=this.#i,o=this.#u,v=Date.now(),b="error",d=!1);const m=n.fetchStatus==="fetching",S=b==="pending",g=b==="error",T=S&&m,w=o!==void 0;return{status:b,fetchStatus:n.fetchStatus,isPending:S,isSuccess:b==="success",isError:g,isInitialLoading:T,isLoading:T,data:o,dataUpdatedAt:n.dataUpdatedAt,error:R,errorUpdatedAt:v,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:n.dataUpdateCount>u.dataUpdateCount||n.errorUpdateCount>u.errorUpdateCount,isFetching:m,isRefetching:m&&!S,isLoadingError:g&&!w,isPaused:n.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:g&&w,isStale:C(t,e),refetch:this.refetch,isEnabled:h(e.enabled,t)!==!1}}updateResult(){const t=this.#s,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#c=this.options,this.#n.data!==void 0&&(this.#l=this.#t),O(e,t))return;this.#s=e;const i=(()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,c=typeof r=="function"?r():r;if(c==="all"||!c&&!this.#d.size)return!0;const a=new Set(c??this.#d);return this.options.throwOnError&&a.add("error"),Object.keys(this.#s).some(u=>{const l=u;return this.#s[l]!==t[l]&&a.has(l)})})();x.batch(()=>{i&&this.listeners.forEach(r=>{r(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#O(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#f=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#m()}};function W(t,e){return h(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&h(e.retryOnMount,t)===!1)}function Q(t,e){return W(t,e)||t.state.data!==void 0&&E(t,e,e.refetchOnMount)}function E(t,e,s){if(h(e.enabled,t)!==!1&&h(e.staleTime,t)!=="static"){const i=typeof s=="function"?s(t):s;return i==="always"||i!==!1&&C(t,e)}return!1}function P(t,e,s,i){return(t!==e||h(i.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&C(t,s)}function C(t,e){return h(e.enabled,t)!==!1&&t.isStaleByTime(h(e.staleTime,t))}const _=p.createContext(!1),z=()=>p.useContext(_);_.Provider;function K(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const G=p.createContext(K()),J=()=>p.useContext(G),X=(t,e,s)=>{const i=s?.state.error&&typeof t.throwOnError=="function"?F(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||i)&&(e.isReset()||(t.retryOnMount=!1))},Y=t=>{p.useEffect(()=>{t.clearReset()},[t])},Z=({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||F(s,[t.error,i])),it=(t,e)=>e.state.data===void 0,$=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...r)=>s(i(...r)):s(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},q=(t,e)=>t?.suspense&&e.isPending,tt=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function rt(t,e,s){const i=z(),r=J(),c=j(),a=c.defaultQueryOptions(t),u=c.getQueryCache().get(a.queryHash),l=t.subscribed!==!1;a._optimisticResults=i?"isRestoring":l?"optimistic":void 0,$(a),X(a,r,u),Y(r);const[n]=p.useState(()=>new e(c,a)),d=n.getOptimisticResult(a),o=!i&&l;if(p.useSyncExternalStore(p.useCallback(R=>{const v=o?n.subscribe(x.batchCalls(R)):U;return n.updateResult(),v},[n,o]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),p.useEffect(()=>{n.setOptions(a)},[a,n]),q(a,d))throw tt(a,n,r);if(Z({result:d,errorResetBoundary:r,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw d.error;return a.notifyOnChangeProps?d:n.trackResult(d)}export{st as Q,it as d,rt as u};
1
+ import{bb as N,bc as h,bd as O,be as U,bf as k,bg as B,bh as A,bi as y,bj as H,bk as V,bl as M,bm as x,r as p,bn as F,d as j}from"./index-DAdE1N-R.js";var st=class extends N{#e;#t=void 0;#f=void 0;#s=void 0;#n;#c;#i;#p;#u;#l;#a;#o;#r;#d=new Set;constructor(t,e){super(),this.options=e,this.#e=t,this.#i=null,this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Q(this.#t,this.options)?this.#h():this.updateResult(),this.#m())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return E(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return E(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#g(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof h(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!O(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&P(this.#t,s,this.options,e)&&this.#h(),this.updateResult(),i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(e.staleTime,this.#t))&&this.#R();const r=this.#v();i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||r!==this.#r)&&this.#y(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return O(this.getCurrentResult(),s)||(this.#s=s,this.#c=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#s}trackResult(t,e){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),e?.(i),Reflect.get(s,i))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);let i=()=>{},r;const c=new Promise(a=>{r=a,i=this.#e.getQueryCache().subscribe(u=>{u.type==="updated"&&u.query.queryHash===s.queryHash&&s.state.data!==void 0&&(i(),a(this.createResult(s,e)))})});return Promise.race([s.fetch().then(()=>{const a=this.createResult(s,e);return r?.(a),a}).finally(()=>{i()}),c])}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#h(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(U)),e}#b(t){return!k()&&h(this.options.enabled,this.#t)!==!1&&B(t)}#R(){this.#S();const t=h(this.options.staleTime,this.#t);if(this.#s.isStale||!this.#b(t))return;const e=A(this.#s.dataUpdatedAt,t)+1;this.#a=y.setTimeout(()=>{this.#s.isStale||this.updateResult()},e)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(t){this.#g(),this.#r=t,!(this.#r===0||!this.#b(this.#r))&&(this.#o=y.setInterval(()=>{(this.options.refetchIntervalInBackground||H.isFocused())&&this.#h()},this.#r))}#m(){this.#R(),this.#y(this.#v())}#S(){this.#a!==void 0&&(y.clearTimeout(this.#a),this.#a=void 0)}#g(){this.#o!==void 0&&(y.clearInterval(this.#o),this.#o=void 0)}createResult(t,e){const s=this.#t,i=this.options,r=this.#s,c=this.#n,a=this.#c,u=t!==s?t.state:this.#f,{state:l}=t;let n={...l},d=!1,o;if(e._optimisticResults){const f=this.hasListeners(),D=!f&&Q(t,e),L=f&&P(t,s,e,i);(D||L)&&(n={...n,...V(l.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:R,errorUpdatedAt:v,status:b}=n;o=n.data;let I=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let f;r?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(f=r.data,I=!0):f=typeof e.placeholderData=="function"?e.placeholderData(this.#l?.state.data,this.#l):e.placeholderData,f!==void 0&&(b="success",o=M(r?.data,f,e),d=!0)}if(e.select&&o!==void 0&&!I)if(r&&o===c?.data&&e.select===this.#p)o=this.#u;else try{this.#p=e.select,o=e.select(o),o=M(r?.data,o,e),this.#u=o,this.#i=null}catch(f){this.#i=f}else o===void 0&&(this.#i=null);this.#i&&(R=this.#i,o=this.#u,v=Date.now(),b="error",d=!1);const m=n.fetchStatus==="fetching",S=b==="pending",g=b==="error",T=S&&m,w=o!==void 0;return{status:b,fetchStatus:n.fetchStatus,isPending:S,isSuccess:b==="success",isError:g,isInitialLoading:T,isLoading:T,data:o,dataUpdatedAt:n.dataUpdatedAt,error:R,errorUpdatedAt:v,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:n.dataUpdateCount>u.dataUpdateCount||n.errorUpdateCount>u.errorUpdateCount,isFetching:m,isRefetching:m&&!S,isLoadingError:g&&!w,isPaused:n.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:g&&w,isStale:C(t,e),refetch:this.refetch,isEnabled:h(e.enabled,t)!==!1}}updateResult(){const t=this.#s,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#c=this.options,this.#n.data!==void 0&&(this.#l=this.#t),O(e,t))return;this.#s=e;const i=(()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,c=typeof r=="function"?r():r;if(c==="all"||!c&&!this.#d.size)return!0;const a=new Set(c??this.#d);return this.options.throwOnError&&a.add("error"),Object.keys(this.#s).some(u=>{const l=u;return this.#s[l]!==t[l]&&a.has(l)})})();x.batch(()=>{i&&this.listeners.forEach(r=>{r(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#O(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#f=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#m()}};function W(t,e){return h(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&h(e.retryOnMount,t)===!1)}function Q(t,e){return W(t,e)||t.state.data!==void 0&&E(t,e,e.refetchOnMount)}function E(t,e,s){if(h(e.enabled,t)!==!1&&h(e.staleTime,t)!=="static"){const i=typeof s=="function"?s(t):s;return i==="always"||i!==!1&&C(t,e)}return!1}function P(t,e,s,i){return(t!==e||h(i.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&C(t,s)}function C(t,e){return h(e.enabled,t)!==!1&&t.isStaleByTime(h(e.staleTime,t))}const _=p.createContext(!1),z=()=>p.useContext(_);_.Provider;function K(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const G=p.createContext(K()),J=()=>p.useContext(G),X=(t,e,s)=>{const i=s?.state.error&&typeof t.throwOnError=="function"?F(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||i)&&(e.isReset()||(t.retryOnMount=!1))},Y=t=>{p.useEffect(()=>{t.clearReset()},[t])},Z=({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||F(s,[t.error,i])),it=(t,e)=>e.state.data===void 0,$=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...r)=>s(i(...r)):s(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},q=(t,e)=>t?.suspense&&e.isPending,tt=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function rt(t,e,s){const i=z(),r=J(),c=j(),a=c.defaultQueryOptions(t),u=c.getQueryCache().get(a.queryHash),l=t.subscribed!==!1;a._optimisticResults=i?"isRestoring":l?"optimistic":void 0,$(a),X(a,r,u),Y(r);const[n]=p.useState(()=>new e(c,a)),d=n.getOptimisticResult(a),o=!i&&l;if(p.useSyncExternalStore(p.useCallback(R=>{const v=o?n.subscribe(x.batchCalls(R)):U;return n.updateResult(),v},[n,o]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),p.useEffect(()=>{n.setOptions(a)},[a,n]),q(a,d))throw tt(a,n,r);if(Z({result:d,errorResetBoundary:r,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw d.error;return a.notifyOnChangeProps?d:n.trackResult(d)}export{st as Q,it as d,rt as u};
@@ -0,0 +1 @@
1
+ import{aH as d,r as f,ab as h}from"./index-DAdE1N-R.js";import{a as p}from"./CompositeList-Dwya2aET.js";function b(i={}){const{highlightItemOnHover:n,highlightedIndex:r,onHighlightedIndexChange:a}=d(),{ref:c,index:t}=p(i),o=r===t,s=f.useRef(null),m=h(c,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){a(t)},onMouseMove(){const e=s.current;if(!n||!e)return;const u=e.hasAttribute("disabled")||e.ariaDisabled==="true";!o&&!u&&e.focus()}},compositeRef:m,index:t}}export{b as u};
@@ -0,0 +1 @@
1
+ import{u as r,Q as u}from"./useBaseQuery-CgPeQebj.js";function a(e,s){return r(e,u)}export{a as u};
@@ -0,0 +1 @@
1
+ import{k as n}from"./index-DAdE1N-R.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
@@ -1 +1 @@
1
- import{r as s,f as c,e as n}from"./index-CpZelV1d.js";function u(e,r){const t=s.useRef(e),a=c(r);n(()=>{t.current!==e&&a(t.current),t.current=e},[e,a])}export{u};
1
+ import{r as s,f as c,e as n}from"./index-DAdE1N-R.js";function u(e,r){const t=s.useRef(e),a=c(r);n(()=>{t.current!==e&&a(t.current),t.current=e},[e,a])}export{u};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-CpZelV1d.js";/**
1
+ import{c as e}from"./index-DAdE1N-R.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,11 @@
1
+ import{c as z,V as E,p as F,d as B,r as l,j as e,G as L,h as k,B as n,s as w,A as x,C as S}from"./index-DAdE1N-R.js";import{C as f}from"./card-CGjT73CQ.js";import{L as C,I as q}from"./label-ComnO04i.js";import{I as P}from"./InstallTag-m5sxp8bY.js";import{C as R}from"./check-DOzkll0G.js";import{A}from"./arrow-left-BdulZ2N2.js";import"./CompositeList-Dwya2aET.js";import"./isElementDisabled-CwHw_lZC.js";import"./inertValue-C7RCWgtk.js";import"./useCompositeItem-CU7GSvP-.js";import"./copy-CeZ_egx3.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 W=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],j=z("arrow-right",W);/**
7
+ * @license lucide-react v1.39.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const _=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],G=z("party-popper",_),I=["Site","Address","Install"];function te(){const{me:D,site:r}=E.useRouteContext(),b=F(),o=B(),[a,c]=l.useState(0),[d,K]=l.useState(r.name==="First project"?"":r.name),[h,M]=l.useState(""),[i,u]=l.useState(!1),[m,y]=l.useState(!1),[v,p]=l.useState(""),Q=async()=>{u(!0),y(!0),p("");try{await w.deleteSite(r.uid),o.removeQueries({queryKey:["origins",r.uid]}),await o.invalidateQueries({queryKey:x.me().queryKey}),await o.fetchQuery(x.me()),b({to:"/sites",replace:!0})}catch(t){p(t instanceof S?t.message:"Something went wrong. Try again."),u(!1),y(!1)}},N=async(t,s)=>{u(!0),p("");try{await w.editSite(r.uid,t),t.domain&&o.setQueryData(x.origins(r.uid).queryKey,{domain:t.domain,origins:[]}),await o.invalidateQueries({queryKey:x.me().queryKey}),await o.fetchQuery(x.me()),s()}catch(g){p(g instanceof S?g.message:"Could not reach the server.")}finally{u(!1)}};return e.jsx("div",{className:"relative min-h-dvh bg-background",children:e.jsxs(L,{width:600,children:[e.jsxs("div",{className:"absolute right-6 top-5 text-[12.5px] text-muted-foreground",children:["Signed in as ",D.user.email]}),a<3&&e.jsx("ol",{className:"m-0 mb-6 flex list-none items-center gap-3.5 p-0","aria-label":"Steps",children:I.map((t,s)=>e.jsxs("li",{className:"flex items-center gap-2.5 text-[13.5px] font-medium",children:[e.jsx("span",{className:k("flex size-7 items-center justify-center rounded-full border-[1.5px] text-[12.5px]",s<a&&"border-brand bg-brand text-brand-foreground",s===a&&"border-brand text-brand ring-[3px] ring-brand-soft",s>a&&"border-line-strong text-muted-foreground"),"aria-current":s===a?"step":void 0,children:s<a?e.jsx(R,{className:"size-3.5"}):s+1}),e.jsx("span",{className:s===a?"text-foreground":"text-muted-foreground",children:t}),s<I.length-1&&e.jsx("span",{className:k("h-px w-[90px]",s<a?"bg-brand":"bg-border")})]},t))}),v&&e.jsx("p",{role:"alert",className:"m-0 mb-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),a===0&&e.jsx(f,{className:"gap-4 p-7",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),!(!d.trim()||i)&&N({name:d.trim()},()=>c(1))},children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:"What is the site called?"}),e.jsx("p",{className:"m-0 mt-2 text-muted-foreground",children:"One client website. You can add more from Sites later."})]}),e.jsxs("fieldset",{disabled:i,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"first-name",children:"Name"}),e.jsx(q,{id:"first-name",placeholder:"Kilnwork",value:d,onChange:t=>K(t.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(n,{type:"button",variant:"ghost",loading:m,disabled:i&&!m,onClick:()=>void Q(),children:"Skip for now"}),e.jsxs(n,{type:"submit",loading:i&&!m,disabled:!d.trim()||m,children:[i&&!m?"Saving…":"Continue",e.jsx(j,{})]})]})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No site yet? Skip, and add one from Sites when it is ready."})]})}),a===1&&e.jsx(f,{className:"gap-4 p-7",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),!(!h.trim()||i)&&N({domain:h.trim()},()=>c(2))},children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:["Where does ",d||r.name," live?"]}),e.jsx("p",{className:"m-0 mt-2 text-muted-foreground",children:"Its domain. Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in the site's settings."})]}),e.jsxs("fieldset",{disabled:i,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"first-domain",children:"Domain"}),e.jsx(q,{id:"first-domain",placeholder:"kilnwork.studio",value:h,onChange:t=>M(t.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(n,{type:"button",variant:"ghost",onClick:()=>c(0),children:[e.jsx(A,{}),"Back"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(n,{type:"submit",loading:i,disabled:!h.trim(),children:[i?"Saving…":"Continue",e.jsx(j,{})]})]})]})]})}),a===2&&e.jsxs(f,{className:"gap-4 p-7",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:"Install the widget"}),e.jsx("p",{className:"m-0 mt-2 text-muted-foreground",children:"Pick how your site is built, add it, and deploy."})]}),e.jsx(P,{uid:r.uid}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(n,{type:"button",variant:"ghost",onClick:()=>c(1),children:[e.jsx(A,{}),"Back"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(n,{type:"button",onClick:()=>c(3),children:["Done",e.jsx(j,{})]})]})]}),a===3&&e.jsxs(f,{className:"items-center gap-4 p-8 text-center",children:[e.jsx("span",{className:"flex size-11 items-center justify-center rounded-[10px] bg-brand-soft text-brand",children:e.jsx(G,{className:"size-5"})}),e.jsxs("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:[d||r.name," is set up"]}),e.jsx("p",{className:"m-0 text-muted-foreground",children:"Three things left, in this order."}),e.jsx("ol",{className:"m-0 flex w-full list-none flex-col gap-2 p-0 text-left",children:[["Deploy the site with the tag on every page","Comments start arriving here the moment a page loads it."],["Add a reviewer and send them their link","Your client gets their own link; you can revoke it without touching the site."],["Start the first round","A round is one pass of feedback. Starting the next one closes the last."]].map(([t,s],g)=>e.jsxs("li",{className:"flex gap-3 rounded-md border border-border px-3 py-2.5",children:[e.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full border border-line-strong text-[11px] text-muted-foreground",children:g+1}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:t}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:s})]})]},t))}),e.jsxs(n,{size:"lg",className:"mt-2 w-full",onClick:()=>void b({to:"/s/$site/comments",params:{site:r.uid},replace:!0}),children:["Go to Comments",e.jsx(j,{})]})]})]})})}export{te as component};
@@ -1 +1 @@
1
- import{W as h,r as x,j as e,B as a,G as N,s as y,X as b}from"./index-CpZelV1d.js";const S=`${b}session`;function E(){const{project:o,origin:t,env:g}=h.useSearch(),{me:n}=h.useRouteContext(),[l,d]=x.useState(""),[f,u]=x.useState(!1),i=n.projects.find(s=>s.uid===o),m=typeof window<"u"?window.opener:null,r=()=>window.close();if(!o||!t||!m)return e.jsx(c,{title:"Nothing to sign in to",children:e.jsxs("p",{className:"m-0 text-muted-foreground",children:["This window is opened by the comment box on a site you are reviewing. Open it from there — choose"," ",e.jsx("em",{children:"Studio member? Sign in"})," — and it will ask you here."]})});if(!i)return e.jsxs(c,{title:"Not one of this studio's sites",children:[e.jsxs("p",{className:"m-0 text-muted-foreground",children:["You are signed in to ",n.org.name,", and that site is not one of its sites. If it belongs to another studio you are in, switch to it in the dashboard and try again."]}),e.jsx(a,{variant:"outline",onClick:r,children:"Close"})]});const p=async()=>{d(""),u(!0);try{const s=await y.memberSession(i.uid,t,g);if(s.origin!==t)throw new Error("The address changed while signing in. Try again from the site.");const{origin:j,...w}=s;m.postMessage({type:S,session:w},j),r()}catch(s){d(s instanceof Error?s.message:"Could not reach the server."),u(!1)}};return e.jsxs(c,{title:`Sign in to ${i.name}`,children:[e.jsxs("p",{className:"m-0 text-muted-foreground",children:["Comment on ",e.jsx("span",{className:"font-medium text-foreground",children:t})," as"," ",e.jsx("span",{className:"font-medium text-foreground",children:n.user.name||n.user.email}),", from ",n.org.name,". Your comments there and your replies here will be one author."]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(a,{size:"lg",className:"flex-1",loading:f,onClick:()=>void p(),children:"Continue"}),e.jsx(a,{size:"lg",variant:"outline",onClick:r,children:"Cancel"})]})]})}function c({title:o,children:t}){return e.jsx(N,{children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:o}),t]})})}export{E as component};
1
+ import{W as h,r as x,j as e,B as a,G as N,s as y,X as b}from"./index-DAdE1N-R.js";const S=`${b}session`;function E(){const{project:o,origin:t,env:g}=h.useSearch(),{me:n}=h.useRouteContext(),[l,d]=x.useState(""),[f,u]=x.useState(!1),i=n.projects.find(s=>s.uid===o),m=typeof window<"u"?window.opener:null,r=()=>window.close();if(!o||!t||!m)return e.jsx(c,{title:"Nothing to sign in to",children:e.jsxs("p",{className:"m-0 text-muted-foreground",children:["This window is opened by the comment box on a site you are reviewing. Open it from there — choose"," ",e.jsx("em",{children:"Studio member? Sign in"})," — and it will ask you here."]})});if(!i)return e.jsxs(c,{title:"Not one of this studio's sites",children:[e.jsxs("p",{className:"m-0 text-muted-foreground",children:["You are signed in to ",n.org.name,", and that site is not one of its sites. If it belongs to another studio you are in, switch to it in the dashboard and try again."]}),e.jsx(a,{variant:"outline",onClick:r,children:"Close"})]});const p=async()=>{d(""),u(!0);try{const s=await y.memberSession(i.uid,t,g);if(s.origin!==t)throw new Error("The address changed while signing in. Try again from the site.");const{origin:j,...w}=s;m.postMessage({type:S,session:w},j),r()}catch(s){d(s instanceof Error?s.message:"Could not reach the server."),u(!1)}};return e.jsxs(c,{title:`Sign in to ${i.name}`,children:[e.jsxs("p",{className:"m-0 text-muted-foreground",children:["Comment on ",e.jsx("span",{className:"font-medium text-foreground",children:t})," as"," ",e.jsx("span",{className:"font-medium text-foreground",children:n.user.name||n.user.email}),", from ",n.org.name,". Your comments there and your replies here will be one author."]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(a,{size:"lg",className:"flex-1",loading:f,onClick:()=>void p(),children:"Continue"}),e.jsx(a,{size:"lg",variant:"outline",onClick:r,children:"Cancel"})]})]})}function c({title:o,children:t}){return e.jsx(N,{children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:o}),t]})})}export{E as component};
@@ -0,0 +1 @@
1
+ import{r,x as b,j as e,h as y,y as N,B as j,q as f,a2 as S}from"./index-DAdE1N-R.js";import{L as c,I as d}from"./label-ComnO04i.js";import{P as C,a as h}from"./parts-CmbgXJj-.js";import{S as P}from"./SaveState-BfVze7xL.js";import{M as A}from"./McpTokens-DKqRkxCT.js";import{u as k}from"./me-CPtVQtAA.js";import{u as M,a as F}from"./studio-Cg1Oy1vK.js";import{M as E,S as T,a as D}from"./sun-BlID8y0w.js";import"./card-CGjT73CQ.js";import"./labels--UUyt9uB.js";import"./useQuery-Bt47w3ja.js";import"./useBaseQuery-CgPeQebj.js";import"./badge-CTKpfsRI.js";import"./useRender-DQYQmhIj.js";import"./dialog-BQKOXDHO.js";import"./inertValue-C7RCWgtk.js";import"./switch-BnkPAxu8.js";import"./useAriaLabelledBy-DBIPA8TM.js";import"./useValueChanged-uYr-YTth.js";import"./ConfirmDialog-CI4lfGTy.js";import"./CopyButton-C-KCr0MF.js";import"./check-DOzkll0G.js";import"./copy-CeZ_egx3.js";function z({items:t}){const[a,n]=r.useState(b);return e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Theme",children:t.map(s=>e.jsxs("button",{type:"button",role:"radio","aria-checked":a===s.value,onClick:()=>{N(s.value),n(s.value)},className:y("inline-flex h-7 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",a===s.value&&"border-line-strong bg-muted text-foreground"),children:[s.icon,s.label]},s.value))})}function ne(){const t=k(),a=M(),[n,s]=r.useState(t.user.name),[u,i]=r.useState(null);r.useEffect(()=>s(t.user.name),[t.user.name]);const m=n.trim()!==t.user.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(C,{title:"You",sub:"Your own account on this studio",actions:e.jsx(P,{saving:a.isPending,savedAt:u})}),e.jsxs(h,{title:"Profile",description:"How you appear on replies and in the members list.",children:[e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:l=>{l.preventDefault(),m&&a.mutate(n.trim(),{onSuccess:()=>i(Date.now())})},children:[e.jsx(c,{htmlFor:"your-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"your-name",value:n,onChange:l=>s(l.target.value)}),m&&e.jsx(j,{type:"submit",variant:"outline",children:"Save"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"your-email",children:"Email"}),e.jsx(d,{id:"your-email",value:t.user.email,readOnly:!0,className:"bg-muted text-ink-soft"}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["How you sign in, and how the server finds you. An owner changes it with"," ",e.jsx("code",{className:"font-mono",children:"snagset passwd"}),"."]})]})]}),e.jsx(h,{title:"Password",description:"Changing it keeps this session and ends every other one.",children:e.jsx(H,{})}),!f(t.user.role,"settings")&&f(t.user.role,"review")&&e.jsx(A,{owner:!0,mine:!0,instanceOwner:!1,sites:t.projects}),e.jsx(h,{title:"Appearance",description:"Also in your menu at the bottom of the sidebar.",children:e.jsx(z,{items:[{value:"system",label:"System",icon:e.jsx(E,{className:"size-3.5"})},{value:"light",label:"Light",icon:e.jsx(T,{className:"size-3.5"})},{value:"dark",label:"Dark",icon:e.jsx(D,{className:"size-3.5"})}]})})]})}function H(){const t=F(),[a,n]=r.useState(""),[s,u]=r.useState(""),[i,m]=r.useState(""),[l,g]=r.useState(""),[v,p]=r.useState(!1),x=a.length>0&&s.length>=12&&s===i;return e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:async o=>{if(o.preventDefault(),!(!x||t.isPending)){g("");try{await t.mutateAsync({current:a,next:s}),n(""),u(""),m(""),p(!0)}catch(w){g(S(w))}}},children:[l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-current",children:"Current password"}),e.jsx(d,{id:"pw-current",type:"password",autoComplete:"current-password",value:a,onChange:o=>{n(o.target.value),p(!1)}})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-next",children:"New password"}),e.jsx(d,{id:"pw-next",type:"password",autoComplete:"new-password",value:s,onChange:o=>{u(o.target.value),p(!1)}}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. No composition rules — length is what matters."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-again",children:"Confirm new password"}),e.jsx(d,{id:"pw-again",type:"password",autoComplete:"new-password",value:i,onChange:o=>{m(o.target.value),p(!1)}}),i.length>0&&s!==i&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Those do not match yet."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{type:"submit",loading:t.isPending,disabled:!x,children:t.isPending?"Changing…":v&&!x?"Changed":"Change password"})})]})}export{ne as component};