@snagset/server 0.1.41 → 0.1.42

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 (76) hide show
  1. package/dist/routes/invites.js +19 -7
  2. package/dist/routes/invites.js.map +1 -1
  3. package/package.json +1 -1
  4. package/static/dashboard/assets/{CompositeItem-B_Ebe9qQ.js → CompositeItem-LCGvVtac.js} +1 -1
  5. package/static/dashboard/assets/{CompositeList-CDAPQTbv.js → CompositeList-Cty0rzq_.js} +1 -1
  6. package/static/dashboard/assets/{ConfirmDialog-D1II2uNE.js → ConfirmDialog-DIwxuqY9.js} +1 -1
  7. package/static/dashboard/assets/{CopyButton-qbA2ZHWn.js → CopyButton-DDGcA3Xd.js} +1 -1
  8. package/static/dashboard/assets/{FieldItemContext-BM_KzVUj.js → FieldItemContext-EmJLiYBJ.js} +1 -1
  9. package/static/dashboard/assets/{InstallTag-DTpNoMn9.js → InstallTag-DnVvf8zx.js} +1 -1
  10. package/static/dashboard/assets/{InstanceRows-B1z-L92-.js → InstanceRows-376JOINE.js} +1 -1
  11. package/static/dashboard/assets/{McpTokens-DE2t0iiS.js → McpTokens-C6CW9eYK.js} +1 -1
  12. package/static/dashboard/assets/{SaveState-QQHqDSgx.js → SaveState-R4390int.js} +1 -1
  13. package/static/dashboard/assets/{_app-CaDt6CPJ.js → _app-CAb1BtpQ.js} +1 -1
  14. package/static/dashboard/assets/{_app-B_DiSFIt.js → _app-DaKVP1n8.js} +13 -13
  15. package/static/dashboard/assets/activity-rK4Sf6B2.js +1 -0
  16. package/static/dashboard/assets/{arrow-left-RqdORgcq.js → arrow-left-6KOxG0mI.js} +1 -1
  17. package/static/dashboard/assets/{avatar-D8S5EME4.js → avatar-BHXI3Cxz.js} +1 -1
  18. package/static/dashboard/assets/{badge-anHWhPFa.js → badge-BVeGUvW4.js} +1 -1
  19. package/static/dashboard/assets/{card-C01exIzZ.js → card-CQykn6b-.js} +1 -1
  20. package/static/dashboard/assets/{check-Gm9Xu4rH.js → check-C5gLbOCB.js} +1 -1
  21. package/static/dashboard/assets/{chevron-down-C-pVPOKU.js → chevron-down-CNIHPCcw.js} +1 -1
  22. package/static/dashboard/assets/{chevron-right-BQmYcugl.js → chevron-right-voH028MP.js} +1 -1
  23. package/static/dashboard/assets/{copy-Ckk__4oN.js → copy-2WiQI5_8.js} +1 -1
  24. package/static/dashboard/assets/{dialog-D5G50pSW.js → dialog-I_D8p4LG.js} +1 -1
  25. package/static/dashboard/assets/{dropdown-menu-Bm_opJ2p.js → dropdown-menu-BD3iKpyK.js} +1 -1
  26. package/static/dashboard/assets/{forgot-R7JqXxs5.js → forgot-Buk2U0Iq.js} +1 -1
  27. package/static/dashboard/assets/{image-off-BtbHLgOM.js → image-off-pz0vPmjw.js} +1 -1
  28. package/static/dashboard/assets/{index-p-qD6BlY.js → index-DGJgBiEe.js} +15 -15
  29. package/static/dashboard/assets/invite-8sNxyTpF.js +1 -0
  30. package/static/dashboard/assets/{label-CuvYMIVd.js → label-ClUOe0Qf.js} +1 -1
  31. package/static/dashboard/assets/{labels-DLMjYGNJ.js → labels-ToSuNGQl.js} +1 -1
  32. package/static/dashboard/assets/{layout-grid-D5ek58h7.js → layout-grid-DLRb1zmb.js} +1 -1
  33. package/static/dashboard/assets/{parts-CN1uQywE.js → parts-CeW0gqpG.js} +1 -1
  34. package/static/dashboard/assets/{plus-BsxOLtMA.js → plus-DMA0pE49.js} +1 -1
  35. package/static/dashboard/assets/reset-citpUr97.js +1 -0
  36. package/static/dashboard/assets/s._site-BVRYrqWc.js +1 -0
  37. package/static/dashboard/assets/{s._site.comments-DmrtKLHb.js → s._site.comments-CupTJMag.js} +1 -1
  38. package/static/dashboard/assets/{s._site.reviewers-CGKj-NQo.js → s._site.reviewers-CgBIszUX.js} +1 -1
  39. package/static/dashboard/assets/{s._site.settings-DvWbfMac.js → s._site.settings-CEuj_wJ1.js} +1 -1
  40. package/static/dashboard/assets/{setup-BDZJmgIB.js → setup-otr5LUWS.js} +1 -1
  41. package/static/dashboard/assets/{sign-in-BmweKwDv.js → sign-in-BRpUPHbi.js} +1 -1
  42. package/static/dashboard/assets/{sign-up-C06mQl-c.js → sign-up-sC_IfvbO.js} +1 -1
  43. package/static/dashboard/assets/sites-D52Ciw1e.js +1 -0
  44. package/static/dashboard/assets/studio-0_bXXp2K.js +1 -0
  45. package/static/dashboard/assets/{studio-BHpeuJSq.js → studio-B02T4EY4.js} +1 -1
  46. package/static/dashboard/assets/studio.index-gCE2490t.js +1 -0
  47. package/static/dashboard/assets/studio.integrations-BrvDZjmR.js +1 -0
  48. package/static/dashboard/assets/{studio.members-CEKrbJHp.js → studio.members-CWZNCLCY.js} +2 -2
  49. package/static/dashboard/assets/{studio.plan-CkOzUaJM.js → studio.plan-Bwz6dizT.js} +1 -1
  50. package/static/dashboard/assets/{sun-DXwtJyi5.js → sun-CgLdWf2g.js} +1 -1
  51. package/static/dashboard/assets/{switch-cgJL6ATv.js → switch-BZw_bqWh.js} +1 -1
  52. package/static/dashboard/assets/{table-B8VTYpZO.js → table-t_7248Aq.js} +1 -1
  53. package/static/dashboard/assets/{useAriaLabelledBy-BT5NtL2E.js → useAriaLabelledBy-BSClfAH5.js} +1 -1
  54. package/static/dashboard/assets/{useBaseQuery-DaFWLbWu.js → useBaseQuery-BzwsA17g.js} +1 -1
  55. package/static/dashboard/assets/useQuery-dbNRhTlt.js +1 -0
  56. package/static/dashboard/assets/useRender-BJVEua-j.js +1 -0
  57. package/static/dashboard/assets/{useValueChanged-cwqHWzY1.js → useValueChanged-CEh0b15T.js} +1 -1
  58. package/static/dashboard/assets/{users-CGY0g3mg.js → users-DLfPGZtA.js} +1 -1
  59. package/static/dashboard/assets/{welcome-CNtwDQMd.js → welcome-qvhXOg78.js} +3 -3
  60. package/static/dashboard/assets/{widget-signin-BOUMPGXt.js → widget-signin-CB_pBDz0.js} +1 -1
  61. package/static/dashboard/assets/{you-DH4QMiND.js → you-0VVZ27jc.js} +1 -1
  62. package/static/dashboard/assets/{zod-DfHlfdUJ.js → zod-DrXRVGy0.js} +1 -1
  63. package/static/dashboard/index.html +1 -1
  64. package/static/widget/build.json +2 -2
  65. package/static/widget/snag.js +1 -1
  66. package/static/widget/snag.runtime.js +1 -1
  67. package/static/dashboard/assets/activity-CzEy_J8-.js +0 -1
  68. package/static/dashboard/assets/invite-9eotNL9V.js +0 -1
  69. package/static/dashboard/assets/reset-8K76tpdp.js +0 -1
  70. package/static/dashboard/assets/s._site-egkPDOj9.js +0 -1
  71. package/static/dashboard/assets/sites-CkGgns1o.js +0 -1
  72. package/static/dashboard/assets/studio-CG1QMBSK.js +0 -1
  73. package/static/dashboard/assets/studio.index-BOkmM7I5.js +0 -1
  74. package/static/dashboard/assets/studio.integrations-BBik3DdK.js +0 -1
  75. package/static/dashboard/assets/useQuery-D-9vXtOo.js +0 -1
  76. package/static/dashboard/assets/useRender-BBzDGtxq.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as Wt,a8 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,a9 as Vt,f as He,m as St,E as bn,aa as vn,ab as Gt,k as Ce,g as bt,q as Xt,ac as yn,B as Fe,ad as it,ae as Kt,a1 as kt,H as Sn,C as wn,af as Rn,ag as In,ah as jn,D as Tn,z as Lt}from"./index-p-qD6BlY.js";import{u as Ot}from"./useQuery-D-9vXtOo.js";import{u as Cn,a as An}from"./zod-DfHlfdUJ.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 Hn,r as Fn,g as Bn,A as Un,b as _n}from"./avatar-D8S5EME4.js";import{B as zn}from"./badge-anHWhPFa.js";import{C as Jt}from"./card-C01exIzZ.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 Ht,J as Ft,K as Bt}from"./dialog-D5G50pSW.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-CuvYMIVd.js";import{T as tn,a as nn,b as ct,c as Ie,d as sn,e as je}from"./table-B8VTYpZO.js";import{C as js}from"./ConfirmDialog-D1II2uNE.js";import{C as Ts}from"./CopyButton-qbA2ZHWn.js";import{C as on}from"./chevron-down-C-pVPOKU.js";import{C as Cs}from"./check-Gm9Xu4rH.js";import{s as Rt,i as As}from"./serializeValue-DRMAHja_.js";import{u as Ms}from"./useValueChanged-cwqHWzY1.js";import{C as Es,u as Ps,a as Ns}from"./CompositeList-CDAPQTbv.js";import{A as Vs,P as ks,b as Ls}from"./parts-CN1uQywE.js";import{u as rn,a as Os}from"./labels-DLMjYGNJ.js";import{c as Ds,d as Hs,e as Fs,f as Bs,g as Us}from"./studio-BHpeuJSq.js";import{P as _s}from"./plus-BsxOLtMA.js";import"./useBaseQuery-DaFWLbWu.js";import"./useRender-BBzDGtxq.js";import"./copy-Ckk__4oN.js";/**
1
+ import{c as Wt,a8 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,a9 as Vt,f as Fe,m as St,E as bn,aa as vn,ab as Gt,k as Ce,g as bt,q as Xt,ac as yn,B as He,ad as it,ae as Kt,a2 as kt,I as Sn,D as wn,af as Rn,ag as In,ah as jn,F as Tn,A as Lt}from"./index-DGJgBiEe.js";import{u as Ot}from"./useQuery-dbNRhTlt.js";import{u as Cn,a as An}from"./zod-DrXRVGy0.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-BHXI3Cxz.js";import{B as zn}from"./badge-BVeGUvW4.js";import{C as Jt}from"./card-CQykn6b-.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-I_D8p4LG.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-ClUOe0Qf.js";import{T as tn,a as nn,b as ct,c as Ie,d as sn,e as je}from"./table-t_7248Aq.js";import{C as js}from"./ConfirmDialog-DIwxuqY9.js";import{C as Ts}from"./CopyButton-DDGcA3Xd.js";import{C as on}from"./chevron-down-CNIHPCcw.js";import{C as Cs}from"./check-C5gLbOCB.js";import{s as Rt,i as As}from"./serializeValue-DRMAHja_.js";import{u as Ms}from"./useValueChanged-CEh0b15T.js";import{C as Es,u as Ps,a as Ns}from"./CompositeList-Cty0rzq_.js";import{A as Vs,P as ks,b as Ls}from"./parts-CeW0gqpG.js";import{u as rn,a as Os}from"./labels-ToSuNGQl.js";import{c as Ds,d as Fs,e as Hs,f as Bs,g as Us}from"./studio-B02T4EY4.js";import{P as _s}from"./plus-DMA0pE49.js";import"./useBaseQuery-BzwsA17g.js";import"./useRender-BJVEua-j.js";import"./copy-2WiQI5_8.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,a8 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,a9 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:H,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"}),[F,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(F),{openMethod:X,triggerProps:ae}=Mn(F),E=Yt(()=>new Yn({id:z,labelId:void 0,modal:v,multiple:I,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,value:h,open:F,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=He(()=>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(()=>{H(Ge)},[Ge,H]),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),!F&&E.set("selectedIndex",Ve)},[I,F,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=He((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=He(()=>{fe(!1),E.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});pt({enabled:!D,open:F,ref:B,onComplete(){F||_e()}}),l.useImperativeHandle(D,()=>({unmount:_e}),[_e]);const Me=He((A,U)=>{i?.(A,U),!U.isCanceled&&Q(A)}),he=He(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:F,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&&!F||E.set("activeIndex",A)},focusItemOnHover:k}),Oe=Nn(Ee,{enabled:!y&&!P&&(F||!I),listRef:T,activeIndex:Ae,selectedIndex:ye,disabledIndices:A=>As(g.current[A]),onMatch(A){F?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:F,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),H=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:F,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?H?.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,F),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(),H=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),F=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)&&H,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:H,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:!H}),de=l.useRef(0),Z=He(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(H&&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:F}),[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(!H),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(),H=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),F=l.useRef(!1),se=l.useRef({}),g=rs(),T=He(M=>{if(!a||!m.current||!F.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||(F.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(F.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:`${H}-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 Hn.getScale(e)}function Je(e,t,s){return e/s[t]}function ot(e,t){return Fn({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),H=y.index,L=l.useRef(null);xe(()=>{const g=I.current;return g[H]=r,()=>{delete g[H]}},[H,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",H),b.current&&(V.current=b.current))},[H,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",H),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)}},F=Ce("div",t,{ref:[z,s,y.ref,L],state:P,props:[v,Q,x,ne]}),se=l.useMemo(()=>({selected:Y,index:H,textRef:b,selectedByFocus:le}),[Y,H,b,le]);return n.jsx(pn.Provider,{value:se,children:F})})),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(Fe,{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(Ho,{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=Fs(),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(Fe,{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 Ho({m:e,owner:t}){const s=Ds(),o=Hs(),[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(Fe,{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 Fo=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(Fo),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(Ht,{children:"Invite link"}),n.jsxs(Ft,{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(Fe,{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(Fe,{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(Ht,{children:"Invite someone"}),n.jsx(Ft,{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(Fe,{type:"button",variant:"outline",onClick:()=>N(!1),children:"Cancel"}),n.jsx(Fe,{type:"submit",loading:v.isSubmitting,children:v.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}const ur=()=>Xt(rn().user.role,"settings")?n.jsx(Lo,{}):n.jsx(Vs,{title:"Members"});export{ur 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=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 ur=()=>Xt(rn().user.role,"settings")?n.jsx(Lo,{}):n.jsx(Vs,{title:"Members"});export{ur as component};
@@ -1 +1 @@
1
- import{j as e,ai as x,S as u,h as p,B as g,z as h}from"./index-p-qD6BlY.js";import{u as c}from"./useQuery-D-9vXtOo.js";import{b as d}from"./InstanceRows-B1z-L92-.js";import{A as j,P as f,a as b}from"./parts-CN1uQywE.js";import{u as o}from"./labels-DLMjYGNJ.js";import"./useBaseQuery-DaFWLbWu.js";import"./dialog-D5G50pSW.js";import"./label-CuvYMIVd.js";import"./ConfirmDialog-D1II2uNE.js";import"./card-C01exIzZ.js";function N(){const t=o(),{said:r}=x.useSearch(),i=c(h.setupState()),a=i.data?.billingUrl??null,n=c({queryKey:["plan-state",a],enabled:!!a,queryFn:async()=>{const s=await fetch(`${a.replace(/\/+$/,"")}/state`,{credentials:"include",headers:{accept:"application/json"}});if(!s.ok)throw new Error(String(s.status));return await s.json()}});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(f,{title:"Plan & billing",sub:t.org.name}),r&&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:r}),e.jsx(b,{title:"Usage",description:"What this studio uses, against its plan.",children:e.jsx(y,{})}),i.isSuccess&&!a?e.jsx("p",{className:"m-0 text-muted-foreground",children:"This instance has no plans: everything is included."}):n.isError?e.jsx("p",{className:"m-0 text-muted-foreground",children:"The plans could not be loaded. Reload to try again."}):n.data?e.jsxs("section",{className:"flex max-w-[1040px] flex-col gap-4",children:[n.data.intro&&e.jsx("p",{className:"m-0 text-muted-foreground",children:n.data.intro}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:n.data.plans.map(s=>e.jsxs("div",{className:p("flex min-w-0 flex-col gap-2 rounded-lg border bg-card px-4 py-3.5",s.current?"border-brand ring-1 ring-brand":"border-border"),children:[e.jsxs("h2",{className:"m-0 flex items-center gap-2 text-[14px] font-semibold",children:[s.name,s.current&&e.jsx("span",{className:"rounded-full bg-brand-soft px-2 py-px text-[11.5px] font-medium text-brand",children:"Current"})]}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:s.price}),e.jsx("ul",{className:"m-0 flex-1 list-disc pl-4 text-[12.5px] text-muted-foreground",children:s.features.map(l=>e.jsx("li",{children:l},l))}),s.actions.map(l=>e.jsx(m,{base:a,form:l},l.label))]},s.id))}),n.data.manage&&e.jsx("div",{children:e.jsx(m,{base:a,form:n.data.manage})}),n.data.notes.map(s=>e.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:s},s))]}):e.jsx(u,{})]})}function m({base:t,form:r}){return e.jsxs("form",{method:"post",action:new URL(r.action,t).toString(),className:"m-0",children:[Object.entries(r.fields).map(([i,a])=>e.jsx("input",{type:"hidden",name:i,value:a},i)),e.jsx(g,{type:"submit",variant:r.primary?"default":"outline",className:r.primary?"w-full":void 0,children:r.label})]})}function y(){const{limits:t}=o(),r=(i,a,n,s)=>a===null?`${i} ${i===1?n:s}, unlimited`:`${i} of ${a} ${a===1?n:s}`;return e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_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:r(t.projects.used,t.projects.limit,"site","sites")}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:r(t.members.used,t.members.limit,"member","members")}),e.jsx("dt",{className:"text-muted-foreground",children:"Screenshots"}),e.jsx("dd",{className:"m-0",children:t.screenshots?t.storage.limit===null?`${d(t.storage.used)} used`:`${d(t.storage.used)} of ${d(t.storage.limit)}`:"Not on this plan"})]})}const A=()=>o().user.role==="owner"?e.jsx(N,{}):e.jsx(j,{title:"Plan & billing"});export{A as component};
1
+ import{j as e,ai as x,S as u,h as p,B as g,A as h}from"./index-DGJgBiEe.js";import{u as c}from"./useQuery-dbNRhTlt.js";import{b as d}from"./InstanceRows-376JOINE.js";import{A as j,P as f,a as b}from"./parts-CeW0gqpG.js";import{u as o}from"./labels-ToSuNGQl.js";import"./useBaseQuery-BzwsA17g.js";import"./dialog-I_D8p4LG.js";import"./label-ClUOe0Qf.js";import"./ConfirmDialog-DIwxuqY9.js";import"./card-CQykn6b-.js";function N(){const t=o(),{said:r}=x.useSearch(),i=c(h.setupState()),a=i.data?.billingUrl??null,n=c({queryKey:["plan-state",a],enabled:!!a,queryFn:async()=>{const s=await fetch(`${a.replace(/\/+$/,"")}/state`,{credentials:"include",headers:{accept:"application/json"}});if(!s.ok)throw new Error(String(s.status));return await s.json()}});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(f,{title:"Plan & billing",sub:t.org.name}),r&&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:r}),e.jsx(b,{title:"Usage",description:"What this studio uses, against its plan.",children:e.jsx(y,{})}),i.isSuccess&&!a?e.jsx("p",{className:"m-0 text-muted-foreground",children:"This instance has no plans: everything is included."}):n.isError?e.jsx("p",{className:"m-0 text-muted-foreground",children:"The plans could not be loaded. Reload to try again."}):n.data?e.jsxs("section",{className:"flex max-w-[1040px] flex-col gap-4",children:[n.data.intro&&e.jsx("p",{className:"m-0 text-muted-foreground",children:n.data.intro}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:n.data.plans.map(s=>e.jsxs("div",{className:p("flex min-w-0 flex-col gap-2 rounded-lg border bg-card px-4 py-3.5",s.current?"border-brand ring-1 ring-brand":"border-border"),children:[e.jsxs("h2",{className:"m-0 flex items-center gap-2 text-[14px] font-semibold",children:[s.name,s.current&&e.jsx("span",{className:"rounded-full bg-brand-soft px-2 py-px text-[11.5px] font-medium text-brand",children:"Current"})]}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:s.price}),e.jsx("ul",{className:"m-0 flex-1 list-disc pl-4 text-[12.5px] text-muted-foreground",children:s.features.map(l=>e.jsx("li",{children:l},l))}),s.actions.map(l=>e.jsx(m,{base:a,form:l},l.label))]},s.id))}),n.data.manage&&e.jsx("div",{children:e.jsx(m,{base:a,form:n.data.manage})}),n.data.notes.map(s=>e.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:s},s))]}):e.jsx(u,{})]})}function m({base:t,form:r}){return e.jsxs("form",{method:"post",action:new URL(r.action,t).toString(),className:"m-0",children:[Object.entries(r.fields).map(([i,a])=>e.jsx("input",{type:"hidden",name:i,value:a},i)),e.jsx(g,{type:"submit",variant:r.primary?"default":"outline",className:r.primary?"w-full":void 0,children:r.label})]})}function y(){const{limits:t}=o(),r=(i,a,n,s)=>a===null?`${i} ${i===1?n:s}, unlimited`:`${i} of ${a} ${a===1?n:s}`;return e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_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:r(t.projects.used,t.projects.limit,"site","sites")}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:r(t.members.used,t.members.limit,"member","members")}),e.jsx("dt",{className:"text-muted-foreground",children:"Screenshots"}),e.jsx("dd",{className:"m-0",children:t.screenshots?t.storage.limit===null?`${d(t.storage.used)} used`:`${d(t.storage.used)} of ${d(t.storage.limit)}`:"Not on this plan"})]})}const E=()=>o().user.role==="owner"?e.jsx(N,{}):e.jsx(j,{title:"Plan & billing"});export{E as component};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-p-qD6BlY.js";/**
1
+ import{c as t}from"./index-DGJgBiEe.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,aa as re,e as se,ab as ie,E as ne,k as j,j as f,ak as oe,h as de}from"./index-p-qD6BlY.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 ke}from"./label-CuvYMIVd.js";import{Q as ve,S as xe}from"./dialog-D5G50pSW.js";import{u as we}from"./useAriaLabelledBy-BT5NtL2E.js";import{u as ye}from"./useValueChanged-cwqHWzY1.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:v,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:k,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:v,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&k(n.current.checked)},[k]),ye(a,()=>{H(l),O(a!==W.initialValue),k(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?ve: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(ke,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:v,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,aa as re,e as se,ab as ie,E as ne,k as j,j as f,ak as oe,h as de}from"./index-DGJgBiEe.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 ke}from"./label-ClUOe0Qf.js";import{Q as ve,S as xe}from"./dialog-I_D8p4LG.js";import{u as we}from"./useAriaLabelledBy-BSClfAH5.js";import{u as ye}from"./useValueChanged-CEh0b15T.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:v,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:k,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:v,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&k(n.current.checked)},[k]),ye(a,()=>{H(l),O(a!==W.initialValue),k(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?ve: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(ke,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:v,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-p-qD6BlY.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-DGJgBiEe.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-p-qD6BlY.js";import{u as c}from"./label-CuvYMIVd.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-DGJgBiEe.js";import{u as c}from"./label-ClUOe0Qf.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{b9 as N,ba as h,bb as O,bc as U,bd as k,be as B,bf as A,bg as y,bh as H,bi as V,bj as M,bk as x,r as p,bl as F,d as j}from"./index-p-qD6BlY.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.#S())}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.#m(),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.#m();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))}#S(){this.#R(),this.#y(this.#v())}#m(){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 S=n.fetchStatus==="fetching",m=b==="pending",g=b==="error",T=m&&S,w=o!==void 0;return{status:b,fetchStatus:n.fetchStatus,isPending:m,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:S,isRefetching:S&&!m,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.#S()}};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{b9 as N,ba as h,bb as O,bc as U,bd as k,be as B,bf as A,bg as y,bh as H,bi as V,bj as M,bk as x,r as p,bl as F,d as j}from"./index-DGJgBiEe.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.#S())}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.#m(),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.#m();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))}#S(){this.#R(),this.#y(this.#v())}#m(){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 S=n.fetchStatus==="fetching",m=b==="pending",g=b==="error",T=m&&S,w=o!==void 0;return{status:b,fetchStatus:n.fetchStatus,isPending:m,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:S,isRefetching:S&&!m,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.#S()}};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{u as r,Q as u}from"./useBaseQuery-BzwsA17g.js";function a(e,s){return r(e,u)}export{a as u};
@@ -0,0 +1 @@
1
+ import{k as n}from"./index-DGJgBiEe.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-p-qD6BlY.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-DGJgBiEe.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-p-qD6BlY.js";/**
1
+ import{c as e}from"./index-DGJgBiEe.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,11 +1,11 @@
1
- import{c as I,U 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,z as x,A as S}from"./index-p-qD6BlY.js";import{C as f}from"./card-C01exIzZ.js";import{L as C,I as q}from"./label-CuvYMIVd.js";import{I as P}from"./InstallTag-DTpNoMn9.js";import{C as R}from"./check-Gm9Xu4rH.js";import{A as z}from"./arrow-left-RqdORgcq.js";import"./copy-Ckk__4oN.js";/**
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-DGJgBiEe.js";import{C as f}from"./card-CQykn6b-.js";import{L as C,I as q}from"./label-ClUOe0Qf.js";import{I as P}from"./InstallTag-DnVvf8zx.js";import{C as R}from"./check-C5gLbOCB.js";import{A}from"./arrow-left-6KOxG0mI.js";import"./copy-2WiQI5_8.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const T=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],j=I("arrow-right",T);/**
6
+ */const T=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],j=z("arrow-right",T);/**
7
7
  * @license lucide-react v1.39.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const _=[["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=I("party-popper",_),A=["Site","Address","Install"];function Z(){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:A.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<A.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(z,{}),"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.jsxs("p",{className:"m-0 mt-2 text-muted-foreground",children:["Paste this before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed, 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(z,{}),"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{Z as component};
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 J(){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.jsxs("p",{className:"m-0 mt-2 text-muted-foreground",children:["Paste this before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed, 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{J as component};
@@ -1 +1 @@
1
- import{V as h,r as x,j as e,B as a,G as N,s as y,W as b}from"./index-p-qD6BlY.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-DGJgBiEe.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 +1 @@
1
- import{r,w as b,j as e,h as y,x as N,B as j,q as f,a1 as S}from"./index-p-qD6BlY.js";import{L as c,I as d}from"./label-CuvYMIVd.js";import{P as C,a as h}from"./parts-CN1uQywE.js";import{S as P}from"./SaveState-QQHqDSgx.js";import{M as A}from"./McpTokens-DE2t0iiS.js";import{u as k}from"./labels-DLMjYGNJ.js";import{u as M,a as F}from"./studio-BHpeuJSq.js";import{M as E,S as T,a as D}from"./sun-DXwtJyi5.js";import"./card-C01exIzZ.js";import"./useQuery-D-9vXtOo.js";import"./useBaseQuery-DaFWLbWu.js";import"./badge-anHWhPFa.js";import"./useRender-BBzDGtxq.js";import"./dialog-D5G50pSW.js";import"./switch-cgJL6ATv.js";import"./useAriaLabelledBy-BT5NtL2E.js";import"./useValueChanged-cwqHWzY1.js";import"./ConfirmDialog-D1II2uNE.js";import"./CopyButton-qbA2ZHWn.js";import"./check-Gm9Xu4rH.js";import"./copy-Ckk__4oN.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 ae(){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(""),[w,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(v){g(S(v))}}},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…":w&&!x?"Changed":"Change password"})})]})}export{ae as component};
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-DGJgBiEe.js";import{L as c,I as d}from"./label-ClUOe0Qf.js";import{P as C,a as h}from"./parts-CeW0gqpG.js";import{S as P}from"./SaveState-R4390int.js";import{M as A}from"./McpTokens-C6CW9eYK.js";import{u as k}from"./labels-ToSuNGQl.js";import{u as M,a as F}from"./studio-B02T4EY4.js";import{M as E,S as T,a as D}from"./sun-CgLdWf2g.js";import"./card-CQykn6b-.js";import"./useQuery-dbNRhTlt.js";import"./useBaseQuery-BzwsA17g.js";import"./badge-BVeGUvW4.js";import"./useRender-BJVEua-j.js";import"./dialog-I_D8p4LG.js";import"./switch-BZw_bqWh.js";import"./useAriaLabelledBy-BSClfAH5.js";import"./useValueChanged-CEh0b15T.js";import"./ConfirmDialog-DIwxuqY9.js";import"./CopyButton-DDGcA3Xd.js";import"./check-C5gLbOCB.js";import"./copy-2WiQI5_8.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 ae(){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{ae as component};