@snagset/server 0.1.47 → 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/db/migrations/0017_attachments_site_idx.sql +20 -0
  2. package/dist/jobs/reaper.js +43 -7
  3. package/dist/jobs/reaper.js.map +1 -1
  4. package/dist/routes/sites.js +7 -0
  5. package/dist/routes/sites.js.map +1 -1
  6. package/package.json +1 -1
  7. package/static/dashboard/assets/CompositeItem-Dlay6yU9.js +1 -0
  8. package/static/dashboard/assets/{CompositeList-CP60mNVK.js → CompositeList-Dwya2aET.js} +1 -1
  9. package/static/dashboard/assets/{ConfirmDialog-BsHHrPi0.js → ConfirmDialog-CI4lfGTy.js} +1 -1
  10. package/static/dashboard/assets/{CopyButton-Drniwbyh.js → CopyButton-C-KCr0MF.js} +1 -1
  11. package/static/dashboard/assets/{FieldItemContext-D0PwWPOC.js → FieldItemContext-CgKFsCxF.js} +1 -1
  12. package/static/dashboard/assets/InstallTag-m5sxp8bY.js +17 -0
  13. package/static/dashboard/assets/InstanceRows-Bzwj6LZ6.js +1 -0
  14. package/static/dashboard/assets/{McpTokens-BAlNfNd7.js → McpTokens-DKqRkxCT.js} +1 -1
  15. package/static/dashboard/assets/{SaveState-Cd1Ay9eR.js → SaveState-BfVze7xL.js} +1 -1
  16. package/static/dashboard/assets/{_app-gdbZO1qh.js → _app-CMWnhNah.js} +2 -2
  17. package/static/dashboard/assets/{_app-DKYhNXgR.js → _app-wDjbs9TO.js} +1 -1
  18. package/static/dashboard/assets/{activity-Bhm2xtHX.js → activity-B0i6FGLk.js} +1 -1
  19. package/static/dashboard/assets/{arrow-left-BePtugkE.js → arrow-left-BdulZ2N2.js} +1 -1
  20. package/static/dashboard/assets/avatar-CaEv2hMS.js +1 -0
  21. package/static/dashboard/assets/{badge-VIGkRs4v.js → badge-CTKpfsRI.js} +1 -1
  22. package/static/dashboard/assets/{card-BI3eAi_u.js → card-CGjT73CQ.js} +1 -1
  23. package/static/dashboard/assets/{check-BWPSlb5c.js → check-DOzkll0G.js} +1 -1
  24. package/static/dashboard/assets/{chevron-down-rCu-Llo-.js → chevron-down-C-tz7Ypu.js} +1 -1
  25. package/static/dashboard/assets/{chevron-right-CEWgWiw7.js → chevron-right-DoJvWwhg.js} +1 -1
  26. package/static/dashboard/assets/{copy-DqKLS4Wq.js → copy-CeZ_egx3.js} +1 -1
  27. package/static/dashboard/assets/dialog-BQKOXDHO.js +6 -0
  28. package/static/dashboard/assets/{dropdown-menu-8UzHM47U.js → dropdown-menu-JwoQU2iu.js} +3 -3
  29. package/static/dashboard/assets/{forgot-BkiP4xvQ.js → forgot-B0XXho6c.js} +1 -1
  30. package/static/dashboard/assets/{image-off-Ccb5M8cE.js → image-off-Bqobgs6b.js} +1 -1
  31. package/static/dashboard/assets/{index-N-I90MR_.js → index-DAdE1N-R.js} +3 -3
  32. package/static/dashboard/assets/inertValue-C7RCWgtk.js +1 -0
  33. package/static/dashboard/assets/{invite-BjcujTlZ.js → invite-BnuAkGJV.js} +1 -1
  34. package/static/dashboard/assets/isElementDisabled-CwHw_lZC.js +1 -0
  35. package/static/dashboard/assets/{label-BasLSUbe.js → label-ComnO04i.js} +1 -1
  36. package/static/dashboard/assets/{layout-grid-0UvojwDX.js → layout-grid-DFwgnnTY.js} +1 -1
  37. package/static/dashboard/assets/me-CPtVQtAA.js +1 -0
  38. package/static/dashboard/assets/{parts-D5D8UvJZ.js → parts-CmbgXJj-.js} +1 -1
  39. package/static/dashboard/assets/{plus-CY7ZoXBb.js → plus-BvOlN259.js} +1 -1
  40. package/static/dashboard/assets/{reset-CM1Lbm5Y.js → reset-Bh0sMyz7.js} +1 -1
  41. package/static/dashboard/assets/{s._site-qjz6oyIe.js → s._site-CWq3mZQw.js} +1 -1
  42. package/static/dashboard/assets/{s._site.comments-g2SJ-ibY.js → s._site.comments-CeTjN5Kp.js} +3 -3
  43. package/static/dashboard/assets/s._site.reviewers-Bug-Q-ge.js +1 -0
  44. package/static/dashboard/assets/s._site.settings-DKcZEHhs.js +1 -0
  45. package/static/dashboard/assets/serializeValue-B8e3iXO-.js +1 -0
  46. package/static/dashboard/assets/{setup-CYOlLmfs.js → setup-Iu06TDZs.js} +1 -1
  47. package/static/dashboard/assets/{sign-in-Cgz8eQ3f.js → sign-in-B0OEOoe5.js} +1 -1
  48. package/static/dashboard/assets/{sign-up-3lt50o_b.js → sign-up-BeFiwRrx.js} +1 -1
  49. package/static/dashboard/assets/sites-BE9RqJnf.js +1 -0
  50. package/static/dashboard/assets/{studio-CpQminn4.js → studio-Cg1Oy1vK.js} +1 -1
  51. package/static/dashboard/assets/studio-DllMPJ8r.js +1 -0
  52. package/static/dashboard/assets/studio.index-DLNyob4p.js +1 -0
  53. package/static/dashboard/assets/studio.integrations-Db87XYUB.js +1 -0
  54. package/static/dashboard/assets/{studio.members-zPXfLzqQ.js → studio.members-KAqQDCv5.js} +2 -2
  55. package/static/dashboard/assets/studio.plan-5xTPUYos.js +1 -0
  56. package/static/dashboard/assets/{sun-BBapmFM7.js → sun-BlID8y0w.js} +1 -1
  57. package/static/dashboard/assets/{switch-Bsz6KmWY.js → switch-BnkPAxu8.js} +1 -1
  58. package/static/dashboard/assets/{table-DzETz1FN.js → table-BBCwsDcH.js} +1 -1
  59. package/static/dashboard/assets/{useAriaLabelledBy-G2WKNZQz.js → useAriaLabelledBy-DBIPA8TM.js} +1 -1
  60. package/static/dashboard/assets/{useBaseQuery-CN0OIcOk.js → useBaseQuery-CgPeQebj.js} +1 -1
  61. package/static/dashboard/assets/useCompositeItem-CU7GSvP-.js +1 -0
  62. package/static/dashboard/assets/useQuery-Bt47w3ja.js +1 -0
  63. package/static/dashboard/assets/useRender-DQYQmhIj.js +1 -0
  64. package/static/dashboard/assets/{useValueChanged-CtiAjxsm.js → useValueChanged-uYr-YTth.js} +1 -1
  65. package/static/dashboard/assets/{users-xtSDzXF_.js → users-CDypTaZ2.js} +1 -1
  66. package/static/dashboard/assets/welcome-CFlCPiEh.js +11 -0
  67. package/static/dashboard/assets/{widget-signin-TVLP12BC.js → widget-signin-BL4LoDmO.js} +1 -1
  68. package/static/dashboard/assets/you-BFacaF4g.js +1 -0
  69. package/static/dashboard/assets/{zod-BXmCiwU1.js → zod-BfBWjDq8.js} +1 -1
  70. package/static/dashboard/index.html +1 -1
  71. package/static/widget/build.json +2 -2
  72. package/static/widget/snag.js +1 -1
  73. package/static/widget/snag.runtime.js +1 -1
  74. package/static/dashboard/assets/CompositeItem-BTXT0lX3.js +0 -1
  75. package/static/dashboard/assets/InstallTag-w7NKoYXb.js +0 -1
  76. package/static/dashboard/assets/InstanceRows-BIZM7ybm.js +0 -1
  77. package/static/dashboard/assets/avatar-CVYnp83R.js +0 -1
  78. package/static/dashboard/assets/dialog-CcUiqZEq.js +0 -6
  79. package/static/dashboard/assets/me-D4xGiOon.js +0 -1
  80. package/static/dashboard/assets/s._site.reviewers-Dpth1JRK.js +0 -1
  81. package/static/dashboard/assets/s._site.settings-p9OdU758.js +0 -1
  82. package/static/dashboard/assets/serializeValue-DRMAHja_.js +0 -1
  83. package/static/dashboard/assets/sites-C9rP2ynx.js +0 -1
  84. package/static/dashboard/assets/studio-CMVnubeo.js +0 -1
  85. package/static/dashboard/assets/studio.index-CkTmhLMH.js +0 -1
  86. package/static/dashboard/assets/studio.integrations-ChEjzS_W.js +0 -1
  87. package/static/dashboard/assets/studio.plan-DnwQn2IX.js +0 -1
  88. package/static/dashboard/assets/useQuery-OxQw-0wS.js +0 -1
  89. package/static/dashboard/assets/useRender-B_SZ1tbi.js +0 -1
  90. package/static/dashboard/assets/welcome-CUouc6FU.js +0 -11
  91. package/static/dashboard/assets/you-C6Mc4irF.js +0 -1
@@ -1,4 +1,4 @@
1
- import{u as ht,a as ft,b as xt,c as O,d as je,r as o,e as L,f as ce,g as mt,j as e,B as Z,h as w,i as ne,m as ye,E as bt,k as Se,l as fe,n as vt,o as jt,p as ae,q as K,S as yt,s as ee,t as St,L as _,v as wt,M as Nt,w as Ct,x as kt,y as Tt,z as Pt,A as $e,O as Rt}from"./index-N-I90MR_.js";import{u as we}from"./useQuery-OxQw-0wS.js";import{T as Mt,i as Be,a as Et,D as Ot,b as Dt,c as It,X as At,d as _t,e as zt,f as Ht,g as Lt,R as $t,p as Bt,h as Ft,j as Ut,k as qt,P as Gt,l as Vt,u as Kt,m as Yt,n as Wt,o as Xt,q as Qt,r as Jt,s as Zt,t as es,v as ts,w as ss,x as ns,y as as,z as rs,A as os,F as is,B as ls,C as ds,E as Fe,G as Ue,H as qe,I as cs,J as us,K as ps}from"./dialog-CcUiqZEq.js";import{c as B,n as Ge,g as gs,a as xe,t as hs,d as fs,i as xs,u as ms,b as ue,L as bs,I as vs}from"./label-BasLSUbe.js";import{g as me,u as js,a as ys,b as Ss,s as ws,c as Ns,d as Cs,S as Ve,E as J,D as re,e as oe,f as ie,h as Ne,i as te,j as I,k as V,l as ks,m as pe}from"./dropdown-menu-8UzHM47U.js";import{u as Ts,a as Ps,g as Rs,A as Ms,b as Es}from"./avatar-CVYnp83R.js";import{u as Ke}from"./useRender-B_SZ1tbi.js";import{S as Os,i as Ds,a as Is}from"./labels--UUyt9uB.js";import{u as le}from"./me-D4xGiOon.js";import{L as se}from"./layout-grid-0UvojwDX.js";import{U as be}from"./users-xtSDzXF_.js";import{c as As}from"./update-duXzIzFS.js";import{P as Ye}from"./plus-CY7ZoXBb.js";import{M as _s,S as zs,a as Hs}from"./sun-BBapmFM7.js";import"./useBaseQuery-CN0OIcOk.js";import"./check-BWPSlb5c.js";import"./CompositeList-CP60mNVK.js";import"./CompositeItem-BTXT0lX3.js";import"./useValueChanged-CtiAjxsm.js";function Ls(t){const s=ht({warn:t?.router===void 0}),n=t?.router||s;return ft(n.stores.__store,xt(t,n))}/**
1
+ import{u as ht,a as ft,b as xt,c as O,d as je,r as o,e as L,f as ce,g as mt,j as e,B as Z,h as w,i as ne,m as ye,E as bt,k as Se,l as fe,n as vt,o as jt,p as ae,q as K,S as yt,s as ee,t as St,L as _,v as wt,M as Nt,w as Ct,x as kt,y as Tt,z as Pt,A as $e,O as Rt}from"./index-DAdE1N-R.js";import{u as we}from"./useQuery-Bt47w3ja.js";import{T as Mt,i as Be,a as Et,D as Ot,b as Dt,c as It,X as At,d as _t,e as zt,f as Ht,g as Lt,R as $t,p as Bt,h as Ft,j as Ut,k as qt,P as Gt,l as Vt,u as Kt,m as Yt,n as Wt,o as Xt,q as Qt,r as Jt,s as Zt,t as es,v as ts,w as ss,x as ns,y as as,z as rs,F as os,A as is,B as ls,C as Fe,E as Ue,G as qe,H as ds,I as cs,J as us}from"./dialog-BQKOXDHO.js";import{c as B,n as Ge,g as ps,a as xe,t as gs,d as hs,i as fs,u as xs,b as ue,L as ms,I as bs}from"./label-ComnO04i.js";import{g as me,u as vs,a as js,b as ys,s as Ss,c as ws,d as Ns,S as Ve,E as J,D as re,e as oe,f as ie,h as Ne,i as te,j as I,k as V,l as Cs,m as pe}from"./dropdown-menu-JwoQU2iu.js";import{u as ks,a as Ts,g as Ps,A as Rs,b as Ms}from"./avatar-CaEv2hMS.js";import{u as Es}from"./inertValue-C7RCWgtk.js";import{u as Ke}from"./useRender-DQYQmhIj.js";import{S as Os,i as Ds,a as Is}from"./labels--UUyt9uB.js";import{u as le}from"./me-CPtVQtAA.js";import{L as se}from"./layout-grid-DFwgnnTY.js";import{U as be}from"./users-CDypTaZ2.js";import{c as As}from"./update-duXzIzFS.js";import{P as Ye}from"./plus-BvOlN259.js";import{M as _s,S as zs,a as Hs}from"./sun-BlID8y0w.js";import"./useBaseQuery-CgPeQebj.js";import"./check-DOzkll0G.js";import"./CompositeList-Dwya2aET.js";import"./CompositeItem-Dlay6yU9.js";import"./useCompositeItem-CU7GSvP-.js";import"./useValueChanged-uYr-YTth.js";function Ls(t){const s=ht({warn:t?.router===void 0}),n=t?.router||s;return ft(n.stores.__store,xt(t,n))}/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -58,4 +58,4 @@ import{u as ht,a as ft,b as xt,c as O,d as je,r as o,e as L,f as ce,g as mt,j as
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const tn=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ze=O("user",tn),sn=[["mcp-tokens"],["instance"],["integrations"],["invites"],["members"]];function nn(){const t=le().user.role,s=je(),n=o.useRef(t);o.useEffect(()=>{if(n.current!==t){n.current=t;for(const a of sn)s.resetQueries({queryKey:a})}},[t,s])}const ge=768;function an(){const[t,s]=o.useState(void 0);return o.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ge-1}px)`),a=()=>{s(window.innerWidth<ge)};return n.addEventListener("change",a),s(window.innerWidth<ge),()=>n.removeEventListener("change",a)},[]),!!t}const rn=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Mt,currentIdRef:{current:null},currentContextRef:{current:null}});function on(t,s){t.current=s.current}function ln(t,s={open:!1}){const{open:n}=s,a="rootStore"in t?t.rootStore:t,r=a.useState("floatingId"),p=o.useContext(rn),{currentIdRef:d,delayRef:i,timeoutMs:x,initialDelayRef:c,currentContextRef:g,hasProvider:b,timeout:f}=p,[j,l]=o.useState(!1),S=o.useRef(n);return L(()=>{S.current=n},[n]),L(()=>{function h(){g.current?.setIsInstantPhase(!1),d.current=null,g.current=null,i.current=c.current,f.clear()}if(d.current&&!n&&d.current===r){if(l(!1),x){const m=r;return f.start(x,()=>{a.select("open")||d.current&&d.current!==m||h()}),()=>{(S.current||d.current!==m)&&f.clear()}}h()}},[n,r,d,i,x,c,g,f,a]),L(()=>{if(!n)return;const h=g.current,m=d.current;f.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:l},d.current=r,i.current={open:0,close:me(c.current,"close")},m!==null&&m!==r?(l(!0),h?.setIsInstantPhase(!0),h?.onOpenChange(!1,B(Ge))):(l(!1),h?.setIsInstantPhase(!1))},[n,r,a,d,i,c,g,f]),L(()=>()=>{if(d.current===r){if(g.current=null,!S.current)return;d.current=null,on(i,c),f.clear()}},[g,d,i,r,c,f]),o.useMemo(()=>({hasProvider:b,delayRef:i,isInstantPhase:j}),[b,i,j])}function dn(t,s){let n=null,a=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const p=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=s.axis==="x"||s.axis==="both",i=s.axis==="y"||s.axis==="both",x=["mouseenter","mousemove"].includes(s.dataRef.current.openEvent?.type||"")&&s.pointerType!=="touch";let c=p.width,g=p.height,b=p.x,f=p.y;return n==null&&s.x&&d&&(n=p.x-s.x),a==null&&s.y&&i&&(a=p.y-s.y),b-=n||0,f-=a||0,c=0,g=0,!r||x?(c=s.axis==="y"?p.width:0,g=s.axis==="x"?p.height:0,b=d&&s.x!=null?s.x:b,f=i&&s.y!=null?s.y:f):r&&!x&&(g=s.axis==="x"?p.height:g,c=s.axis==="y"?p.width:c),r=!0,{width:c,height:g,x:b,y:f,top:f,right:b+c,bottom:f+g,left:b}}}}function Ae(t){return t!=null&&t.clientX!=null}function cn(t,s={}){const{enabled:n=!0,axis:a="both"}=s,r="rootStore"in t?t.rootStore:t,p=r.useState("open"),d=r.useState("floatingElement"),i=r.useState("domReferenceElement"),x=r.context.dataRef,c=o.useRef(!1),g=o.useRef(null),[b,f]=o.useState(),[j,l]=o.useState([]),S=ce(v=>{r.set("positionReference",v)}),h=ce((v,y,R)=>{c.current||x.current.openEvent&&!Ae(x.current.openEvent)||r.set("positionReference",dn(R??i,{x:v,y,axis:a,dataRef:x,pointerType:b}))}),m=ce(v=>{p?g.current||(h(v.clientX,v.clientY,v.currentTarget),l([])):h(v.clientX,v.clientY,v.currentTarget)}),C=Be(b)?d:p;o.useEffect(()=>{if(!n){S(i);return}if(!C)return;function v(){g.current?.(),g.current=null}const y=mt(d);function R(P){const u=gs(P);xe(d,u)?v():h(P.clientX,P.clientY)}return!x.current.openEvent||Ae(x.current.openEvent)?g.current=Et(y,"mousemove",R):S(i),v},[C,n,d,x,i,r,h,S,j]),o.useEffect(()=>()=>{r.set("positionReference",null)},[r]),o.useEffect(()=>{n&&!d&&(c.current=!1)},[n,d]),o.useEffect(()=>{!n&&p&&(c.current=!0)},[n,p]);const N=o.useMemo(()=>{function v(y){f(y.pointerType)}return{onPointerDown:v,onPointerEnter:v,onMouseMove:m,onMouseEnter:m}},[m]);return o.useMemo(()=>n?{reference:N,trigger:N}:{},[n,N])}function un({...t}){return e.jsx(Ot,{"data-slot":"sheet",...t})}function pn({...t}){return e.jsx(Ht,{"data-slot":"sheet-portal",...t})}function gn({className:t,...s}){return e.jsx(Lt,{"data-slot":"sheet-overlay",className:w("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",t),...s})}function hn({className:t,children:s,side:n="right",showCloseButton:a=!0,...r}){return e.jsxs(pn,{children:[e.jsx(gn,{}),e.jsxs(Dt,{"data-slot":"sheet-content","data-side":n,className:w("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...r,children:[s,a&&e.jsxs(It,{"data-slot":"sheet-close",render:e.jsx(Z,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[e.jsx(At,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fn({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:w("flex flex-col gap-0.5 p-4",t),...s})}function xn({className:t,...s}){return e.jsx(_t,{"data-slot":"sheet-title",className:w("font-heading text-base font-medium text-foreground",t),...s})}function mn({className:t,...s}){return e.jsx(zt,{"data-slot":"sheet-description",className:w("text-sm text-muted-foreground",t),...s})}const et=o.createContext(void 0);function Y(t){const s=o.useContext(et);if(s===void 0&&!t)throw new Error(ne(72));return s}const bn={...Bt,disabled:t=>t.disabled,instantType:t=>t.instantType,isInstantPhase:t=>t.isInstantPhase,trackCursorAxis:t=>t.trackCursorAxis,disableHoverablePopup:t=>t.disableHoverablePopup,lastOpenChangeReason:t=>t.openChangeReason,closeOnClick:t=>t.closeOnClick,closeDelay:t=>t.closeDelay,adaptiveOrigin:t=>t.adaptiveOrigin};class vn extends $t{constructor(s,n,a){const r=new Gt;super(jn(s,r,n,a),yn(r),bn)}setOpen=(s,n)=>{Ft(this,s,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(s){this.state.floatingRootContext.dispatchOpenChange(!1,B(hs,s))}}function jn(t,s,n,a=!1){const r={...Ut(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...t};return r.floatingRootContext=qt(s,n,a),r}function yn(t){return{popupRef:o.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:t}}const Sn=Vt(function(s){const{disabled:n=!1,defaultOpen:a=!1,open:r,disableHoverablePopup:p=!1,trackCursorAxis:d="none",actionsRef:i,onOpenChange:x,onOpenChangeComplete:c,handle:g,triggerId:b,defaultTriggerId:f=null,children:j}=s,l=Kt(($,F)=>new vn({open:a,openProp:r,activeTriggerId:f,triggerIdProp:b},$,F));l.useControlledProp("openProp",r),l.useControlledProp("triggerIdProp",b),l.useContextCallback("onOpenChange",x),l.useContextCallback("onOpenChangeComplete",c);const S=l.useState("open"),h=!n&&S,m=l.useState("activeTriggerId"),C=l.useState("mounted"),N=l.useState("payload");l.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:p,disabled:n}),Yt(l,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:v,transitionStatus:y}=Wt(h,l),R=l.useState("isInstantPhase"),P=l.useState("instantType"),u=l.useState("lastOpenChangeReason"),k=o.useRef(null);L(()=>{S&&n&&l.setOpen(!1,B(fs))},[S,n,l]),L(()=>{y==="ending"&&u===Ge||y!=="ending"&&R?(P!=="delay"&&(k.current=P),l.set("instantType","delay")):k.current!==null&&(l.set("instantType",k.current),k.current=null)},[y,R,u,P,l]),L(()=>{h&&m==null&&l.set("payload",void 0)},[l,m,h]),o.useImperativeHandle(i,()=>({unmount:v,close:()=>l.setOpen(!1,B(xs))}),[v,l]);const A=h||C||!n&&d!=="none";return e.jsxs(et.Provider,{value:l,children:[g&&e.jsx(Xt,{handle:g,store:l}),A&&e.jsx(wn,{store:l,disabled:n,trackCursorAxis:d}),typeof j=="function"?j({payload:N}):j]})});function wn({store:t,disabled:s,trackCursorAxis:n}){const a=t.useState("floatingRootContext"),r=Qt(a,{enabled:!s,referencePress:()=>t.select("closeOnClick")}),p=cn(a,{enabled:!s&&n!=="none",axis:n==="none"?void 0:n}),d=o.useMemo(()=>ye(p.reference,r.reference),[p.reference,r.reference]);return Jt(t,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:r.floating??bt}),null}const Nn=o.createContext(void 0);function Cn(){return o.useContext(Nn)}const _e=600,tt="data-base-ui-tooltip-trigger";function ze(t){if("composedPath"in t){const n=t.composedPath();for(let a=0;a<n.length;a+=1){const r=n[a];if(fe(r))return r}}const s=t.target;return fe(s)?s:null}function kn(t){let s=t;for(;s;){const n=s.closest(`[${tt}]`);if(n)return n;const a=s.getRootNode();s="host"in a&&fe(a.host)?a.host:null}return null}const Tn=Zt(function(s,n){const{render:a,className:r,style:p,handle:d,payload:i,disabled:x,delay:c,closeOnClick:g=!0,closeDelay:b,id:f,...j}=s,l=Y(!0),h=js(d)??l;if(!h)throw new Error(ne(82));const m=ms(f),C=h.useState("isTriggerActive",m),N=h.useState("isOpenedByTrigger",m),v=h.useState("floatingRootContext"),y=o.useRef(null),R=c??_e,P=b??0,{registerTrigger:u,isMountedByThisTrigger:k}=es(m,y,h,{payload:i,closeOnClick:g,closeDelay:P}),A=Cn(),{delayRef:$,isInstantPhase:F,hasProvider:D}=ln(v,{open:N}),U=ys(v);h.useSyncedValue("isInstantPhase",F);const de=h.useState("disabled"),q=x??de,Pe=ts(q),Re=h.useState("trackCursorAxis"),it=h.useState("disableHoverablePopup"),G=o.useRef(!1),W=ss(),X=o.useRef(void 0);function Me(){return D?me($.current,"open")===0?0:c??A??_e:R}function Ee(T){const z=y.current;if(!z||!T)return!1;const H=kn(T);return H!==null&&H!==z&&xe(z,H)}function lt(T){const z=Ee(T);return G.current=z,z&&(U.openChangeTimeout.clear(),U.restTimeout.clear(),U.restTimeoutPending=!1,W.clear()),z}const dt=Ss(v,{enabled:!q,mouseOnly:!0,move:!1,handleClose:!it&&Re!=="both"?ws():null,restMs:Me,delay(){return b==null&&D?{close:me($.current,"close")}:{close:P}},triggerElementRef:y,isActiveTrigger:C,isClosing:()=>h.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),ct=Ns(v,{enabled:!q}).reference,ut=T=>{const z=G.current,H=ze(T),Oe=lt(H),Q=y.current,gt=Q&&H&&xe(Q,H);if(Oe&&h.select("open")&&h.select("lastOpenChangeReason")===ue){h.setOpen(!1,B(ue,T));return}if(z&&!Oe&&gt&&!Pe.current&&!h.select("open")&&Q&&Be(X.current)){const De=()=>{!G.current&&!Pe.current&&!h.select("open")&&h.setOpen(!0,B(ue,T,Q))},Ie=Me();Ie===0?(W.clear(),De()):W.start(Ie,De)}},pt=h.useState("triggerProps",k);return Se("button",s,{state:{open:N},ref:[n,u,y],props:[dt,ct,k||Re!=="none"?pt:void 0,{onMouseOver(T){ut(T.nativeEvent)},onFocus(T){Ee(ze(T.nativeEvent))&&T.preventBaseUIHandler()},onMouseLeave(){G.current=!1,W.clear(),X.current=void 0},onPointerEnter(T){X.current=T.pointerType},onPointerDown(T){X.current=T.pointerType,h.set("closeOnClick",g),g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},onClick(T){g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},id:m,"data-trigger-disabled":q?"":void 0,[tt]:q?void 0:""},j],stateAttributesMapping:ns})}),st=o.createContext(void 0);function Pn(){const t=o.useContext(st);if(t===void 0)throw new Error(ne(70));return t}const Rn=o.forwardRef(function(s,n){const{children:a,container:r,className:p,render:d,style:i,...x}=s,{node:c,subtree:g}=as({container:r,ref:n,componentProps:s,elementProps:x});return!g&&!c?null:e.jsxs(o.Fragment,{children:[g,c&&vt.createPortal(a,c)]})}),Mn=o.forwardRef(function(s,n){const{keepMounted:a=!1,...r}=s;return Y().useState("mounted")||a?e.jsx(st.Provider,{value:a,children:e.jsx(Rn,{ref:n,...r})}):null}),nt=o.createContext(void 0);function at(){const t=o.useContext(nt);if(t===void 0)throw new Error(ne(71));return t}const En=o.forwardRef(function(s,n){const{render:a,className:r,anchor:p,positionMethod:d="absolute",side:i="top",align:x="center",sideOffset:c=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:f=5,arrowPadding:j=5,sticky:l=!1,disableAnchorTracking:S=!1,collisionAvoidance:h=rs,style:m,...C}=s,N=Y(),v=Pn(),y=N.useState("open"),R=N.useState("mounted"),P=N.useState("trackCursorAxis"),u=N.useState("disableHoverablePopup"),k=N.useState("floatingRootContext"),A=N.useState("instantType"),$=N.useState("transitionStatus"),F=N.useState("adaptiveOrigin"),D=Ts({anchor:p,positionMethod:d,floatingRootContext:k,mounted:R,side:i,sideOffset:c,align:x,alignOffset:g,collisionBoundary:b,collisionPadding:f,sticky:l,arrowPadding:j,disableAnchorTracking:S,keepMounted:v,collisionAvoidance:h,adaptiveOrigin:F}),U=o.useMemo(()=>({open:y,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P!=="none"?"tracking-cursor":A}),[y,D.side,D.align,D.anchorHidden,P,A]),de=Ps(s,U,{styles:D.positionerStyles,transitionStatus:$,props:C,refs:[n,N.useStateSetter("positionerElement")],hidden:!R,inert:!y||P==="both"||u});return e.jsx(nt.Provider,{value:D,children:de})}),On=o.forwardRef(function(s,n){const{render:a,className:r,style:p,...d}=s,i=Y(),{side:x,align:c}=at(),g=i.useState("open"),b=i.useState("instantType"),f=i.useState("transitionStatus"),j=i.useState("popupProps"),l=i.useState("floatingRootContext"),S=i.useState("disabled"),h=i.useState("closeDelay");os({open:g,ref:i.context.popupRef,onComplete(){g&&i.context.onOpenChangeComplete?.(!0)}}),Cs(l,{enabled:!S,closeDelay:h});const m=i.useStateSetter("popupElement");return Se("div",s,{state:{open:g,side:x,align:c,instant:b,transitionStatus:f},ref:[n,i.context.popupRef,m],props:[is,j,Rs(f),d],stateAttributesMapping:ls})}),Dn=o.forwardRef(function(s,n){const{render:a,className:r,style:p,...d}=s,i=Y(),{arrowRef:x,side:c,align:g,arrowUncentered:b,arrowStyles:f}=at(),j=i.useState("open"),l=i.useState("instantType");return Se("div",s,{state:{open:j,side:c,align:g,uncentered:b,instant:l},ref:[n,x],props:[{style:f,"aria-hidden":!0},d],stateAttributesMapping:ds})});function In({...t}){return e.jsx(Sn,{"data-slot":"tooltip",...t})}function An({...t}){return e.jsx(Tn,{"data-slot":"tooltip-trigger",...t})}function _n({className:t,side:s="top",sideOffset:n=4,align:a="center",alignOffset:r=0,children:p,...d}){return e.jsx(Mn,{children:e.jsx(En,{align:a,alignOffset:r,side:s,sideOffset:n,className:"isolate z-50",children:e.jsxs(On,{"data-slot":"tooltip-content",className:w("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...d,children:[p,e.jsx(Dn,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const zn="sidebar_state",Hn=3600*24*7,Ln="16rem",$n="18rem",Bn="3rem",Fn="b",rt=o.createContext(null);function Te(){const t=o.useContext(rt);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Un({defaultOpen:t=!0,open:s,onOpenChange:n,className:a,style:r,children:p,...d}){const i=an(),[x,c]=o.useState(!1),[g,b]=o.useState(t),f=s??g,j=o.useCallback(m=>{const C=typeof m=="function"?m(f):m;n?n(C):b(C),document.cookie=`${zn}=${C}; path=/; max-age=${Hn}`},[n,f]),l=o.useCallback(()=>i?c(m=>!m):j(m=>!m),[i,j,c]);o.useEffect(()=>{const m=C=>{C.key===Fn&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),l())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l]);const S=f?"expanded":"collapsed",h=o.useMemo(()=>({state:S,open:f,setOpen:j,isMobile:i,openMobile:x,setOpenMobile:c,toggleSidebar:l}),[S,f,j,i,x,c,l]);return e.jsx(rt.Provider,{value:h,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Ln,"--sidebar-width-icon":Bn,...r},className:w("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...d,children:p})})}function qn({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",className:a,children:r,dir:p,...d}){const{isMobile:i,state:x,openMobile:c,setOpenMobile:g}=Te();return n==="none"?e.jsx("div",{"data-slot":"sidebar",className:w("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...d,children:r}):i?e.jsx(un,{open:c,onOpenChange:g,...d,children:e.jsxs(hn,{dir:p,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":$n},side:t,children:[e.jsxs(fn,{className:"sr-only",children:[e.jsx(xn,{children:"Sidebar"}),e.jsx(mn,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:r})]})}):e.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":x,"data-collapsible":x==="collapsed"?n:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:w("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:w("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...d,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:r})})]})}function Gn({className:t,onClick:s,...n}){const{toggleSidebar:a}=Te();return e.jsxs(Z,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:w(t),onClick:r=>{s?.(r),a()},...n,children:[e.jsx(Zs,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Vn({className:t,...s}){return e.jsx("main",{"data-slot":"sidebar-inset",className:w("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...s})}function Kn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:w("flex flex-col gap-2 p-2",t),...s})}function Yn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:w("flex flex-col gap-2 p-2",t),...s})}function Wn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:w("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s})}function He({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:w("relative flex w-full min-w-0 flex-col p-2",t),...s})}function Xn({className:t,render:s,...n}){return Ke({defaultTagName:"div",props:ye({className:w("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",t)},n),render:s,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function Le({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:w("w-full text-sm",t),...s})}function he({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:w("flex w-full min-w-0 flex-col gap-0",t),...s})}function M({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:w("group/menu-item relative",t),...s})}const Qn=jt("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function E({render:t,isActive:s=!1,variant:n="default",size:a="default",tooltip:r,className:p,...d}){const{isMobile:i,state:x}=Te(),c=Ke({defaultTagName:"button",props:ye({className:w(Qn({variant:n,size:a}),p)},d),render:r?e.jsx(An,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:s}});return r?(typeof r=="string"&&(r={children:r}),e.jsxs(In,{children:[c,e.jsx(_n,{side:"right",align:"center",hidden:x!=="collapsed"||i,...r})]})):c}function Jn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:w("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",t),...s})}function Zn({open:t,onOpenChange:s}){const n=le(),a=ae(),[r,p]=o.useState(""),[d,i]=o.useState(0),x=o.useRef(null),c=r.trim(),[g,b]=o.useState("");o.useEffect(()=>{const u=setTimeout(()=>b(c),180);return()=>clearTimeout(u)},[c]);const f=we({queryKey:["activity","search",g],queryFn:()=>ee.activity({q:g,status:"all",limit:8}),enabled:t&&g.length>=2,staleTime:3e4});o.useEffect(()=>{t||(p(""),i(0))},[t]);const j=K(n.user.role,"settings"),l=o.useMemo(()=>[{id:"s:sites",label:"Sites",icon:e.jsx(se,{className:"size-4"}),go:()=>void a({to:"/sites"})},{id:"s:activity",label:"Activity",hint:"every site, newest first",icon:e.jsx(We,{className:"size-4"}),go:()=>void a({to:"/activity"})},...j?[{id:"s:members",label:"Members",icon:e.jsx(be,{className:"size-4"}),go:()=>void a({to:"/studio/members"})},{id:"s:integrations",label:"Integrations",icon:e.jsx(Xe,{className:"size-4"}),go:()=>void a({to:"/studio/integrations"})},{id:"s:studio",label:"Studio settings",icon:e.jsx(Ce,{className:"size-4"}),go:()=>void a({to:"/studio"})}]:[],{id:"s:you",label:"You",icon:e.jsx(Ze,{className:"size-4"}),go:()=>void a({to:"/you"})}],[a,j]),S=o.useMemo(()=>n.projects.map(u=>({id:`p:${u.uid}`,label:u.name,hint:u.unresolved>0?`${u.unresolved} open`:"nothing open",icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:u.uid}})})),[n.projects,a]),h=u=>!c||u.toLowerCase().includes(c.toLowerCase()),m=[],C=S.filter(u=>h(u.label)),N=l.filter(u=>h(u.label));C.length&&m.push({title:"Sites",items:C}),N.length&&m.push({title:"Go to",items:N});const v=(f.data?.data??[]).map(u=>({id:`t:${u.id}`,label:u.latest?.body?.trim()||u.route,hint:`${u.site.name} · ${Ds(u.status)?Os[u.status]:u.status} · ${u.key}`,icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:u.site.uid},search:{thread:u.key}})}));v.length&&m.push({title:"Comments",items:v});const y=m.flatMap(u=>u.items),R=Math.min(d,Math.max(0,y.length-1)),P=u=>{u&&(s(!1),u.go())};return o.useEffect(()=>{x.current?.querySelector(`[data-at="${R}"]`)?.scrollIntoView({block:"nearest"})},[R]),e.jsx(Fe,{open:t,onOpenChange:s,children:e.jsxs(Ue,{showCloseButton:!1,className:"top-[15%] max-h-[70dvh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg",children:[e.jsx(qe,{className:"sr-only",children:"Search and go"}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[e.jsx(Ve,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:r,onChange:u=>{p(u.target.value),i(0)},onKeyDown:u=>{u.key==="ArrowDown"?(u.preventDefault(),i(k=>Math.min(k+1,y.length-1))):u.key==="ArrowUp"?(u.preventDefault(),i(k=>Math.max(k-1,0))):u.key==="Enter"&&(u.preventDefault(),P(y[R]))},placeholder:"Go to a site or a screen, or search every comment…","aria-label":"Search and go",className:"h-11 w-full bg-transparent text-[14px] outline-none placeholder:text-muted-foreground"})]}),e.jsxs("div",{ref:x,className:"min-h-0 flex-1 overflow-auto py-1.5",children:[y.length===0&&e.jsx("p",{className:"m-0 px-3 py-6 text-center text-[13px] text-muted-foreground",children:f.isFetching?"Looking…":c?`Nothing matches “${c}”.`:"Nothing here."}),m.map(u=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:u.title}),u.items.map(k=>{const A=y.indexOf(k);return e.jsxs("button",{type:"button","data-at":A,onMouseMove:()=>i(A),onClick:()=>P(k),className:w("flex w-full items-center gap-2.5 border-0 bg-transparent px-3 py-2 text-left text-[13px] text-foreground",A===R&&"bg-muted"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:k.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.label}),k.hint&&e.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:k.hint})]},k.id)})]},u.title)),f.isFetching&&y.length>0&&e.jsxs("p",{className:"m-0 flex items-center gap-1.5 px-3 py-1.5 text-[12px] text-muted-foreground",children:[e.jsx(yt,{className:"size-3"}),"Searching every site…"]})]})]})})}function ea(){const[t,s]=o.useState(!1);return o.useEffect(()=>{const n=a=>{a.key.toLowerCase()!=="k"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),s(r=>!r))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),[t,s]}const ot="https://snagset.com/docs/",ta="https://www.npmjs.com/package/@snagset/server?activeTab=versions",sa="https://snagset.com/docs/self-hosting/#upgrade";function na({children:t}){const s=le(),n=St(s),[a,r]=ea();return nn(),e.jsxs(Un,{children:[e.jsx(oa,{me:s,site:n}),e.jsxs(Vn,{className:"min-w-0",children:[e.jsx(ua,{onSearch:()=>r(!0)}),e.jsx(aa,{names:s.pendingMigrations??[],owner:s.user.role==="owner"}),s.regionMismatch&&K(s.user.role,"settings")&&e.jsx(ra,{...s.regionMismatch}),e.jsx("div",{className:"min-h-0 flex-1",children:t})]}),e.jsx(Zn,{open:a,onOpenChange:r})]})}function aa({names:t,owner:s}){return t.length?e.jsxs("div",{role:"alert",className:"mx-7 mt-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:[e.jsxs("p",{className:"m-0 font-medium",children:["The database needs an update for this version (",t.length," ",t.length===1?"migration":"migrations",")."]}),e.jsx("p",{className:"m-0 mt-0.5",children:s?e.jsxs(e.Fragment,{children:["Run ",e.jsx("code",{className:"font-mono",children:"snagset migrate"})," with this instance's ",e.jsx("code",{className:"font-mono",children:"DATABASE_URL"})," — from the project, ",e.jsx("code",{className:"font-mono",children:"pnpm migrate"}),". Until then, parts of this version may fail."]}):"Ask the studio's owner to run snagset migrate. Until then, parts of this version may fail."})]}):null}function ra({functions:t,database:s,suggest:n}){return e.jsxs("div",{role:"status",className:"mx-7 mt-4 rounded-md border border-border bg-warn-soft px-3 py-2 text-[13px]",children:[e.jsxs("p",{className:"m-0 font-medium",children:["This server runs in ",t,", but its database is in ",s," — every page waits on that distance."]}),e.jsx("p",{className:"m-0 mt-0.5 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Add ",e.jsxs("code",{className:"font-mono",children:['"regions": ["',n,'"]']})," to ",e.jsx("code",{className:"font-mono",children:"vercel.json"})," and redeploy."]}):"Run the server in the same region as the database."})]})}function oa({me:t,site:s}){const n=Ls({select:i=>i.location.pathname}),a=i=>n===i||n.startsWith(i+"/"),r=K(t.user.role,"settings"),p=we($e.setupState()),d=t.user.role==="owner"?p.data?.billingUrl:null;return e.jsxs(qn,{children:[e.jsx(Kn,{className:"px-3 pb-1 pt-3",children:e.jsx(ia,{me:t})}),e.jsxs(Wn,{children:[e.jsxs(He,{children:[e.jsx(la,{me:t,site:s}),s&&e.jsx(Le,{children:e.jsxs(he,{children:[e.jsxs(M,{children:[e.jsxs(E,{isActive:a(`/s/${s.uid}/comments`),render:e.jsx(_,{to:"/s/$site/comments",params:{site:s.uid}}),children:[e.jsx(ve,{}),e.jsx("span",{children:"Comments"})]}),s.unresolved>0&&e.jsx(Jn,{children:s.unresolved})]}),e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/reviewers`),render:e.jsx(_,{to:"/s/$site/reviewers",params:{site:s.uid}}),children:[e.jsx(be,{}),e.jsx("span",{children:"Reviewers"})]})}),r&&e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/settings`),render:e.jsx(_,{to:"/s/$site/settings",params:{site:s.uid}}),children:[e.jsx(Je,{}),e.jsx("span",{children:"Settings"})]})})]})})]}),e.jsxs(He,{children:[e.jsx(Xn,{children:"Studio"}),e.jsx(Le,{children:e.jsxs(he,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/sites"),render:e.jsx(_,{to:"/sites"}),children:[e.jsx(se,{}),e.jsx("span",{children:"Sites"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/activity"),render:e.jsx(_,{to:"/activity"}),children:[e.jsx(We,{}),e.jsx("span",{children:"Activity"})]})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/members"),render:e.jsx(_,{to:"/studio/members"}),children:[e.jsx(be,{}),e.jsx("span",{children:"Members"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/integrations"),render:e.jsx(_,{to:"/studio/integrations"}),children:[e.jsx(Xe,{}),e.jsx("span",{children:"Integrations"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:n==="/studio",render:e.jsx(_,{to:"/studio"}),children:[e.jsx(Ce,{}),e.jsx("span",{children:"General"})]})})]})]})})]})]}),e.jsx(Yn,{children:e.jsxs(he,{children:[d&&e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/plan"),render:e.jsx(_,{to:"/studio/plan"}),children:[e.jsx(Ys,{}),e.jsx("span",{children:"Plan & billing"})]})}),e.jsx(M,{children:e.jsxs(E,{render:e.jsx("a",{href:ot,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Qe,{}),e.jsx("span",{children:"Docs"}),e.jsx(J,{className:"ml-auto size-3.5 text-muted-foreground"})]})}),e.jsx(M,{children:e.jsx(da,{})}),e.jsx(M,{children:e.jsx(ca,{me:t})})]})})]})}function ia({me:t}){const s=ae(),n=je(),[a,r]=o.useState(!1),[p,d]=o.useState(""),[i,x]=o.useState(""),[c,g]=o.useState(!1),b=e.jsxs(e.Fragment,{children:[e.jsx(Nt,{size:20}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"block truncate text-[14px] font-semibold leading-tight tracking-tight",children:t.org.name}),e.jsx("span",{className:"block truncate text-[11.5px] text-muted-foreground",children:location.host})]})]}),f=K(t.user.role,"settings");if(t.orgs.length<=1&&!t.signupOpen)return f?e.jsx(_,{to:"/studio",className:"flex items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":`${t.org.name} — studio settings`,children:b}):e.jsx("div",{className:"flex items-center gap-2.5 px-1 py-0.5 text-foreground",children:b});const j=async l=>{g(!0),x("");try{await l(),n.clear(),r(!1),d(""),s({to:"/sites",replace:!0})}catch(S){x(S instanceof Error?S.message:"Something went wrong. Try again.")}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":"Switch studio"}),children:[b,e.jsx(ke,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Studios"}),t.orgs.map(l=>e.jsxs(I,{disabled:l.current,onClick:()=>void j(()=>ee.switchOrg(l.slug)),children:[e.jsx(Ce,{}),e.jsx("span",{className:"truncate",children:l.name}),l.current&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},l.slug))]}),(f||t.signupOpen)&&e.jsx(V,{}),f&&e.jsxs(I,{onClick:()=>void s({to:"/studio"}),children:[e.jsx(Je,{}),"Studio settings"]}),t.signupOpen&&e.jsxs(I,{onClick:()=>r(!0),children:[e.jsx(Ye,{}),"New studio…"]})]})]}),e.jsx(Fe,{open:a,onOpenChange:l=>!c&&r(l),children:e.jsx(Ue,{className:"sm:max-w-[420px]",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:l=>{l.preventDefault(),j(()=>ee.createOrg(p.trim()||"My studio"))},children:[e.jsxs(cs,{children:[e.jsx(qe,{children:"New studio"}),e.jsx(us,{children:"Its own sites, members and settings. You are its owner, and you move to it now — this one stays in the menu."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(bs,{htmlFor:"new-studio-name",children:"Studio name"}),e.jsx(vs,{id:"new-studio-name",value:p,onChange:l=>d(l.target.value),placeholder:"My studio",autoFocus:!0})]}),i&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:i}),e.jsxs(ps,{children:[e.jsx(Z,{type:"button",variant:"outline",onClick:()=>r(!1),disabled:c,children:"Cancel"}),e.jsx(Z,{type:"submit",loading:c,children:c?"Creating…":"Create studio"})]})]})})})]})}function la({me:t,site:s}){const n=ae();return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"mb-1 flex h-[34px] w-full items-center justify-between rounded-md border border-border bg-card px-2.5 text-[13px] font-semibold text-foreground","aria-label":"Switch site"}),children:[e.jsx("span",{className:"truncate",children:s?.name??"No sites yet"}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Sites"}),t.projects.filter(a=>!a.archived||a.uid===s?.uid).map(a=>e.jsxs(I,{onClick:()=>void n({to:"/s/$site/comments",params:{site:a.uid}}),children:[e.jsx(se,{}),e.jsx("span",{className:"truncate",children:a.name}),a.uid===s?.uid&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},a.uid))]}),e.jsx(V,{}),K(t.user.role,"settings")&&e.jsxs(I,{onClick:()=>void n({to:"/sites",search:{add:!0}}),children:[e.jsx(Ye,{}),"Add a site"]}),e.jsxs(I,{onClick:()=>void n({to:"/sites"}),children:[e.jsx(se,{}),"All sites"]})]})]})}function da(){const t=Ct(le()),s=we($e.meta()),n=s.data?.version??"",[a,r]=o.useState({state:"idle"}),p=async()=>{r({state:"checking"});try{r({state:"done",result:await As(n)})}catch{r({state:"failed"})}};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{}),children:[e.jsx(Vs,{}),e.jsx("span",{children:"Help"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[240px]",children:[e.jsxs(I,{render:e.jsx("a",{href:ot,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Qe,{}),"Docs",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsxs(I,{render:e.jsx("a",{href:ta,target:"_blank",rel:"noreferrer"}),children:["Changelog",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),s.data?.sourceUrl&&e.jsxs(I,{render:e.jsx("a",{href:s.data.sourceUrl,target:"_blank",rel:"noreferrer"}),children:["Source · AGPL",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsx(V,{}),e.jsxs("div",{className:"px-2 py-1.5 text-[12px] text-muted-foreground",children:["Snagset ",n||"—",t&&a.state==="idle"&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>void p(),children:"Check for updates"})]}),a.state==="checking"&&" · checking…",a.state==="failed"&&" · could not reach npm",a.state==="done"&&a.result&&e.jsxs(e.Fragment,{children:[" · ",a.result.newer?e.jsxs("a",{href:sa,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:[a.result.latest," is out — how to upgrade"]}):"up to date"]})]})]})]})}function ca({me:t}){const s=ae(),n=je(),[a,r]=o.useState(kt),p=t.user.name||t.user.email,d=t.user.name?t.user.email:t.user.role,i=async()=>{await ee.logout().catch(()=>{}),Pt("out"),n.clear(),s({to:"/sign-in",replace:!0})};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{size:"lg"}),children:[e.jsx(Ms,{className:"size-8 rounded-full",children:e.jsx(Es,{className:"bg-primary text-[12px] font-semibold text-primary-foreground",children:Is(t.user.name,t.user.email)})}),e.jsxs("div",{className:"min-w-0 flex-1 text-left leading-tight",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold",children:p}),e.jsx("div",{className:"truncate text-[11.5px] text-muted-foreground",children:d})]}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[250px]",children:[e.jsx(Ne,{children:e.jsxs(te,{className:"flex flex-col",children:[e.jsx("span",{className:"text-[13px] font-semibold",children:p}),e.jsx("span",{className:"text-[11.5px] font-normal text-muted-foreground",children:t.user.name?`${t.user.email} · ${t.user.role}`:t.user.role})]})}),e.jsx(V,{}),e.jsxs(ks,{value:a,onValueChange:x=>{const c=x;Tt(c),r(c)},children:[e.jsx(te,{children:"Theme"}),e.jsxs(pe,{value:"system",children:[e.jsx(_s,{}),"System"]}),e.jsxs(pe,{value:"light",children:[e.jsx(zs,{}),"Light"]}),e.jsxs(pe,{value:"dark",children:[e.jsx(Hs,{}),"Dark"]})]}),e.jsx(V,{}),e.jsxs(I,{onClick:()=>void s({to:"/you"}),children:[e.jsx(Ze,{}),"You"]}),e.jsxs(I,{onClick:()=>void i(),children:[e.jsx(Xs,{}),"Sign out"]})]})]})}function ua({onSearch:t}){const n=wt().map(a=>a.loaderData?.crumb).filter(a=>typeof a=="string"&&a.length>0);return e.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx(Gn,{className:"-ml-1"}),e.jsx("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-2 text-[13.5px] font-medium text-muted-foreground",children:n.map((a,r)=>e.jsxs("span",{className:"flex items-center gap-2",children:[r>0&&e.jsx("span",{className:"text-line-strong",children:"/"}),e.jsx("span",{className:r===n.length-1?"text-foreground":void 0,children:a})]},r))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",onClick:t,"aria-label":"Search and go",className:"flex h-7 items-center gap-2 rounded-md border border-border bg-card px-2 text-[12.5px] text-muted-foreground",children:[e.jsx(Ve,{className:"size-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"}),e.jsx("kbd",{className:"hidden rounded border border-border px-1 font-mono text-[11px] sm:inline",children:"⌘K"})]})]})}const Ia=()=>e.jsx(na,{children:e.jsx(Rt,{})});export{Ia as component};
61
+ */const tn=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ze=O("user",tn),sn=[["mcp-tokens"],["instance"],["integrations"],["invites"],["members"]];function nn(){const t=le().user.role,s=je(),n=o.useRef(t);o.useEffect(()=>{if(n.current!==t){n.current=t;for(const a of sn)s.resetQueries({queryKey:a})}},[t,s])}const ge=768;function an(){const[t,s]=o.useState(void 0);return o.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ge-1}px)`),a=()=>{s(window.innerWidth<ge)};return n.addEventListener("change",a),s(window.innerWidth<ge),()=>n.removeEventListener("change",a)},[]),!!t}const rn=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Mt,currentIdRef:{current:null},currentContextRef:{current:null}});function on(t,s){t.current=s.current}function ln(t,s={open:!1}){const{open:n}=s,a="rootStore"in t?t.rootStore:t,r=a.useState("floatingId"),p=o.useContext(rn),{currentIdRef:d,delayRef:i,timeoutMs:x,initialDelayRef:c,currentContextRef:g,hasProvider:b,timeout:f}=p,[j,l]=o.useState(!1),S=o.useRef(n);return L(()=>{S.current=n},[n]),L(()=>{function h(){g.current?.setIsInstantPhase(!1),d.current=null,g.current=null,i.current=c.current,f.clear()}if(d.current&&!n&&d.current===r){if(l(!1),x){const m=r;return f.start(x,()=>{a.select("open")||d.current&&d.current!==m||h()}),()=>{(S.current||d.current!==m)&&f.clear()}}h()}},[n,r,d,i,x,c,g,f,a]),L(()=>{if(!n)return;const h=g.current,m=d.current;f.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:l},d.current=r,i.current={open:0,close:me(c.current,"close")},m!==null&&m!==r?(l(!0),h?.setIsInstantPhase(!0),h?.onOpenChange(!1,B(Ge))):(l(!1),h?.setIsInstantPhase(!1))},[n,r,a,d,i,c,g,f]),L(()=>()=>{if(d.current===r){if(g.current=null,!S.current)return;d.current=null,on(i,c),f.clear()}},[g,d,i,r,c,f]),o.useMemo(()=>({hasProvider:b,delayRef:i,isInstantPhase:j}),[b,i,j])}function dn(t,s){let n=null,a=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const p=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=s.axis==="x"||s.axis==="both",i=s.axis==="y"||s.axis==="both",x=["mouseenter","mousemove"].includes(s.dataRef.current.openEvent?.type||"")&&s.pointerType!=="touch";let c=p.width,g=p.height,b=p.x,f=p.y;return n==null&&s.x&&d&&(n=p.x-s.x),a==null&&s.y&&i&&(a=p.y-s.y),b-=n||0,f-=a||0,c=0,g=0,!r||x?(c=s.axis==="y"?p.width:0,g=s.axis==="x"?p.height:0,b=d&&s.x!=null?s.x:b,f=i&&s.y!=null?s.y:f):r&&!x&&(g=s.axis==="x"?p.height:g,c=s.axis==="y"?p.width:c),r=!0,{width:c,height:g,x:b,y:f,top:f,right:b+c,bottom:f+g,left:b}}}}function Ae(t){return t!=null&&t.clientX!=null}function cn(t,s={}){const{enabled:n=!0,axis:a="both"}=s,r="rootStore"in t?t.rootStore:t,p=r.useState("open"),d=r.useState("floatingElement"),i=r.useState("domReferenceElement"),x=r.context.dataRef,c=o.useRef(!1),g=o.useRef(null),[b,f]=o.useState(),[j,l]=o.useState([]),S=ce(v=>{r.set("positionReference",v)}),h=ce((v,y,R)=>{c.current||x.current.openEvent&&!Ae(x.current.openEvent)||r.set("positionReference",dn(R??i,{x:v,y,axis:a,dataRef:x,pointerType:b}))}),m=ce(v=>{p?g.current||(h(v.clientX,v.clientY,v.currentTarget),l([])):h(v.clientX,v.clientY,v.currentTarget)}),C=Be(b)?d:p;o.useEffect(()=>{if(!n){S(i);return}if(!C)return;function v(){g.current?.(),g.current=null}const y=mt(d);function R(P){const u=ps(P);xe(d,u)?v():h(P.clientX,P.clientY)}return!x.current.openEvent||Ae(x.current.openEvent)?g.current=Et(y,"mousemove",R):S(i),v},[C,n,d,x,i,r,h,S,j]),o.useEffect(()=>()=>{r.set("positionReference",null)},[r]),o.useEffect(()=>{n&&!d&&(c.current=!1)},[n,d]),o.useEffect(()=>{!n&&p&&(c.current=!0)},[n,p]);const N=o.useMemo(()=>{function v(y){f(y.pointerType)}return{onPointerDown:v,onPointerEnter:v,onMouseMove:m,onMouseEnter:m}},[m]);return o.useMemo(()=>n?{reference:N,trigger:N}:{},[n,N])}function un({...t}){return e.jsx(Ot,{"data-slot":"sheet",...t})}function pn({...t}){return e.jsx(Ht,{"data-slot":"sheet-portal",...t})}function gn({className:t,...s}){return e.jsx(Lt,{"data-slot":"sheet-overlay",className:w("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",t),...s})}function hn({className:t,children:s,side:n="right",showCloseButton:a=!0,...r}){return e.jsxs(pn,{children:[e.jsx(gn,{}),e.jsxs(Dt,{"data-slot":"sheet-content","data-side":n,className:w("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...r,children:[s,a&&e.jsxs(It,{"data-slot":"sheet-close",render:e.jsx(Z,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[e.jsx(At,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fn({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:w("flex flex-col gap-0.5 p-4",t),...s})}function xn({className:t,...s}){return e.jsx(_t,{"data-slot":"sheet-title",className:w("font-heading text-base font-medium text-foreground",t),...s})}function mn({className:t,...s}){return e.jsx(zt,{"data-slot":"sheet-description",className:w("text-sm text-muted-foreground",t),...s})}const et=o.createContext(void 0);function Y(t){const s=o.useContext(et);if(s===void 0&&!t)throw new Error(ne(72));return s}const bn={...Bt,disabled:t=>t.disabled,instantType:t=>t.instantType,isInstantPhase:t=>t.isInstantPhase,trackCursorAxis:t=>t.trackCursorAxis,disableHoverablePopup:t=>t.disableHoverablePopup,lastOpenChangeReason:t=>t.openChangeReason,closeOnClick:t=>t.closeOnClick,closeDelay:t=>t.closeDelay,adaptiveOrigin:t=>t.adaptiveOrigin};class vn extends $t{constructor(s,n,a){const r=new Gt;super(jn(s,r,n,a),yn(r),bn)}setOpen=(s,n)=>{Ft(this,s,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(s){this.state.floatingRootContext.dispatchOpenChange(!1,B(gs,s))}}function jn(t,s,n,a=!1){const r={...Ut(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...t};return r.floatingRootContext=qt(s,n,a),r}function yn(t){return{popupRef:o.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:t}}const Sn=Vt(function(s){const{disabled:n=!1,defaultOpen:a=!1,open:r,disableHoverablePopup:p=!1,trackCursorAxis:d="none",actionsRef:i,onOpenChange:x,onOpenChangeComplete:c,handle:g,triggerId:b,defaultTriggerId:f=null,children:j}=s,l=Kt(($,F)=>new vn({open:a,openProp:r,activeTriggerId:f,triggerIdProp:b},$,F));l.useControlledProp("openProp",r),l.useControlledProp("triggerIdProp",b),l.useContextCallback("onOpenChange",x),l.useContextCallback("onOpenChangeComplete",c);const S=l.useState("open"),h=!n&&S,m=l.useState("activeTriggerId"),C=l.useState("mounted"),N=l.useState("payload");l.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:p,disabled:n}),Yt(l,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:v,transitionStatus:y}=Wt(h,l),R=l.useState("isInstantPhase"),P=l.useState("instantType"),u=l.useState("lastOpenChangeReason"),k=o.useRef(null);L(()=>{S&&n&&l.setOpen(!1,B(hs))},[S,n,l]),L(()=>{y==="ending"&&u===Ge||y!=="ending"&&R?(P!=="delay"&&(k.current=P),l.set("instantType","delay")):k.current!==null&&(l.set("instantType",k.current),k.current=null)},[y,R,u,P,l]),L(()=>{h&&m==null&&l.set("payload",void 0)},[l,m,h]),o.useImperativeHandle(i,()=>({unmount:v,close:()=>l.setOpen(!1,B(fs))}),[v,l]);const A=h||C||!n&&d!=="none";return e.jsxs(et.Provider,{value:l,children:[g&&e.jsx(Xt,{handle:g,store:l}),A&&e.jsx(wn,{store:l,disabled:n,trackCursorAxis:d}),typeof j=="function"?j({payload:N}):j]})});function wn({store:t,disabled:s,trackCursorAxis:n}){const a=t.useState("floatingRootContext"),r=Qt(a,{enabled:!s,referencePress:()=>t.select("closeOnClick")}),p=cn(a,{enabled:!s&&n!=="none",axis:n==="none"?void 0:n}),d=o.useMemo(()=>ye(p.reference,r.reference),[p.reference,r.reference]);return Jt(t,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:r.floating??bt}),null}const Nn=o.createContext(void 0);function Cn(){return o.useContext(Nn)}const _e=600,tt="data-base-ui-tooltip-trigger";function ze(t){if("composedPath"in t){const n=t.composedPath();for(let a=0;a<n.length;a+=1){const r=n[a];if(fe(r))return r}}const s=t.target;return fe(s)?s:null}function kn(t){let s=t;for(;s;){const n=s.closest(`[${tt}]`);if(n)return n;const a=s.getRootNode();s="host"in a&&fe(a.host)?a.host:null}return null}const Tn=Zt(function(s,n){const{render:a,className:r,style:p,handle:d,payload:i,disabled:x,delay:c,closeOnClick:g=!0,closeDelay:b,id:f,...j}=s,l=Y(!0),h=vs(d)??l;if(!h)throw new Error(ne(82));const m=xs(f),C=h.useState("isTriggerActive",m),N=h.useState("isOpenedByTrigger",m),v=h.useState("floatingRootContext"),y=o.useRef(null),R=c??_e,P=b??0,{registerTrigger:u,isMountedByThisTrigger:k}=es(m,y,h,{payload:i,closeOnClick:g,closeDelay:P}),A=Cn(),{delayRef:$,isInstantPhase:F,hasProvider:D}=ln(v,{open:N}),U=js(v);h.useSyncedValue("isInstantPhase",F);const de=h.useState("disabled"),q=x??de,Pe=ts(q),Re=h.useState("trackCursorAxis"),it=h.useState("disableHoverablePopup"),G=o.useRef(!1),W=ss(),X=o.useRef(void 0);function Me(){return D?me($.current,"open")===0?0:c??A??_e:R}function Ee(T){const z=y.current;if(!z||!T)return!1;const H=kn(T);return H!==null&&H!==z&&xe(z,H)}function lt(T){const z=Ee(T);return G.current=z,z&&(U.openChangeTimeout.clear(),U.restTimeout.clear(),U.restTimeoutPending=!1,W.clear()),z}const dt=ys(v,{enabled:!q,mouseOnly:!0,move:!1,handleClose:!it&&Re!=="both"?Ss():null,restMs:Me,delay(){return b==null&&D?{close:me($.current,"close")}:{close:P}},triggerElementRef:y,isActiveTrigger:C,isClosing:()=>h.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),ct=ws(v,{enabled:!q}).reference,ut=T=>{const z=G.current,H=ze(T),Oe=lt(H),Q=y.current,gt=Q&&H&&xe(Q,H);if(Oe&&h.select("open")&&h.select("lastOpenChangeReason")===ue){h.setOpen(!1,B(ue,T));return}if(z&&!Oe&&gt&&!Pe.current&&!h.select("open")&&Q&&Be(X.current)){const De=()=>{!G.current&&!Pe.current&&!h.select("open")&&h.setOpen(!0,B(ue,T,Q))},Ie=Me();Ie===0?(W.clear(),De()):W.start(Ie,De)}},pt=h.useState("triggerProps",k);return Se("button",s,{state:{open:N},ref:[n,u,y],props:[dt,ct,k||Re!=="none"?pt:void 0,{onMouseOver(T){ut(T.nativeEvent)},onFocus(T){Ee(ze(T.nativeEvent))&&T.preventBaseUIHandler()},onMouseLeave(){G.current=!1,W.clear(),X.current=void 0},onPointerEnter(T){X.current=T.pointerType},onPointerDown(T){X.current=T.pointerType,h.set("closeOnClick",g),g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},onClick(T){g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},id:m,"data-trigger-disabled":q?"":void 0,[tt]:q?void 0:""},j],stateAttributesMapping:ns})}),st=o.createContext(void 0);function Pn(){const t=o.useContext(st);if(t===void 0)throw new Error(ne(70));return t}const Rn=o.forwardRef(function(s,n){const{children:a,container:r,className:p,render:d,style:i,...x}=s,{node:c,subtree:g}=as({container:r,ref:n,componentProps:s,elementProps:x});return!g&&!c?null:e.jsxs(o.Fragment,{children:[g,c&&vt.createPortal(a,c)]})}),Mn=o.forwardRef(function(s,n){const{keepMounted:a=!1,...r}=s;return Y().useState("mounted")||a?e.jsx(st.Provider,{value:a,children:e.jsx(Rn,{ref:n,...r})}):null}),nt=o.createContext(void 0);function at(){const t=o.useContext(nt);if(t===void 0)throw new Error(ne(71));return t}const En=o.forwardRef(function(s,n){const{render:a,className:r,anchor:p,positionMethod:d="absolute",side:i="top",align:x="center",sideOffset:c=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:f=5,arrowPadding:j=5,sticky:l=!1,disableAnchorTracking:S=!1,collisionAvoidance:h=rs,style:m,...C}=s,N=Y(),v=Pn(),y=N.useState("open"),R=N.useState("mounted"),P=N.useState("trackCursorAxis"),u=N.useState("disableHoverablePopup"),k=N.useState("floatingRootContext"),A=N.useState("instantType"),$=N.useState("transitionStatus"),F=N.useState("adaptiveOrigin"),D=ks({anchor:p,positionMethod:d,floatingRootContext:k,mounted:R,side:i,sideOffset:c,align:x,alignOffset:g,collisionBoundary:b,collisionPadding:f,sticky:l,arrowPadding:j,disableAnchorTracking:S,keepMounted:v,collisionAvoidance:h,adaptiveOrigin:F}),U=o.useMemo(()=>({open:y,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P!=="none"?"tracking-cursor":A}),[y,D.side,D.align,D.anchorHidden,P,A]),de=Ts(s,U,{styles:D.positionerStyles,transitionStatus:$,props:C,refs:[n,N.useStateSetter("positionerElement")],hidden:!R,inert:!y||P==="both"||u});return e.jsx(nt.Provider,{value:D,children:de})}),On=o.forwardRef(function(s,n){const{render:a,className:r,style:p,...d}=s,i=Y(),{side:x,align:c}=at(),g=i.useState("open"),b=i.useState("instantType"),f=i.useState("transitionStatus"),j=i.useState("popupProps"),l=i.useState("floatingRootContext"),S=i.useState("disabled"),h=i.useState("closeDelay");Es({open:g,ref:i.context.popupRef,onComplete(){g&&i.context.onOpenChangeComplete?.(!0)}}),Ns(l,{enabled:!S,closeDelay:h});const m=i.useStateSetter("popupElement");return Se("div",s,{state:{open:g,side:x,align:c,instant:b,transitionStatus:f},ref:[n,i.context.popupRef,m],props:[os,j,Ps(f),d],stateAttributesMapping:is})}),Dn=o.forwardRef(function(s,n){const{render:a,className:r,style:p,...d}=s,i=Y(),{arrowRef:x,side:c,align:g,arrowUncentered:b,arrowStyles:f}=at(),j=i.useState("open"),l=i.useState("instantType");return Se("div",s,{state:{open:j,side:c,align:g,uncentered:b,instant:l},ref:[n,x],props:[{style:f,"aria-hidden":!0},d],stateAttributesMapping:ls})});function In({...t}){return e.jsx(Sn,{"data-slot":"tooltip",...t})}function An({...t}){return e.jsx(Tn,{"data-slot":"tooltip-trigger",...t})}function _n({className:t,side:s="top",sideOffset:n=4,align:a="center",alignOffset:r=0,children:p,...d}){return e.jsx(Mn,{children:e.jsx(En,{align:a,alignOffset:r,side:s,sideOffset:n,className:"isolate z-50",children:e.jsxs(On,{"data-slot":"tooltip-content",className:w("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...d,children:[p,e.jsx(Dn,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const zn="sidebar_state",Hn=3600*24*7,Ln="16rem",$n="18rem",Bn="3rem",Fn="b",rt=o.createContext(null);function Te(){const t=o.useContext(rt);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Un({defaultOpen:t=!0,open:s,onOpenChange:n,className:a,style:r,children:p,...d}){const i=an(),[x,c]=o.useState(!1),[g,b]=o.useState(t),f=s??g,j=o.useCallback(m=>{const C=typeof m=="function"?m(f):m;n?n(C):b(C),document.cookie=`${zn}=${C}; path=/; max-age=${Hn}`},[n,f]),l=o.useCallback(()=>i?c(m=>!m):j(m=>!m),[i,j,c]);o.useEffect(()=>{const m=C=>{C.key===Fn&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),l())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l]);const S=f?"expanded":"collapsed",h=o.useMemo(()=>({state:S,open:f,setOpen:j,isMobile:i,openMobile:x,setOpenMobile:c,toggleSidebar:l}),[S,f,j,i,x,c,l]);return e.jsx(rt.Provider,{value:h,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Ln,"--sidebar-width-icon":Bn,...r},className:w("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...d,children:p})})}function qn({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",className:a,children:r,dir:p,...d}){const{isMobile:i,state:x,openMobile:c,setOpenMobile:g}=Te();return n==="none"?e.jsx("div",{"data-slot":"sidebar",className:w("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...d,children:r}):i?e.jsx(un,{open:c,onOpenChange:g,...d,children:e.jsxs(hn,{dir:p,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":$n},side:t,children:[e.jsxs(fn,{className:"sr-only",children:[e.jsx(xn,{children:"Sidebar"}),e.jsx(mn,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:r})]})}):e.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":x,"data-collapsible":x==="collapsed"?n:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:w("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:w("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...d,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:r})})]})}function Gn({className:t,onClick:s,...n}){const{toggleSidebar:a}=Te();return e.jsxs(Z,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:w(t),onClick:r=>{s?.(r),a()},...n,children:[e.jsx(Zs,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Vn({className:t,...s}){return e.jsx("main",{"data-slot":"sidebar-inset",className:w("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...s})}function Kn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:w("flex flex-col gap-2 p-2",t),...s})}function Yn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:w("flex flex-col gap-2 p-2",t),...s})}function Wn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:w("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s})}function He({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:w("relative flex w-full min-w-0 flex-col p-2",t),...s})}function Xn({className:t,render:s,...n}){return Ke({defaultTagName:"div",props:ye({className:w("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",t)},n),render:s,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function Le({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:w("w-full text-sm",t),...s})}function he({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:w("flex w-full min-w-0 flex-col gap-0",t),...s})}function M({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:w("group/menu-item relative",t),...s})}const Qn=jt("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function E({render:t,isActive:s=!1,variant:n="default",size:a="default",tooltip:r,className:p,...d}){const{isMobile:i,state:x}=Te(),c=Ke({defaultTagName:"button",props:ye({className:w(Qn({variant:n,size:a}),p)},d),render:r?e.jsx(An,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:s}});return r?(typeof r=="string"&&(r={children:r}),e.jsxs(In,{children:[c,e.jsx(_n,{side:"right",align:"center",hidden:x!=="collapsed"||i,...r})]})):c}function Jn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:w("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",t),...s})}function Zn({open:t,onOpenChange:s}){const n=le(),a=ae(),[r,p]=o.useState(""),[d,i]=o.useState(0),x=o.useRef(null),c=r.trim(),[g,b]=o.useState("");o.useEffect(()=>{const u=setTimeout(()=>b(c),180);return()=>clearTimeout(u)},[c]);const f=we({queryKey:["activity","search",g],queryFn:()=>ee.activity({q:g,status:"all",limit:8}),enabled:t&&g.length>=2,staleTime:3e4});o.useEffect(()=>{t||(p(""),i(0))},[t]);const j=K(n.user.role,"settings"),l=o.useMemo(()=>[{id:"s:sites",label:"Sites",icon:e.jsx(se,{className:"size-4"}),go:()=>void a({to:"/sites"})},{id:"s:activity",label:"Activity",hint:"every site, newest first",icon:e.jsx(We,{className:"size-4"}),go:()=>void a({to:"/activity"})},...j?[{id:"s:members",label:"Members",icon:e.jsx(be,{className:"size-4"}),go:()=>void a({to:"/studio/members"})},{id:"s:integrations",label:"Integrations",icon:e.jsx(Xe,{className:"size-4"}),go:()=>void a({to:"/studio/integrations"})},{id:"s:studio",label:"Studio settings",icon:e.jsx(Ce,{className:"size-4"}),go:()=>void a({to:"/studio"})}]:[],{id:"s:you",label:"You",icon:e.jsx(Ze,{className:"size-4"}),go:()=>void a({to:"/you"})}],[a,j]),S=o.useMemo(()=>n.projects.map(u=>({id:`p:${u.uid}`,label:u.name,hint:u.unresolved>0?`${u.unresolved} open`:"nothing open",icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:u.uid}})})),[n.projects,a]),h=u=>!c||u.toLowerCase().includes(c.toLowerCase()),m=[],C=S.filter(u=>h(u.label)),N=l.filter(u=>h(u.label));C.length&&m.push({title:"Sites",items:C}),N.length&&m.push({title:"Go to",items:N});const v=(f.data?.data??[]).map(u=>({id:`t:${u.id}`,label:u.latest?.body?.trim()||u.route,hint:`${u.site.name} · ${Ds(u.status)?Os[u.status]:u.status} · ${u.key}`,icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:u.site.uid},search:{thread:u.key}})}));v.length&&m.push({title:"Comments",items:v});const y=m.flatMap(u=>u.items),R=Math.min(d,Math.max(0,y.length-1)),P=u=>{u&&(s(!1),u.go())};return o.useEffect(()=>{x.current?.querySelector(`[data-at="${R}"]`)?.scrollIntoView({block:"nearest"})},[R]),e.jsx(Fe,{open:t,onOpenChange:s,children:e.jsxs(Ue,{showCloseButton:!1,className:"top-[15%] max-h-[70dvh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg",children:[e.jsx(qe,{className:"sr-only",children:"Search and go"}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[e.jsx(Ve,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:r,onChange:u=>{p(u.target.value),i(0)},onKeyDown:u=>{u.key==="ArrowDown"?(u.preventDefault(),i(k=>Math.min(k+1,y.length-1))):u.key==="ArrowUp"?(u.preventDefault(),i(k=>Math.max(k-1,0))):u.key==="Enter"&&(u.preventDefault(),P(y[R]))},placeholder:"Go to a site or a screen, or search every comment…","aria-label":"Search and go",className:"h-11 w-full bg-transparent text-[14px] outline-none placeholder:text-muted-foreground"})]}),e.jsxs("div",{ref:x,className:"min-h-0 flex-1 overflow-auto py-1.5",children:[y.length===0&&e.jsx("p",{className:"m-0 px-3 py-6 text-center text-[13px] text-muted-foreground",children:f.isFetching?"Looking…":c?`Nothing matches “${c}”.`:"Nothing here."}),m.map(u=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:u.title}),u.items.map(k=>{const A=y.indexOf(k);return e.jsxs("button",{type:"button","data-at":A,onMouseMove:()=>i(A),onClick:()=>P(k),className:w("flex w-full items-center gap-2.5 border-0 bg-transparent px-3 py-2 text-left text-[13px] text-foreground",A===R&&"bg-muted"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:k.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.label}),k.hint&&e.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:k.hint})]},k.id)})]},u.title)),f.isFetching&&y.length>0&&e.jsxs("p",{className:"m-0 flex items-center gap-1.5 px-3 py-1.5 text-[12px] text-muted-foreground",children:[e.jsx(yt,{className:"size-3"}),"Searching every site…"]})]})]})})}function ea(){const[t,s]=o.useState(!1);return o.useEffect(()=>{const n=a=>{a.key.toLowerCase()!=="k"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),s(r=>!r))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),[t,s]}const ot="https://snagset.com/docs/",ta="https://www.npmjs.com/package/@snagset/server?activeTab=versions",sa="https://snagset.com/docs/self-hosting/#upgrade";function na({children:t}){const s=le(),n=St(s),[a,r]=ea();return nn(),e.jsxs(Un,{children:[e.jsx(oa,{me:s,site:n}),e.jsxs(Vn,{className:"min-w-0",children:[e.jsx(ua,{onSearch:()=>r(!0)}),e.jsx(aa,{names:s.pendingMigrations??[],owner:s.user.role==="owner"}),s.regionMismatch&&K(s.user.role,"settings")&&e.jsx(ra,{...s.regionMismatch}),e.jsx("div",{className:"min-h-0 flex-1",children:t})]}),e.jsx(Zn,{open:a,onOpenChange:r})]})}function aa({names:t,owner:s}){return t.length?e.jsxs("div",{role:"alert",className:"mx-7 mt-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:[e.jsxs("p",{className:"m-0 font-medium",children:["The database needs an update for this version (",t.length," ",t.length===1?"migration":"migrations",")."]}),e.jsx("p",{className:"m-0 mt-0.5",children:s?e.jsxs(e.Fragment,{children:["Run ",e.jsx("code",{className:"font-mono",children:"snagset migrate"})," with this instance's ",e.jsx("code",{className:"font-mono",children:"DATABASE_URL"})," — from the project, ",e.jsx("code",{className:"font-mono",children:"pnpm migrate"}),". Until then, parts of this version may fail."]}):"Ask the studio's owner to run snagset migrate. Until then, parts of this version may fail."})]}):null}function ra({functions:t,database:s,suggest:n}){return e.jsxs("div",{role:"status",className:"mx-7 mt-4 rounded-md border border-border bg-warn-soft px-3 py-2 text-[13px]",children:[e.jsxs("p",{className:"m-0 font-medium",children:["This server runs in ",t,", but its database is in ",s," — every page waits on that distance."]}),e.jsx("p",{className:"m-0 mt-0.5 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Add ",e.jsxs("code",{className:"font-mono",children:['"regions": ["',n,'"]']})," to ",e.jsx("code",{className:"font-mono",children:"vercel.json"})," and redeploy."]}):"Run the server in the same region as the database."})]})}function oa({me:t,site:s}){const n=Ls({select:i=>i.location.pathname}),a=i=>n===i||n.startsWith(i+"/"),r=K(t.user.role,"settings"),p=we($e.setupState()),d=t.user.role==="owner"?p.data?.billingUrl:null;return e.jsxs(qn,{children:[e.jsx(Kn,{className:"px-3 pb-1 pt-3",children:e.jsx(ia,{me:t})}),e.jsxs(Wn,{children:[e.jsxs(He,{children:[e.jsx(la,{me:t,site:s}),s&&e.jsx(Le,{children:e.jsxs(he,{children:[e.jsxs(M,{children:[e.jsxs(E,{isActive:a(`/s/${s.uid}/comments`),render:e.jsx(_,{to:"/s/$site/comments",params:{site:s.uid}}),children:[e.jsx(ve,{}),e.jsx("span",{children:"Comments"})]}),s.unresolved>0&&e.jsx(Jn,{children:s.unresolved})]}),e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/reviewers`),render:e.jsx(_,{to:"/s/$site/reviewers",params:{site:s.uid}}),children:[e.jsx(be,{}),e.jsx("span",{children:"Reviewers"})]})}),r&&e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/settings`),render:e.jsx(_,{to:"/s/$site/settings",params:{site:s.uid}}),children:[e.jsx(Je,{}),e.jsx("span",{children:"Settings"})]})})]})})]}),e.jsxs(He,{children:[e.jsx(Xn,{children:"Studio"}),e.jsx(Le,{children:e.jsxs(he,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/sites"),render:e.jsx(_,{to:"/sites"}),children:[e.jsx(se,{}),e.jsx("span",{children:"Sites"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/activity"),render:e.jsx(_,{to:"/activity"}),children:[e.jsx(We,{}),e.jsx("span",{children:"Activity"})]})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/members"),render:e.jsx(_,{to:"/studio/members"}),children:[e.jsx(be,{}),e.jsx("span",{children:"Members"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/integrations"),render:e.jsx(_,{to:"/studio/integrations"}),children:[e.jsx(Xe,{}),e.jsx("span",{children:"Integrations"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:n==="/studio",render:e.jsx(_,{to:"/studio"}),children:[e.jsx(Ce,{}),e.jsx("span",{children:"General"})]})})]})]})})]})]}),e.jsx(Yn,{children:e.jsxs(he,{children:[d&&e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/plan"),render:e.jsx(_,{to:"/studio/plan"}),children:[e.jsx(Ys,{}),e.jsx("span",{children:"Plan & billing"})]})}),e.jsx(M,{children:e.jsxs(E,{render:e.jsx("a",{href:ot,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Qe,{}),e.jsx("span",{children:"Docs"}),e.jsx(J,{className:"ml-auto size-3.5 text-muted-foreground"})]})}),e.jsx(M,{children:e.jsx(da,{})}),e.jsx(M,{children:e.jsx(ca,{me:t})})]})})]})}function ia({me:t}){const s=ae(),n=je(),[a,r]=o.useState(!1),[p,d]=o.useState(""),[i,x]=o.useState(""),[c,g]=o.useState(!1),b=e.jsxs(e.Fragment,{children:[e.jsx(Nt,{size:20}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"block truncate text-[14px] font-semibold leading-tight tracking-tight",children:t.org.name}),e.jsx("span",{className:"block truncate text-[11.5px] text-muted-foreground",children:location.host})]})]}),f=K(t.user.role,"settings");if(t.orgs.length<=1&&!t.signupOpen)return f?e.jsx(_,{to:"/studio",className:"flex items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":`${t.org.name} — studio settings`,children:b}):e.jsx("div",{className:"flex items-center gap-2.5 px-1 py-0.5 text-foreground",children:b});const j=async l=>{g(!0),x("");try{await l(),n.clear(),r(!1),d(""),s({to:"/sites",replace:!0})}catch(S){x(S instanceof Error?S.message:"Something went wrong. Try again.")}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":"Switch studio"}),children:[b,e.jsx(ke,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Studios"}),t.orgs.map(l=>e.jsxs(I,{disabled:l.current,onClick:()=>void j(()=>ee.switchOrg(l.slug)),children:[e.jsx(Ce,{}),e.jsx("span",{className:"truncate",children:l.name}),l.current&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},l.slug))]}),(f||t.signupOpen)&&e.jsx(V,{}),f&&e.jsxs(I,{onClick:()=>void s({to:"/studio"}),children:[e.jsx(Je,{}),"Studio settings"]}),t.signupOpen&&e.jsxs(I,{onClick:()=>r(!0),children:[e.jsx(Ye,{}),"New studio…"]})]})]}),e.jsx(Fe,{open:a,onOpenChange:l=>!c&&r(l),children:e.jsx(Ue,{className:"sm:max-w-[420px]",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:l=>{l.preventDefault(),j(()=>ee.createOrg(p.trim()||"My studio"))},children:[e.jsxs(ds,{children:[e.jsx(qe,{children:"New studio"}),e.jsx(cs,{children:"Its own sites, members and settings. You are its owner, and you move to it now — this one stays in the menu."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(ms,{htmlFor:"new-studio-name",children:"Studio name"}),e.jsx(bs,{id:"new-studio-name",value:p,onChange:l=>d(l.target.value),placeholder:"My studio",autoFocus:!0})]}),i&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:i}),e.jsxs(us,{children:[e.jsx(Z,{type:"button",variant:"outline",onClick:()=>r(!1),disabled:c,children:"Cancel"}),e.jsx(Z,{type:"submit",loading:c,children:c?"Creating…":"Create studio"})]})]})})})]})}function la({me:t,site:s}){const n=ae();return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"mb-1 flex h-[34px] w-full items-center justify-between rounded-md border border-border bg-card px-2.5 text-[13px] font-semibold text-foreground","aria-label":"Switch site"}),children:[e.jsx("span",{className:"truncate",children:s?.name??"No sites yet"}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Sites"}),t.projects.filter(a=>!a.archived||a.uid===s?.uid).map(a=>e.jsxs(I,{onClick:()=>void n({to:"/s/$site/comments",params:{site:a.uid}}),children:[e.jsx(se,{}),e.jsx("span",{className:"truncate",children:a.name}),a.uid===s?.uid&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},a.uid))]}),e.jsx(V,{}),K(t.user.role,"settings")&&e.jsxs(I,{onClick:()=>void n({to:"/sites",search:{add:!0}}),children:[e.jsx(Ye,{}),"Add a site"]}),e.jsxs(I,{onClick:()=>void n({to:"/sites"}),children:[e.jsx(se,{}),"All sites"]})]})]})}function da(){const t=Ct(le()),s=we($e.meta()),n=s.data?.version??"",[a,r]=o.useState({state:"idle"}),p=async()=>{r({state:"checking"});try{r({state:"done",result:await As(n)})}catch{r({state:"failed"})}};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{}),children:[e.jsx(Vs,{}),e.jsx("span",{children:"Help"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[240px]",children:[e.jsxs(I,{render:e.jsx("a",{href:ot,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Qe,{}),"Docs",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsxs(I,{render:e.jsx("a",{href:ta,target:"_blank",rel:"noreferrer"}),children:["Changelog",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),s.data?.sourceUrl&&e.jsxs(I,{render:e.jsx("a",{href:s.data.sourceUrl,target:"_blank",rel:"noreferrer"}),children:["Source · AGPL",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsx(V,{}),e.jsxs("div",{className:"px-2 py-1.5 text-[12px] text-muted-foreground",children:["Snagset ",n||"—",t&&a.state==="idle"&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>void p(),children:"Check for updates"})]}),a.state==="checking"&&" · checking…",a.state==="failed"&&" · could not reach npm",a.state==="done"&&a.result&&e.jsxs(e.Fragment,{children:[" · ",a.result.newer?e.jsxs("a",{href:sa,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:[a.result.latest," is out — how to upgrade"]}):"up to date"]})]})]})]})}function ca({me:t}){const s=ae(),n=je(),[a,r]=o.useState(kt),p=t.user.name||t.user.email,d=t.user.name?t.user.email:t.user.role,i=async()=>{await ee.logout().catch(()=>{}),Pt("out"),n.clear(),s({to:"/sign-in",replace:!0})};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{size:"lg"}),children:[e.jsx(Rs,{className:"size-8 rounded-full",children:e.jsx(Ms,{className:"bg-primary text-[12px] font-semibold text-primary-foreground",children:Is(t.user.name,t.user.email)})}),e.jsxs("div",{className:"min-w-0 flex-1 text-left leading-tight",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold",children:p}),e.jsx("div",{className:"truncate text-[11.5px] text-muted-foreground",children:d})]}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[250px]",children:[e.jsx(Ne,{children:e.jsxs(te,{className:"flex flex-col",children:[e.jsx("span",{className:"text-[13px] font-semibold",children:p}),e.jsx("span",{className:"text-[11.5px] font-normal text-muted-foreground",children:t.user.name?`${t.user.email} · ${t.user.role}`:t.user.role})]})}),e.jsx(V,{}),e.jsxs(Cs,{value:a,onValueChange:x=>{const c=x;Tt(c),r(c)},children:[e.jsx(te,{children:"Theme"}),e.jsxs(pe,{value:"system",children:[e.jsx(_s,{}),"System"]}),e.jsxs(pe,{value:"light",children:[e.jsx(zs,{}),"Light"]}),e.jsxs(pe,{value:"dark",children:[e.jsx(Hs,{}),"Dark"]})]}),e.jsx(V,{}),e.jsxs(I,{onClick:()=>void s({to:"/you"}),children:[e.jsx(Ze,{}),"You"]}),e.jsxs(I,{onClick:()=>void i(),children:[e.jsx(Xs,{}),"Sign out"]})]})]})}function ua({onSearch:t}){const n=wt().map(a=>a.loaderData?.crumb).filter(a=>typeof a=="string"&&a.length>0);return e.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx(Gn,{className:"-ml-1"}),e.jsx("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-2 text-[13.5px] font-medium text-muted-foreground",children:n.map((a,r)=>e.jsxs("span",{className:"flex items-center gap-2",children:[r>0&&e.jsx("span",{className:"text-line-strong",children:"/"}),e.jsx("span",{className:r===n.length-1?"text-foreground":void 0,children:a})]},r))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",onClick:t,"aria-label":"Search and go",className:"flex h-7 items-center gap-2 rounded-md border border-border bg-card px-2 text-[12.5px] text-muted-foreground",children:[e.jsx(Ve,{className:"size-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"}),e.jsx("kbd",{className:"hidden rounded border border-border px-1 font-mono text-[11px] sm:inline",children:"⌘K"})]})]})}const _a=()=>e.jsx(na,{children:e.jsx(Rt,{})});export{_a as component};
@@ -1 +1 @@
1
- import{j as e,u as n,G as a,B as r}from"./index-N-I90MR_.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
1
+ import{j as e,u as n,G as a,B as r}from"./index-DAdE1N-R.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
@@ -1 +1 @@
1
- import{Y as g,Z as f,_ as p,p as v,j as e,B as m,$ as N,L as j,a0 as P}from"./index-N-I90MR_.js";import{Q as y,u as b}from"./useBaseQuery-CN0OIcOk.js";import{P as w,S}from"./parts-D5D8UvJZ.js";import{b as R,c as E,S as k}from"./labels--UUyt9uB.js";import{u as F}from"./me-D4xGiOon.js";import"./card-BI3eAi_u.js";var M=class extends y{constructor(s,r){super(s,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,r){const{state:i}=s,l=super.createResult(s,r),{isFetching:o,isRefetching:n,isError:u,isRefetchError:d}=l,t=i.fetchMeta?.fetchMore?.direction,c=u&&t==="forward",a=o&&t==="forward",h=u&&t==="backward",x=o&&t==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:f(r,i.data),hasPreviousPage:g(r,i.data),isFetchNextPageError:c,isFetchingNextPage:a,isFetchPreviousPageError:h,isFetchingPreviousPage:x,isRefetchError:d&&!c&&!h,isRefetching:n&&!a&&!x}}};function A(s,r){return b(s,M)}const C=[{value:"unresolved",label:"Needs attention"},...E.map(s=>({value:s,label:k[s]})),{value:"all",label:"Everything"}];function D(s,r=new Date){const i=new Date(s),l=n=>new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=Math.round((l(r)-l(i))/864e5);return o<=0?"Today":o===1?"Yesterday":o<7?i.toLocaleDateString(void 0,{weekday:"long"}):i.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function I(){const s=F(),{status:r="unresolved",site:i}=p.useSearch(),l=v({from:"/activity"}),o=t=>void l({search:c=>({...c,...t}),replace:!0}),n=A(P(r,i)),u=n.data?.pages.flatMap(t=>t.data)??[],d=[];for(const t of u){const c=D(t.updatedAt),a=d[d.length-1];a?.day===c?a.rows.push(t):d.push({day:c,rows:[t]})}return e.jsxs("div",{className:"flex flex-col gap-5 p-7",children:[e.jsx(w,{title:"Activity",sub:`Every site, newest first${i?"":" — all of them"}`}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[C.map(t=>e.jsx(m,{size:"sm",variant:r===t.value?"default":"outline",onClick:()=>o({status:t.value}),children:t.label},t.value)),e.jsx("div",{className:"flex-1"}),e.jsxs("label",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:["Site",e.jsxs("select",{"aria-label":"Site",value:i??"",onChange:t=>o({site:t.target.value||void 0}),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px] text-foreground",children:[e.jsx("option",{value:"",children:"All sites"}),s.projects.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))]})]})]}),n.isPending&&e.jsx(N,{rows:4}),n.isError&&e.jsx("p",{className:"m-0 text-[13px] text-destructive",children:"Could not read the feed. Reload to try again."}),n.isSuccess&&u.length===0&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:r==="resolved"?"Nothing has been resolved yet — this is where finished comments go.":r==="unresolved"?"Nothing needs attention. Every comment on every site is resolved.":"No comments yet on any site."}),d.map(({day:t,rows:c})=>e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx("h2",{className:"m-0 text-[12px] font-medium uppercase tracking-wide text-muted-foreground",children:t}),e.jsx("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:c.map(a=>e.jsx("li",{children:e.jsxs(j,{to:"/s/$site/comments",params:{site:a.site.uid},search:{thread:a.key},className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2.5 no-underline transition-colors hover:bg-muted/60",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[13px]",children:[e.jsx(S,{status:a.status}),e.jsx("span",{className:"font-medium text-foreground",children:a.site.name}),e.jsx("code",{className:"font-mono text-[12px] text-muted-foreground",children:a.route}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:R(a.updatedAt)})]}),a.latest?.body&&e.jsxs("span",{className:"line-clamp-2 text-[13px] text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[a.latest.author??a.createdBy.name,": "]}),a.latest.body]}),e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:a.key}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[a.commentCount," ",a.commentCount===1?"comment":"comments"]}),a.assignee&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:a.assignee})]})]})]})},a.id))})]},t)),n.hasNextPage&&e.jsx("div",{children:e.jsx(m,{variant:"outline",size:"sm",disabled:n.isFetchingNextPage,onClick:()=>void n.fetchNextPage(),children:n.isFetchingNextPage?"Reading…":"Show older"})})]})}export{I as component};
1
+ import{Y as g,Z as f,_ as p,p as v,j as e,B as m,$ as N,L as j,a0 as P}from"./index-DAdE1N-R.js";import{Q as y,u as b}from"./useBaseQuery-CgPeQebj.js";import{P as w,S}from"./parts-CmbgXJj-.js";import{b as R,c as E,S as k}from"./labels--UUyt9uB.js";import{u as F}from"./me-CPtVQtAA.js";import"./card-CGjT73CQ.js";var M=class extends y{constructor(s,r){super(s,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,r){const{state:i}=s,l=super.createResult(s,r),{isFetching:o,isRefetching:n,isError:u,isRefetchError:d}=l,t=i.fetchMeta?.fetchMore?.direction,c=u&&t==="forward",a=o&&t==="forward",h=u&&t==="backward",x=o&&t==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:f(r,i.data),hasPreviousPage:g(r,i.data),isFetchNextPageError:c,isFetchingNextPage:a,isFetchPreviousPageError:h,isFetchingPreviousPage:x,isRefetchError:d&&!c&&!h,isRefetching:n&&!a&&!x}}};function A(s,r){return b(s,M)}const C=[{value:"unresolved",label:"Needs attention"},...E.map(s=>({value:s,label:k[s]})),{value:"all",label:"Everything"}];function D(s,r=new Date){const i=new Date(s),l=n=>new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=Math.round((l(r)-l(i))/864e5);return o<=0?"Today":o===1?"Yesterday":o<7?i.toLocaleDateString(void 0,{weekday:"long"}):i.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function I(){const s=F(),{status:r="unresolved",site:i}=p.useSearch(),l=v({from:"/activity"}),o=t=>void l({search:c=>({...c,...t}),replace:!0}),n=A(P(r,i)),u=n.data?.pages.flatMap(t=>t.data)??[],d=[];for(const t of u){const c=D(t.updatedAt),a=d[d.length-1];a?.day===c?a.rows.push(t):d.push({day:c,rows:[t]})}return e.jsxs("div",{className:"flex flex-col gap-5 p-7",children:[e.jsx(w,{title:"Activity",sub:`Every site, newest first${i?"":" — all of them"}`}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[C.map(t=>e.jsx(m,{size:"sm",variant:r===t.value?"default":"outline",onClick:()=>o({status:t.value}),children:t.label},t.value)),e.jsx("div",{className:"flex-1"}),e.jsxs("label",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:["Site",e.jsxs("select",{"aria-label":"Site",value:i??"",onChange:t=>o({site:t.target.value||void 0}),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px] text-foreground",children:[e.jsx("option",{value:"",children:"All sites"}),s.projects.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))]})]})]}),n.isPending&&e.jsx(N,{rows:4}),n.isError&&e.jsx("p",{className:"m-0 text-[13px] text-destructive",children:"Could not read the feed. Reload to try again."}),n.isSuccess&&u.length===0&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:r==="resolved"?"Nothing has been resolved yet — this is where finished comments go.":r==="unresolved"?"Nothing needs attention. Every comment on every site is resolved.":"No comments yet on any site."}),d.map(({day:t,rows:c})=>e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx("h2",{className:"m-0 text-[12px] font-medium uppercase tracking-wide text-muted-foreground",children:t}),e.jsx("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:c.map(a=>e.jsx("li",{children:e.jsxs(j,{to:"/s/$site/comments",params:{site:a.site.uid},search:{thread:a.key},className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2.5 no-underline transition-colors hover:bg-muted/60",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[13px]",children:[e.jsx(S,{status:a.status}),e.jsx("span",{className:"font-medium text-foreground",children:a.site.name}),e.jsx("code",{className:"font-mono text-[12px] text-muted-foreground",children:a.route}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:R(a.updatedAt)})]}),a.latest?.body&&e.jsxs("span",{className:"line-clamp-2 text-[13px] text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[a.latest.author??a.createdBy.name,": "]}),a.latest.body]}),e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:a.key}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[a.commentCount," ",a.commentCount===1?"comment":"comments"]}),a.assignee&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:a.assignee})]})]})]})},a.id))})]},t)),n.hasNextPage&&e.jsx("div",{children:e.jsx(m,{variant:"outline",size:"sm",disabled:n.isFetchingNextPage,onClick:()=>void n.fetchNextPage(),children:n.isFetchingNextPage?"Reading…":"Show older"})})]})}export{I as component};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-N-I90MR_.js";/**
1
+ import{c as o}from"./index-DAdE1N-R.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{r as x,E as rn,l as U,aI as we,aE as pe,aJ as xe,g as se,aK as Et,aG as Ze,aF as bt,aL as kn,aM as sn,aN as Dn,aO as St,aP as cn,aQ as it,aR as vt,aS as Ht,aT as ln,n as In,e as q,f as ie,aa as Fn,k as Ct,i as Wn,j as Pt,h as an}from"./index-DAdE1N-R.js";import{b as At,e as Nt,g as ht,f as Kt,h as Xe,j as Vn,k as $n}from"./inertValue-C7RCWgtk.js";import{w as Mt,i as pt,a4 as _n,an as fn,a6 as un,Q as zn,ao as Bn,v as ue,K as Hn,ap as Nn,aq as fe,Y as Kn,_ as jn,ar as st,as as ct,at as dn,au as Tt,av as Yn,aw as Xn,B as qn,ax as Un,ay as Gn}from"./dialog-BQKOXDHO.js";import{t as Qn,g as mn,c as Qe,x as xt,r as et,a as Be,B as jt,m as Jn}from"./label-ComnO04i.js";import{u as Zn}from"./useValueChanged-uYr-YTth.js";import{u as eo}from"./CompositeList-Dwya2aET.js";const Le=Math.min,de=Math.max,tt=Math.round,qe=Math.floor,me=e=>({x:e,y:e}),to={left:"right",right:"left",bottom:"top",top:"bottom"};function gn(e,t,n){return de(e,Le(t,n))}function ye(e,t){return typeof e=="function"?e(t):e}function J(e){return e.split("-")[0]}function Re(e){return e.split("-")[1]}function Lt(e){return e==="x"?"y":"x"}function kt(e){return e==="y"?"height":"width"}function Q(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Dt(e){return Lt(Q(e))}function no(e,t,n){n===void 0&&(n=!1);const o=Re(e),r=Dt(e),i=kt(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=nt(s)),[s,nt(s)]}function oo(e){const t=nt(e);return[Ot(e),t,Ot(t)]}function Ot(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Yt=["left","right"],Xt=["right","left"],ro=["top","bottom"],io=["bottom","top"];function so(e,t,n){switch(e){case"top":case"bottom":return n?t?Xt:Yt:t?Yt:Xt;case"left":case"right":return t?ro:io;default:return[]}}function co(e,t,n,o){const r=Re(e);let i=so(J(e),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),t&&(i=i.concat(i.map(Ot)))),i}function nt(e){const t=J(e);return to[t]+e.slice(t.length)}function lo(e){var t,n,o,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(r=e.left)!=null?r:0}}function hn(e){return typeof e!="number"?lo(e):{top:e,right:e,bottom:e,left:e}}function ot(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Rr(e,t={}){const{enabled:n=!0,event:o="click",toggle:r=!0,ignoreMouse:i=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:l=Qn}=t,f="rootStore"in e?e.rootStore:e,u=f.context.dataRef,a=x.useRef(void 0),g=At(),d=Mt(),m=x.useMemo(()=>{function p(y,w,E,R){const v=Qe(l,w,E);y&&R==="touch"&&c>0?d.start(c,()=>{f.setOpen(!0,v)}):f.setOpen(y,v)}function h(y,w,E){const R=u.current.openEvent,v=f.select("domReferenceElement")!==w;return y&&v||!y||!r?!0:R&&s?!E(R.type):!1}return{onPointerDown(y){a.current=pt(y.pointerType,!0)&&fn(y.nativeEvent)?"virtual":y.pointerType},onMouseDown(y){const w=a.current,E=y.nativeEvent,R=f.select("open");if(y.button!==0||o==="click"||pt(w,!0)&&i)return;const v=h(R,y.currentTarget,A=>A==="click"||A==="mousedown"),S=mn(E);if(_n(S)){p(v,E,S,w);return}const P=y.currentTarget;g.request(()=>{p(v,E,P,w)})},onClick(y){if(o==="mousedown-only")return;const w=a.current;if(o==="mousedown"&&w){a.current=void 0;return}if(pt(w,!0)&&i)return;const E=f.select("open"),R=h(E,y.currentTarget,v=>v==="click"||v==="mousedown"||v==="keydown"||v==="keyup");p(R,y.nativeEvent,y.currentTarget,w)},onKeyDown(){a.current=void 0}}},[u,o,i,l,f,s,r,g,d,c]);return x.useMemo(()=>n?{reference:m}:rn,[n,m])}function qt(e,t,n){let{reference:o,floating:r}=e;const i=Q(t),s=Dt(t),c=kt(s),l=J(t),f=i==="y",u=o.x+o.width/2-r.width/2,a=o.y+o.height/2-r.height/2,g=o[c]/2-r[c]/2;let d;switch(l){case"top":d={x:u,y:o.y-r.height};break;case"bottom":d={x:u,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:a};break;case"left":d={x:o.x-r.width,y:a};break;default:d={x:o.x,y:o.y}}const m=Re(t);return m&&(d[s]+=g*(m==="end"?1:-1)*(n&&f?-1:1)),d}async function ao(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:l}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:a="floating",altBoundary:g=!1,padding:d=0}=ye(t,e),m=hn(d),h=c[g?a==="floating"?"reference":"floating":a],y=ot(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:f,rootBoundary:u,strategy:l})),w=a==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),R=await(i.isElement==null?void 0:i.isElement(E))&&await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1},v=ot(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:E,strategy:l}):w);return{top:(y.top-v.top+m.top)/R.y,bottom:(v.bottom-y.bottom+m.bottom)/R.y,left:(y.left-v.left+m.left)/R.x,right:(v.right-y.right+m.right)/R.x}}const fo=50,uo=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:ao},l=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:a}=qt(f,o,l),g=o,d=0;const m={};for(let p=0;p<i.length;p++){const h=i[p];if(!h)continue;const{name:y,fn:w}=h,{x:E,y:R,data:v,reset:S}=await w({x:u,y:a,initialPlacement:o,placement:g,strategy:r,middlewareData:m,rects:f,platform:c,elements:{reference:e,floating:t}});u=E??u,a=R??a,m[y]={...m[y],...v},S&&d<fo&&(d++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(f=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:r}):S.rects),{x:u,y:a}=qt(f,g,l)),p=-1)}return{x:u,y:a,placement:g,strategy:r,middlewareData:m}},mo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:l,elements:f}=t,{mainAxis:u=!0,crossAxis:a=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...h}=ye(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=J(r),w=Q(c),E=J(c)===c,R=await(l.isRTL==null?void 0:l.isRTL(f.floating)),v=g||(E||!p?[nt(c)]:oo(c)),S=m!=="none";!g&&S&&v.push(...co(c,p,m,R));const P=[c,...v],A=await l.detectOverflow(t,h),k=[];let L=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&k.push(A[y]),a){const T=no(r,s,R);k.push(A[T[0]],A[T[1]])}if(L=[...L,{placement:r,overflows:k}],!k.every(T=>T<=0)){var D,K;const T=(((D=i.flip)==null?void 0:D.index)||0)+1,$=P[T];if($&&(!(a==="alignment"?w!==Q($):!1)||L.every(b=>Q(b.placement)===w?b.overflows[0]>0:!0)))return{data:{index:T,overflows:L},reset:{placement:$}};let F=(K=L.filter(W=>W.overflows[0]<=0).sort((W,b)=>W.overflows[1]-b.overflows[1])[0])==null?void 0:K.placement;if(!F)switch(d){case"bestFit":{var H;const W=(H=L.filter(b=>{if(S){const _=Q(b.placement);return _===w||_==="y"}return!0}).map(b=>[b.placement,b.overflows.filter(_=>_>0).reduce((_,z)=>_+z,0)]).sort((b,_)=>b[1]-_[1])[0])==null?void 0:H[0];W&&(F=W);break}case"initialPlacement":F=c;break}if(r!==F)return{reset:{placement:F}}}return{}}}},pn=new Set(["left","top"]);async function go(e,t){const{placement:n,platform:o,elements:r}=e,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=J(n),c=Re(n),l=Q(n)==="y",f=pn.has(s)?-1:1,u=i&&l?-1:1,a=ye(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:m}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return c&&typeof m=="number"&&(d=c==="end"?m*-1:m),l?{x:d*u,y:g*f}:{x:g*f,y:d*u}}const ho=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=t,l=await go(t,e);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:s}}}}},po=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:i}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:l={fn:w=>{let{x:E,y:R}=w;return{x:E,y:R}}},...f}=ye(e,t),u={x:n,y:o},a=await i.detectOverflow(t,f),g=Q(r),d=Lt(g);let m=u[d],p=u[g];const h=(w,E)=>gn(E+a[w==="y"?"top":"left"],E,E-a[w==="y"?"bottom":"right"]);s&&(m=h(d,m)),c&&(p=h(g,p));const y=l.fn({...t,[d]:m,[g]:p});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[d]:s,[g]:c}}}}}},xo=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,o;const{x:r,y:i,placement:s,rects:c,middlewareData:l}=t,{offset:f=0,mainAxis:u=!0,crossAxis:a=!0}=ye(e,t),g={x:r,y:i},d=Q(s),m=Lt(d);let p=g[m],h=g[d];const y=ye(f,t),w=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(o=y.crossAxis)!=null?o:0};if(u){const v=m==="y"?"height":"width",S=c.reference[m]-c.floating[v]+w.mainAxis,P=c.reference[m]+c.reference[v]-w.mainAxis;p<S?p=S:p>P&&(p=P)}if(a){var E,R;const v=m==="y"?"width":"height",S=pn.has(J(s)),P=c.reference[d]-c.floating[v]+(S&&((E=l.offset)==null?void 0:E[d])||0)+(S?0:w.crossAxis),A=c.reference[d]+c.reference[v]+(S?0:((R=l.offset)==null?void 0:R[d])||0)-(S?w.crossAxis:0);h<P?h=P:h>A&&(h=A)}return{[m]:p,[d]:h}}}},yo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:r,elements:i}=t,{apply:s=()=>{},...c}=ye(e,t),l=await r.detectOverflow(t,c),f=J(n),u=Re(n),a=Q(n)==="y",{width:g,height:d}=o.floating;let m,p;f==="top"||f==="bottom"?(m=f,p=u===(await(r.isRTL==null?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(p=f,m=u==="end"?"top":"bottom");const h=d-l.top-l.bottom,y=g-l.left-l.right,w=Le(d-l[m],h),E=Le(g-l[p],y),R=t.middlewareData.shift,v=!R;let S=w,P=E;R!=null&&R.enabled.x&&(P=y),R!=null&&R.enabled.y&&(S=h),v&&!u&&(a?P=g-2*de(l.left,l.right):S=d-2*de(l.top,l.bottom)),await s({...t,availableWidth:P,availableHeight:S});const A=await r.getDimensions(i.floating);return g!==A.width||d!==A.height?{reset:{rects:!0}}:{}}}};function xn(e){const t=xe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=pe(e),i=r?e.offsetWidth:n,s=r?e.offsetHeight:o,c=tt(n)!==i||tt(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function It(e){return U(e)?e:e.contextElement}function Te(e){const t=It(e);if(!pe(t))return me(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=xn(t);let s=(i?tt(n.width):n.width)/o,c=(i?tt(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const wo=me(0);function yn(e){const t=se(e);return!ln()||!t.visualViewport?wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ro(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===se(e)}function Ae(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=It(e);let s=me(1);t&&(o?U(o)&&(s=Te(o)):s=Te(e));const c=Ro(i,n,o)?yn(i):me(0);let l=(r.left+c.x)/s.x,f=(r.top+c.y)/s.y,u=r.width/s.x,a=r.height/s.y;if(i&&o){const g=se(i),d=U(o)?se(o):o;let m=g,p=Ht(m);for(;p&&d!==m;){const h=Te(p),y=p.getBoundingClientRect(),w=xe(p),E=y.left+(p.clientLeft+parseFloat(w.paddingLeft))*h.x,R=y.top+(p.clientTop+parseFloat(w.paddingTop))*h.y;l*=h.x,f*=h.y,u*=h.x,a*=h.y,l+=E,f+=R,m=se(p),p=Ht(m)}}return ot({width:u,height:a,x:l,y:f})}function lt(e,t){const n=it(e).scrollLeft;return t?t.left+n:Ae(we(e)).left+n}function wn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-lt(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function bo(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i=r==="fixed",s=we(o),c=t?Et(t.floating):!1;if(o===s||c&&i)return n;let l={scrollLeft:0,scrollTop:0},f=me(1);const u=me(0),a=pe(o);if((a||!i)&&((St(o)!=="body"||cn(s))&&(l=it(o)),a)){const d=Ae(o);f=Te(o),u.x=d.x+o.clientLeft,u.y=d.y+o.clientTop}const g=s&&!a&&!i?wn(s,l):me(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-l.scrollLeft*f.x+u.x+g.x,y:n.y*f.y-l.scrollTop*f.y+u.y+g.y}}function vo(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ao(e){const t=it(e),n=e.ownerDocument.body,o=de(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=de(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+lt(e);const s=-t.scrollTop;return xe(n).direction==="rtl"&&(i+=de(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:i,y:s}}const Oo=25;function Eo(e,t,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",r=se(e),i=we(e),s=r.visualViewport;let c=i.clientWidth,l=i.clientHeight,f=0,u=0;if(s){const g=!ln()||t==="fixed";o?g||(f=-s.offsetLeft,u=-s.offsetTop):(c=s.width,l=s.height,g&&(f=s.offsetLeft,u=s.offsetTop))}if(lt(i)<=0){const g=i.ownerDocument,d=g.body,m=getComputedStyle(d),p=g.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(i.clientWidth-d.clientWidth-p),y=getComputedStyle(i).scrollbarGutter==="stable both-edges"?h/2:h;y<=Oo&&(c-=y)}return{width:c,height:l,x:f,y:u}}function So(e,t){const n=Ae(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=Te(e),s=e.clientWidth*i.x,c=e.clientHeight*i.y,l=r*i.x,f=o*i.y;return{width:s,height:c,x:l,y:f}}function Ut(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=Eo(e,n,t);else if(t==="document")o=Ao(we(e));else if(U(t))o=So(t,n);else{const r=yn(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return ot(o)}function Co(e,t){const n=t.get(e);if(n)return n;let o=vt(e,[],!1).filter(c=>U(c)&&St(c)!=="body"),r=null;const i=xe(e).position==="fixed";let s=i?Ze(e):e;for(;U(s)&&!bt(s);){const c=xe(s),l=sn(s),f=r?r.position:i?"fixed":"";!l&&(f==="fixed"||f==="absolute"&&c.position==="static")?o=o.filter(a=>a!==s):r=c,s=Ze(s)}return t.set(e,o),o}function Po(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const s=[...n==="clippingAncestors"?Et(t)?[]:Co(t,this._c):[].concat(n),o],c=Ut(t,s[0],r);let l=c.top,f=c.right,u=c.bottom,a=c.left;for(let g=1;g<s.length;g++){const d=Ut(t,s[g],r);l=de(d.top,l),f=Le(d.right,f),u=Le(d.bottom,u),a=de(d.left,a)}return{width:f-a,height:u-l,x:a,y:l}}function Mo(e){const{width:t,height:n}=xn(e);return{width:t,height:n}}function To(e,t,n){const o=pe(t),r=we(t),i=n==="fixed",s=Ae(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const l=me(0);if((o||!i)&&((St(t)!=="body"||cn(r))&&(c=it(t)),o)){const g=Ae(t,!0,i,t);l.x=g.x+t.clientLeft,l.y=g.y+t.clientTop}!o&&r&&(l.x=lt(r));const f=r&&!o&&!i?wn(r,c):me(0),u=s.left+c.scrollLeft-l.x-f.x,a=s.top+c.scrollTop-l.y-f.y;return{x:u,y:a,width:s.width,height:s.height}}function yt(e){return xe(e).position==="static"}function Gt(e,t){if(!pe(e)||xe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return we(e)===n&&(n=n.ownerDocument.body),n}function Rn(e,t){const n=se(e);if(Et(e))return n;if(!pe(e)){let r=Ze(e);for(;r&&!bt(r);){if(U(r)&&!yt(r))return r;r=Ze(r)}return n}let o=Gt(e,t);for(;o&&kn(o)&&yt(o);)o=Gt(o,t);return o&&bt(o)&&yt(o)&&!sn(o)?n:o||Dn(e)||n}const Lo=async function(e){const t=this.getOffsetParent||Rn,n=this.getDimensions,o=await n(e.floating);return{reference:To(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ko(e){return xe(e).direction==="rtl"}const Do={convertOffsetParentRelativeRectToViewportRelativeRect:bo,getDocumentElement:we,getClippingRect:Po,getOffsetParent:Rn,getElementRects:Lo,getClientRects:vo,getDimensions:Mo,getScale:Te,isElement:U,isRTL:ko};function bn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Io(e,t,n){let o=null,r;const i=we(e);function s(){var u;clearTimeout(r),(u=o)==null||u.disconnect(),o=null}function c(u,a){u===void 0&&(u=!1),a===void 0&&(a=1),s();const g=e.getBoundingClientRect(),{left:d,top:m,width:p,height:h}=g;if(u||t(),!p||!h)return;const y=qe(m),w=qe(i.clientWidth-(d+p)),E=qe(i.clientHeight-(m+h)),R=qe(d),S={rootMargin:-y+"px "+-w+"px "+-E+"px "+-R+"px",threshold:de(0,Le(1,a))||1};let P=!0;function A(k){const L=k[0].intersectionRatio;if(!bn(g,e.getBoundingClientRect()))return c();if(L!==a){if(!P)return c();L?c(!1,L):r=setTimeout(()=>{c(!1,1e-7)},1e3)}P=!1}try{o=new IntersectionObserver(A,{...S,root:i.ownerDocument})}catch{o=new IntersectionObserver(A,S)}o.observe(e)}const l=se(e),f=()=>c(n);return l.addEventListener("resize",f),c(!0),()=>{l.removeEventListener("resize",f),s()}}function Qt(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,f=It(e),u=r||i?[...f?vt(f):[],...t?vt(t):[]]:[];u.forEach(y=>{r&&y.addEventListener("scroll",n),i&&y.addEventListener("resize",n)});const a=f&&c?Io(f,n,i):null;let g=-1,d=null;s&&(d=new ResizeObserver(y=>{let[w]=y;w&&w.target===f&&d&&t&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=d)==null||E.observe(t)})),n()}),f&&!l&&d.observe(f),t&&d.observe(t));let m,p=l?Ae(e):null;l&&h();function h(){const y=Ae(e);p&&!bn(p,y)&&n(),p=y,m=requestAnimationFrame(h)}return n(),()=>{var y;u.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),a?.(),(y=d)==null||y.disconnect(),d=null,l&&cancelAnimationFrame(m)}}const Fo=ho,Wo=po,Vo=mo,$o=yo,_o=xo,zo=(e,t,n)=>{const o=new Map,r=n??{},i={...Do,...r.platform,_c:o};return uo(e,t,{...r,platform:i})};var Bo=typeof document<"u",Ho=function(){},Je=Bo?x.useLayoutEffect:Ho;function rt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!rt(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&e.$$typeof)&&!rt(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function vn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jt(e,t){const n=vn(e);return Math.round(t*n)/n}function wt(e){const t=x.useRef(e);return Je(()=>{t.current=e}),t}function No(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:f}=e,[u,a]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,d]=x.useState(o);rt(g,o)||d(o);const[m,p]=x.useState(null),[h,y]=x.useState(null),w=x.useCallback(b=>{b!==S.current&&(S.current=b,p(b))},[]),E=x.useCallback(b=>{b!==P.current&&(P.current=b,y(b))},[]),R=i||m,v=s||h,S=x.useRef(null),P=x.useRef(null),A=x.useRef(u),k=l!=null,L=wt(l),D=wt(r),K=wt(f),H=x.useCallback(()=>{if(!S.current||!P.current)return;const b={placement:t,strategy:n,middleware:g};D.current&&(b.platform=D.current),zo(S.current,P.current,b).then(_=>{const z={..._,isPositioned:K.current!==!1};T.current&&!rt(A.current,z)&&(A.current=z,In.flushSync(()=>{a(z)}))})},[g,t,n,D,K]);Je(()=>{f===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,a(b=>({...b,isPositioned:!1})))},[f]);const T=x.useRef(!1);Je(()=>(T.current=!0,()=>{T.current=!1}),[]),Je(()=>{if(R&&(S.current=R),v&&(P.current=v),R&&v){if(L.current)return L.current(R,v,H);H()}},[R,v,H,L,k]);const $=x.useMemo(()=>({reference:S,floating:P,setReference:w,setFloating:E}),[w,E]),F=x.useMemo(()=>({reference:R,floating:v}),[R,v]),W=x.useMemo(()=>{const b={position:n,left:0,top:0};if(!F.floating)return b;const _=Jt(F.floating,u.x),z=Jt(F.floating,u.y);return c?{...b,transform:"translate("+_+"px, "+z+"px)",...vn(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:z}},[n,c,F.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:H,refs:$,elements:F,floatingStyles:W}),[u,H,$,F,W])}const Ko=(e,t)=>{const n=Fo(e);return{name:n.name,fn:n.fn,options:[e,t]}},jo=(e,t)=>{const n=Wo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yo=(e,t)=>({fn:_o(e).fn,options:[e,t]}),Xo=(e,t)=>{const n=Vo(e);return{name:n.name,fn:n.fn,options:[e,t]}},qo=(e,t)=>{const n=$o(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Uo(e){return Go(e,e.rootContext)}function Go(e,t){const{nodeId:n,externalTree:o}=e,r=t.useState("referenceElement"),i=t.useState("floatingElement"),s=t.useState("domReferenceElement"),c=t.useState("open"),l=t.useState("floatingId"),[f,u]=x.useState(null),[a,g]=x.useState(void 0),[d,m]=x.useState(void 0),p=x.useRef(null),h=un(o),y=x.useMemo(()=>({reference:r,floating:i,domReference:s}),[r,i,s]),w=No({...e,elements:{...y,...f&&{reference:f}}}),E=U(a)?a:null,R=d===void 0?t.state.floatingElement:d;t.useSyncedValue("referenceElement",a??null),t.useSyncedValue("domReferenceElement",a===void 0?s:E),t.useSyncedValue("floatingElement",R);const v=x.useCallback(D=>{const K=U(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;u(K),w.refs.setReference(K)},[w.refs]),S=x.useCallback(D=>{(U(D)||D===null)&&(p.current=D,g(D)),(U(w.refs.reference.current)||w.refs.reference.current===null||D!==null&&!U(D))&&w.refs.setReference(D)},[w.refs,g]),P=x.useCallback(D=>{m(D),w.refs.setFloating(D)},[w.refs]),A=x.useMemo(()=>({...w.refs,setReference:S,setFloating:P,setPositionReference:v,domReference:p}),[w.refs,S,P,v]),k=x.useMemo(()=>({...w.elements,domReference:s}),[w.elements,s]),L=x.useMemo(()=>({...w,dataRef:t.context.dataRef,open:c,onOpenChange:t.setOpen,events:t.context.events,floatingId:l,refs:A,elements:k,nodeId:n,rootStore:t}),[w,A,k,n,t,c,l]);return q(()=>{s&&(p.current=s)},[s]),q(()=>{t.context.dataRef.current.floatingContext=L;const D=h?.nodesRef.current.find(K=>K.id===n);D&&(D.context=L)}),x.useMemo(()=>({...w,context:L,refs:A,elements:k,rootStore:t}),[w,A,k,L,t])}const Qo="Escape";function Zt(e){return Kn&&e.movementX===0&&e.movementY===0}function at(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ue(e,t){return at(t,e===dn||e===Tt,e===st||e===ct)}function Rt(e,t,n){return at(t,e===Tt,n?e===st:e===ct)||e==="Enter"||e===" "||e===""}function Jo(e,t,n){return at(t,n?e===st:e===ct,e===Tt)}function Zo(e,t,n,o){const r=n?e===ct:e===st,i=e===dn;return t==="both"||t==="horizontal"&&o?e===Qo:at(t,r,i)}function br(e,t){const{listRef:n,activeIndex:o,onNavigate:r=()=>{},enabled:i=!0,selectedIndex:s=null,allowEscape:c=!1,loopFocus:l=!1,nested:f=!1,rtl:u=!1,virtual:a=!1,focusItemOnOpen:g="auto",focusItemOnHover:d=!0,openOnArrowKeyDown:m=!0,disabledIndices:p=void 0,orientation:h="vertical",parentOrientation:y,id:w,resetOnPointerLeave:E=!0,externalTree:R,grid:v}=t,S=v!=null,P="rootStore"in e?e.rootStore:e,A=P.useState("open"),k=P.useState("floatingElement"),L=P.useState("domReferenceElement"),D=P.context.dataRef,K=zn(k),H=Bn(L),T=ue(K),$=Hn(),F=un(R),W=x.useRef(g),b=x.useRef(s??-1),_=x.useRef(null),z=x.useRef(!0),N=ie(O=>{r(b.current===-1?null:b.current,O)}),be=x.useRef(!!k),B=x.useRef(A),Y=x.useRef(!1),Oe=x.useRef(!1),ke=x.useRef(null),ft=ue(p),Ee=ue(A),ee=ue(s),ce=ue(E),De=At(),Se=At(),Ie=ie(()=>{function O(V){a?F?.events.emit("virtualfocus",V):ke.current=Nn(V,{sync:Y.current,preventScroll:!0})}const C=n.current[b.current],j=Oe.current;C&&O(C),(Y.current?V=>V():V=>De.request(V))(()=>{const V=n.current[b.current]||C;if(!V)return;C||O(V),Ce&&(j||!z.current)&&V.scrollIntoView?.({block:"nearest",inline:"nearest"})})});q(()=>{D.current.orientation=h},[D,h]),q(()=>{i&&(A&&k?(b.current=s??-1,W.current&&s!=null&&(Oe.current=!0,N())):be.current&&(b.current=-1,N()))},[i,A,k,s,N]),q(()=>{if(i){if(!A){Y.current=!1;return}if(k)if(o==null){if(Y.current=!1,ee.current!=null)return;if(be.current&&(b.current=-1,Ie()),(!B.current||!be.current)&&W.current&&(_.current!=null||W.current===!0&&_.current==null)){let O=0;const C=()=>{n.current[0]==null?(O<2&&(O?M=>Se.request(M):queueMicrotask)(C),O+=1):(b.current=_.current==null||Rt(_.current,h,u)||f?ht(n):Kt(n),_.current=null,N())};C()}}else Nt(n.current,o)||(b.current=o,Ie(),Oe.current=!1)}},[i,A,k,o,ee,f,n,h,u,N,Ie,Se]),q(()=>{if(!i||k||!F||a||!be.current)return;const O=F.nodesRef.current,C=O.find(V=>V.id===$)?.context?.elements.floating,j=xt(et(L??C??null)),M=O.some(V=>V.context&&Be(V.context.elements.floating,j));C&&!M&&z.current&&C.focus({preventScroll:!0})},[i,k,L,F,$,a]),q(()=>{B.current=A,be.current=!!k}),q(()=>{A||(_.current=null,W.current=g)},[A,g]);const He=o!=null,te=ie(O=>{if(!Ee.current)return;const C=n.current.indexOf(O.currentTarget);C!==-1&&(b.current!==C||o!==C)&&(b.current=C,N(O))}),ve=ie(()=>y??F?.nodesRef.current.find(O=>O.id===$)?.context?.dataRef?.current.orientation),Fe=ie(()=>ht(n,ft.current)),ge=ie(O=>{if(z.current=!1,Y.current=!0,O.which===229||!Ee.current&&O.currentTarget===T.current)return;if(f&&Zo(O.key,h,u,S)){Ue(O.key,ve())||fe(O),P.setOpen(!1,Qe(jt,O.nativeEvent)),pe(L)&&(a?F?.events.emit("virtualfocus",L):L.focus());return}const C=b.current,j=ht(n,p),M=Kt(n,p);if(H||(O.key==="Home"&&(fe(O),b.current=j,N(O)),O.key==="End"&&(fe(O),b.current=M,N(O))),v!=null){const V=v(O,b.current,n,h,l,u,p,j,M);if(V!=null&&(b.current=V,N(O)),h==="both")return}if(Ue(O.key,h)){if(fe(O),A&&!a&&xt(O.currentTarget.ownerDocument)===O.currentTarget){b.current=Rt(O.key,h,u)?j:M,N(O);return}Rt(O.key,h,u)?l?C>=M?c&&C!==n.current.length?b.current=-1:(Y.current=!1,b.current=j):b.current=Xe(n.current,{startingIndex:C,disabledIndices:p}):b.current=Math.min(M,Xe(n.current,{startingIndex:C,disabledIndices:p})):l?C<=j?c&&C!==-1?b.current=n.current.length:(Y.current=!1,b.current=M):b.current=Xe(n.current,{startingIndex:C,decrement:!0,disabledIndices:p}):b.current=Math.max(j,Xe(n.current,{startingIndex:C,decrement:!0,disabledIndices:p})),Nt(n.current,b.current)&&(b.current=-1),N(O)}}),Ce=x.useMemo(()=>({onFocus(C){Y.current=!0,te(C)},onClick:({currentTarget:C})=>C.focus({preventScroll:!0}),onMouseMove(C){Zt(C)||(Y.current=!0,Oe.current=!1,d&&te(C))},onPointerLeave(C){if(!Ee.current||!z.current||C.pointerType==="touch")return;Y.current=!0;const j=C.relatedTarget;if(!(!d||n.current.includes(j))&&ce.current&&(ke.current?.(),ke.current=null,b.current=-1,N(C),!a)){const M=T.current,V=xt(et(M));M&&Be(M,V)&&M.focus({preventScroll:!0})}}}),[te,Ee,T,d,n,N,ce,a]),he=x.useMemo(()=>a&&A&&He&&{"aria-activedescendant":`${w}-${o}`},[a,A,He,w,o]),le=x.useMemo(()=>({"aria-orientation":h==="both"?void 0:h,...H?{}:he,onKeyDown(O){if(O.key==="Tab"&&O.shiftKey&&A&&!a){const C=mn(O.nativeEvent);if(C&&!Be(T.current,C))return;fe(O),P.setOpen(!1,Qe(Jn,O.nativeEvent)),pe(L)&&L.focus();return}ge(O)},onPointerMove(O){Zt(O)||(z.current=!0)}}),[he,ge,T,h,H,P,A,a,L]),ne=x.useMemo(()=>{function O(M){P.setOpen(!0,Qe(jt,M.nativeEvent,M.currentTarget))}function C(M){g==="auto"&&jn(M.nativeEvent)&&(W.current=!a)}function j(M){W.current=g,g==="auto"&&fn(M.nativeEvent)&&(W.current=!0)}return{onKeyDown(M){const V=P.select("open");z.current=!1;const Z=M.key.startsWith("Arrow"),Ve=Jo(M.key,ve(),u),$e=Ue(M.key,h),Ne=(f?Ve:$e)||M.key==="Enter"||M.key.trim()==="";if(a&&V)return ge(M);if(!(!V&&!m&&Z)){if(Ne){const Pe=Ue(M.key,ve());_.current=f&&Pe?null:M.key}if(f){Ve&&(fe(M),V?(b.current=Fe(),N(M)):O(M));return}$e&&(ee.current!=null&&(b.current=ee.current),fe(M),!V&&m?O(M):ge(M),V&&N(M))}},onFocus(M){P.select("open")&&!a&&(b.current=-1,N(M))},onPointerDown:j,onPointerEnter:j,onMouseDown:C,onClick:C}},[ge,g,Fe,f,N,P,m,h,ve,u,ee,a]),We=x.useMemo(()=>({...he,...ne}),[he,ne]);return x.useMemo(()=>i?{reference:We,floating:le,item:Ce,trigger:ne}:{},[i,We,le,ne,Ce])}function vr(e,t){const{listRef:n,elementsRef:o,activeIndex:r,onMatch:i,disabledIndices:s,onTyping:c,enabled:l=!0,resetMs:f=750,selectedIndex:u=null}=t,a="rootStore"in e?e.rootStore:e,g=a.useState("open"),d=Mt(),m=x.useRef(""),p=x.useRef(u??r??-1),h=x.useRef(null),y=ie(R=>{function v(T){return o?.current[T]}function S(T){const $=v(T);return $&&!Vn($)||$?.matches(":disabled")?!1:s==null||!$n(Fn,T,s)}function P(T,$,F=0){if(T.length===0)return-1;const W=(F%T.length+T.length)%T.length,b=$.toLowerCase();for(let _=0;_<T.length;_+=1){const z=(W+_)%T.length;if(!(!T[z]?.toLowerCase().startsWith(b)||!S(z)))return z}return-1}const A=n.current;if(m.current.length>0&&R.key===" "&&(fe(R),c?.(!0)),m.current.length>0&&m.current[0]!==" "&&P(A,m.current)===-1&&R.key!==" "&&c?.(!1),A==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;g&&R.key!==" "&&(fe(R),c?.(!0));const k=m.current==="";k&&(p.current=u??r??-1),A.every((T,$)=>T&&S($)?T[0]?.toLowerCase()!==T[1]?.toLowerCase():!0)&&m.current===R.key&&(m.current="",p.current=h.current),m.current+=R.key,d.start(f,()=>{m.current="",p.current=h.current,c?.(!1)});const K=((k?u??r??-1:p.current)??0)+1,H=P(A,m.current,K);H!==-1?(i?.(H),h.current=H):R.key!==" "&&(m.current="",c?.(!1))}),w=ie(R=>{const v=R.relatedTarget,S=a.select("domReferenceElement"),P=a.select("floatingElement");Be(S,v)||Be(P,v)||(d.clear(),m.current="",p.current=h.current,c?.(!1))});q(()=>{!g&&u!==null||(d.clear(),h.current=null,m.current!==""&&(m.current=""))},[g,u,d]);const E=x.useMemo(()=>({onKeyDown:y,onBlur:w}),[y,w]);return x.useMemo(()=>l?{reference:E,floating:E}:{},[l,E])}function er(e){const t=x.useRef(""),n=x.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:x.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function tr(e,t){const n=ie((i,s)=>{(typeof e=="function"?e():e)||t(s||(Yn?"touch":""))}),{onClick:o,onPointerDown:r}=er(n);return x.useMemo(()=>({onClick:o,onPointerDown:r}),[o,r])}function Ar(e){const[t,n]=x.useState(null),o=tr(e,n);return Zn(e,r=>{r&&!e&&n(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const nr=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:s,elements:c,middlewareData:l}=t,{element:f,padding:u=0,offsetParent:a="real"}=ye(e,t)||{};if(f==null)return{};const g=hn(u),d={x:n,y:o},m=Dt(r),p=kt(m),h=await s.getDimensions(f),y=m==="y",w=y?"top":"left",E=y?"bottom":"right",R=y?"clientHeight":"clientWidth",v=i.reference[p]+i.reference[m]-d[m]-i.floating[p],S=d[m]-i.reference[m],P=a==="real"?await s.getOffsetParent?.(f):c.floating;let A=c.floating[R]||i.floating[p];(!A||!await s.isElement?.(P))&&(A=c.floating[R]||i.floating[p]);const k=v/2-S/2,L=A/2-h[p]/2-1,D=Math.min(g[w],L),K=Math.min(g[E],L),H=D,T=A-h[p]-K,$=A/2-h[p]/2+k,F=gn(H,$,T),W=!l.arrow&&Re(r)!=null&&$!==F&&i.reference[p]/2-($<H?D:K)-h[p]/2<0,b=W?$<H?$-H:$-T:0;return{[m]:d[m]+b,data:{[m]:F,centerOffset:$-F-b,...W&&{alignmentOffset:b}},reset:W}}}),or=(e,t)=>({...nr(e),options:[e,t]}),rr={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,i=t===0&&n===0&&o===0&&r===0,s=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:s.top-n>=0||s.right-t>=0||s.bottom-n>=0||s.left-t>=0||i}}}},ir={sideX:"left",sideY:"top"},en="--available-width",tn="--available-height";function An(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function nn(e,t,n){const{rects:o,placement:r}=e;return{side:An(t,J(r),n),align:Re(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Or(e){return sr(e,Uo)}function sr(e,t){const{anchor:n,positionMethod:o="absolute",side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,collisionBoundary:l,collisionPadding:f=5,sticky:u=!1,arrowPadding:a=5,disableAnchorTracking:g=!1,inline:d,keepMounted:m=!1,floatingRootContext:p,mounted:h,collisionAvoidance:y,shift:w,nodeId:E,adaptiveOrigin:R,lazyFlip:v=!1,externalTree:S}=e,[P,A]=x.useState(null);!h&&P!==null&&A(null);const k=y.side||"flip",L=y.align||"flip",D=y.fallbackAxisSide||"end",K=w?.crossAxis??!1,H=w?.rootBoundary,T=typeof n=="function"?n:void 0,$=ie(T),F=T?$:n,W=ue(n),b=ue(h),z=eo()==="rtl",N=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":z?"left":"right","inline-start":z?"right":"left"}[r],be=s==="center"?N:`${N}-${s}`;let B=f;typeof B=="number"?B={top:B,right:B,bottom:B,left:B}:B&&(B={top:B.top||0,right:B.right||0,bottom:B.bottom||0,left:B.left||0});const Y=1,Oe=r==="bottom"?Y:0,ke=r==="top"?Y:0,ft=r==="right"?Y:0,Ee=r==="left"?Y:0,ee={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:B},ce=x.useRef(null),De=ue(i),Se=ue(c),Ie=typeof i!="function"?i:0,He=typeof c!="function"?c:0,te=[];d&&te.push(d),te.push(Ko(I=>{const G=nn(I,r,z),oe=typeof De.current=="function"?De.current(G):De.current,X=typeof Se.current=="function"?Se.current(G):Se.current;return{mainAxis:oe,crossAxis:X,alignmentAxis:X}},[Ie,He,z,r]));const ve=L==="none"&&k!=="shift",Fe=!ve&&(u||K||k==="shift"),ge=k==="none"?null:Xo({...ee,padding:{top:B.top+Y+Oe,right:B.right+Y+Ee,bottom:B.bottom+Y+ke,left:B.left+Y+ft},mainAxis:!K&&k==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:D}),Ce=ve?null:jo({...ee,rootBoundary:H,mainAxis:L!=="none",crossAxis:Fe,limiter:u||K?void 0:Yo(I=>{if(!ce.current)return{};const{width:G,height:oe}=ce.current.getBoundingClientRect(),X=Q(J(I.placement)),ae=X==="y"?G:oe,re=X==="y"?B.left+B.right:B.top+B.bottom;return{offset:ae/2+re/2}})},[ee,u,K,H,B,L]);k==="shift"||L==="shift"||s==="center"?te.push(Ce,ge):te.push(ge,Ce),te.push(qo({...ee,apply({elements:{floating:I},availableWidth:G,availableHeight:oe,rects:X}){if(!b.current)return;const ae=I.style;ae.setProperty(en,`${G}px`),ae.setProperty(tn,`${oe}px`);const re=se(I).devicePixelRatio||1,{x:_e,y:je,width:Ye,height:ut}=X.reference,dt=(Math.round((_e+Ye)*re)-Math.round(_e*re))/re,mt=(Math.round((je+ut)*re)-Math.round(je*re))/re;ae.setProperty("--anchor-width",`${dt}px`),ae.setProperty("--anchor-height",`${mt}px`)}}),or(I=>({element:ce.current||et(I.elements.floating).createElement("div"),padding:a,offsetParent:"floating"}),[a]),{name:"transformOrigin",fn(I){const{elements:G,middlewareData:oe,placement:X,rects:ae,y:re}=I,_e=J(X),je=Q(_e),Ye=ce.current,ut=oe.arrow?.x||0,dt=oe.arrow?.y||0,mt=Ye?.clientWidth||0,Sn=Ye?.clientHeight||0,gt=ut+mt/2,Bt=dt+Sn/2,Cn=Math.abs(oe.shift?.y||0),Pn=ae.reference.height/2,ze=typeof i=="function"?i(nn(I,r,z)):i,Mn=Cn>ze,Tn={top:`${gt}px calc(100% + ${ze}px)`,bottom:`${gt}px ${-ze}px`,left:`calc(100% + ${ze}px) ${Bt}px`,right:`${-ze}px ${Bt}px`}[_e],Ln=`${gt}px ${ae.reference.y+Pn-re}px`;return G.floating.style.setProperty("--transform-origin",Fe&&je==="y"&&Mn?Ln:Tn),{}}},rr,R),q(()=>{!h&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,p]);const he=x.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:le,elements:ne,x:We,y:O,middlewareData:C,update:j,placement:M,context:V,isPositioned:Z,floatingStyles:Ve}=t({rootContext:p,open:m?h:void 0,placement:be,middleware:te,strategy:o,whileElementsMounted:m?void 0:(...I)=>Qt(...I,he),nodeId:E,externalTree:S}),{sideX:$e,sideY:Ne}=C.adaptiveOrigin||ir,Pe=Z?o:"fixed",Ft=x.useMemo(()=>{let I;return Z?R?I={position:Pe,[$e]:We,[Ne]:O}:I={...Ve,position:Pe}:I={position:Pe,top:0,left:0},I[en]="100vw",I[tn]="100vh",Z||(I.opacity=0),I},[R,Pe,$e,We,Ne,O,Ve,Z]),Ke=x.useRef(null);q(()=>{if(!h)return;const I=W.current,G=typeof I=="function"?I():I,X=(on(G)?G.current:G)||null||null;X!==Ke.current&&(le.setPositionReference(X),Ke.current=X)},[h,le,F,W]),x.useEffect(()=>{if(!h)return;const I=W.current;typeof I!="function"&&on(I)&&I.current!==Ke.current&&(le.setPositionReference(I.current),Ke.current=I.current)},[h,le,F,W]),x.useEffect(()=>{if(m&&h&&ne.reference&&ne.floating)return Qt(ne.reference,ne.floating,j,he)},[m,h,ne,j,he]);const Me=J(M),Wt=An(r,Me,z),Vt=Re(M)||"center",$t=!!C.hide?.referenceHidden;q(()=>{v&&h&&Z&&Me!==N&&A(Me)},[v,h,Z,Me,N]);const _t=x.useMemo(()=>({position:"absolute",top:C.arrow?.y,left:C.arrow?.x}),[C.arrow]),zt=C.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Ft,arrowStyles:_t,arrowRef:ce,arrowUncentered:zt,side:Wt,align:Vt,physicalSide:Me,anchorHidden:$t,refs:le,context:V,isPositioned:Z,update:j}),[Ft,_t,ce,zt,Wt,Vt,Me,$t,le,V,Z,j])}function on(e){return e!=null&&"current"in e}function cr(e){return e==="starting"?Xn:rn}function Er(e,t,{styles:n,transitionStatus:o,props:r,refs:i,hidden:s,inert:c=!1}){const l={...n};return c&&(l.pointerEvents="none"),Ct("div",e,{state:t,ref:i,props:[{role:"presentation",hidden:s,style:l},cr(o),r],stateAttributesMapping:qn})}const lr=x.createContext(void 0);function Sr(e){return x.useContext(lr)}const ar=20;function Cr(e,t,n,o){const[r,i]=x.useState(!1);q(()=>{if(!e||!t||n==null){i(!1);return}const s=et(n).documentElement.clientWidth,c=n.offsetWidth;i(s>0&&c>0&&c>=s-ar)},[e,t,n]),Un(e&&(!t||r),o)}const Ge=5;function Pr(e,t){const n=fr(t);return e.clientX>=n.left-Ge&&e.clientX<=n.right+Ge&&e.clientY>=n.top-Ge&&e.clientY<=n.bottom+Ge}function fr(e){const t=e.getBoundingClientRect(),n=se(e);if(Gn)return t;const o=n.getComputedStyle(e,"::before"),r=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||r.content!=="none"))return t;const s=parseFloat(o.width)||0,c=parseFloat(o.height)||0,l=parseFloat(r.width)||0,f=parseFloat(r.height)||0,u=Math.max(t.width,s,l),a=Math.max(t.height,c,f),g=u-t.width,d=a-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-d/2,bottom:t.bottom+d/2}}const On=x.createContext(void 0);function ur(){const e=x.useContext(On);if(e===void 0)throw new Error(Wn(13));return e}const En={imageLoadingStatus:()=>null},dr=x.forwardRef(function(t,n){const{className:o,render:r,style:i,...s}=t,[c,l]=x.useState("idle"),f={imageLoadingStatus:c},u=x.useMemo(()=>({imageLoadingStatus:c,setImageLoadingStatus:l}),[c,l]),a=Ct("span",t,{state:f,ref:n,props:s,stateAttributesMapping:En});return Pt.jsx(On.Provider,{value:u,children:a})}),mr=x.forwardRef(function(t,n){const{className:o,render:r,delay:i=0,style:s,...c}=t,{imageLoadingStatus:l}=ur(),[f,u]=x.useState(i===0),a=Mt();return x.useEffect(()=>(i>0?a.start(i,()=>u(!0)):u(!0),a.clear),[a,i]),Ct("span",t,{state:{imageLoadingStatus:l},ref:n,props:c,stateAttributesMapping:En,enabled:l!=="loaded"&&(i===0||f)})});function Mr({className:e,size:t="default",...n}){return Pt.jsx(dr,{"data-slot":"avatar","data-size":t,className:an("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),...n})}function Tr({className:e,...t}){return Pt.jsx(mr,{"data-slot":"avatar-fallback",className:an("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...t})}export{Mr as A,Er as a,Tr as b,Ar as c,Rr as d,br as e,vr as f,cr as g,Cr as h,Pr as i,Sr as j,Do as p,ot as r,Or as u};
@@ -1 +1 @@
1
- import{m as a,h as n,o}from"./index-N-I90MR_.js";import{u as d}from"./useRender-B_SZ1tbi.js";const s=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function v({className:r,variant:e="default",render:t,...i}){return d({defaultTagName:"span",props:a({className:n(s({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{v as B};
1
+ import{m as a,h as n,o}from"./index-DAdE1N-R.js";import{u as d}from"./useRender-DQYQmhIj.js";const s=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function v({className:r,variant:e="default",render:t,...i}){return d({defaultTagName:"span",props:a({className:n(s({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{v as B};
@@ -1 +1 @@
1
- import{j as s,h as t}from"./index-N-I90MR_.js";function c({className:a,size:d="default",...r}){return s.jsx("div",{"data-slot":"card","data-size":d,className:t("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...r})}export{c as C};
1
+ import{j as s,h as t}from"./index-DAdE1N-R.js";function c({className:a,size:d="default",...r}){return s.jsx("div",{"data-slot":"card","data-size":d,className:t("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...r})}export{c as C};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-N-I90MR_.js";/**
1
+ import{c}from"./index-DAdE1N-R.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-N-I90MR_.js";/**
1
+ import{c as o}from"./index-DAdE1N-R.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-N-I90MR_.js";/**
1
+ import{c as o}from"./index-DAdE1N-R.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-N-I90MR_.js";/**
1
+ import{c}from"./index-DAdE1N-R.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,6 @@
1
+ import{c as Wn,aE as ne,l as Ie,aO as re,b5 as dt,aJ as Ut,a9 as We,r as c,i as Yt,k as we,ac as _n,e as B,j as I,ak as Gt,n as ft,E as Te,f as q,b6 as Un,ab as Rt,g as qe,aF as Ze,aG as Yn,b7 as Gn,b8 as Kn,b9 as Xn,aP as $n,B as Kt,h as ke}from"./index-DAdE1N-R.js";import{a as F,r as U,x as pe,c as ye,E as qn,u as Xt,m as $t,e as pt,b as qt,o as zt,g as Ee,t as Jt,z as Qt,n as zn,y as Jn,i as Qn}from"./label-ComnO04i.js";import{j as Zt,c as Zn,T as Tt,t as en,b as eo,r as me,a as to,u as tn,C as no,i as oo,p as ro}from"./inertValue-C7RCWgtk.js";/**
2
+ * @license lucide-react v1.39.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const so=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],io=Wn("x",so);function ao(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:uo,platform:co,maxTouchPoints:lo}=ao(),ze=uo.toLowerCase(),He=co.toLowerCase(),gt=/^i(os$|p)/.test(He)||He==="macintel"&&lo>1,Ct="android",st=He===Ct||ze.includes(Ct),fo=!gt&&He.startsWith("mac");He.startsWith("win");const po=fo||gt,Fe=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!Fe&&ze.includes("firefox");!Fe&&ze.includes("chrom");const go=po,nn=/jsdom|happydom/.test(ze),it="data-base-ui-focusable",on="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",qr="ArrowLeft",zr="ArrowRight",Jr="ArrowUp",Qr="ArrowDown";function Zr(e,t){if(!Ie(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,o]of t.entries())if(F(o,n))return!o.hasAttribute("data-trigger-disabled");return!1}function et(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function ho(e){return e.matches("html,body")}function rn(e){return ne(e)&&e.matches(on)}function es(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${on}`)!=null}function vt(e){return e?e.getAttribute("role")==="combobox"&&rn(e):!1}function ts(e){if(!e||nn)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Ot(e){return e?e.hasAttribute(it)?e:e.querySelector(`[${it}]`)||e:null}function Ve(e,t,n=!0){return e.filter(r=>r.parentId===t).flatMap(r=>[...!n||r.context?.open?[r]:[],...Ve(e,r.id,n)])}function It(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){const r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function mo(e){e.preventDefault(),e.stopPropagation()}function bo(e){return"nativeEvent"in e}function yo(e){return e.pointerType===""&&e.isTrusted?!0:st&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Eo(e){return nn?!1:!st&&e.width===0&&e.height===0||st&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function ns(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function So(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const xo='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Ro(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return dt(n)?n.host:null}function at(e){for(const t of Array.from(e.children))if(re(t)==="summary")return t;return null}function To(e,t){const n=at(t);return!!n&&(e===n||F(n,e))}function sn(e){const t=e?re(e):"";return e!=null&&e.matches(xo)&&(t!=="summary"||e.parentElement!=null&&re(e.parentElement)==="details"&&at(e.parentElement)===e)&&(t!=="details"||at(e)==null)&&(t!=="input"||e.type!=="hidden")}function an(e){if(!sn(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=Ro(t)){const n=t!==e,o=re(t)==="slot";if(t.hasAttribute("inert")||n&&re(t)==="details"&&!t.open&&!To(e,t)||t.hasAttribute("hidden")||!o&&!Co(t,n))return!1}return!0}function Co(e,t){const n=Ut(e);return t?n.display!=="none":Zt(e,n)}function un(e){const t=e.tabIndex;if(t<0){const n=re(e);if(n==="details"||n==="audio"||n==="video"||ne(e)&&e.isContentEditable)return 0}return t}function tt(e){if(re(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function vo(e,t){const n=tt(e);if(!n)return!0;const o=t.find(r=>{const s=tt(r);return s?.name===n.name&&s.form===n.form&&s.checked});return o?o===n:t.find(r=>{const s=tt(r);return s?.name===n.name&&s.form===n.form})===n}function cn(e){if(ne(e)&&re(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return ne(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function ln(e,t){cn(e).forEach(n=>{sn(n)&&t.push(n),ln(n,t)})}function dn(e,t,n){cn(e).forEach(o=>{ne(o)&&o.matches(t)&&n.push(o),dn(o,t,n)})}function ht(e){return an(e)&&un(e)>=0}function fn(e){const t=[];return ln(e,t),t.filter(an)}function _e(e){const t=fn(e);return t.filter(n=>un(n)>=0&&vo(n,t))}function pn(e,t){const n=_e(e),o=n.length;if(o===0)return;const r=pe(U(e)),s=n.indexOf(r),a=s===-1?t===1?0:o-1:s+t;return n[a]}function gn(e){return pn(U(e).body,1)||e}function hn(e){return pn(U(e).body,-1)||e}function mn(e,t){if(!e)return null;const n=_e(U(e).body),o=n.length;if(o===0)return null;const r=n.indexOf(e);if(r===-1)return null;const s=(r+t+o)%o;return n[s]}function os(e){return mn(e,1)}function rs(e){return mn(e,-1)}function Le(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!F(n,o)}function Oo(e){_e(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Pt(e){const t=[];dn(e,"[data-tabindex]",t),t.forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}const Ne=0;class Ce{static create(){return new Ce}currentId=Ne;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ne,n()},t)}isStarted(){return this.currentId!==Ne}clear=()=>{this.currentId!==Ne&&(clearTimeout(this.currentId),this.currentId=Ne)};disposeEffect=()=>this.clear}function Ke(){const e=We(Ce.create).current;return Zn(e.disposeEffect),e}const bn=c.createContext(void 0);function ve(e){const t=c.useContext(bn);if(!e&&t===void 0)throw new Error(Yt(27));return t}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Tt.startingStyle]="startingStyle",e[e.endingStyle=Tt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const Io={"data-popup-open":""},Po={"data-popup-open":"","data-pressed":""},wo={"data-open":""},ko={"data-closed":""},Fo={"data-anchor-hidden":""},ss={open(e){return e?Io:null}},is={open(e){return e?Po:null}},yn={open(e){return e?wo:ko},anchorHidden(e){return e?Fo:null}},Do={...yn,...en},Ao=c.forwardRef(function(t,n){const{render:o,className:r,style:s,forceRender:a=!1,...u}=t,l=ve(),i=l.useState("open"),g=l.useState("nested"),x=l.useState("mounted"),d=l.useState("transitionStatus");return we("div",t,{state:{open:i,transitionStatus:d},ref:[l.context.backdropRef,n],stateAttributesMapping:Do,props:[{role:"presentation",hidden:!x,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:a||!g})}),En=c.forwardRef(function(t,n){const{render:o,className:r,style:s,disabled:a=!1,nativeButton:u=!0,...l}=t,i=ve(),g=i.useState("open"),{getButtonProps:x,buttonRef:d}=_n({disabled:a,native:u}),p={disabled:a};function m(T){g&&i.setOpen(!1,ye(qn,T.nativeEvent))}return we("button",t,{state:p,ref:[n,d],props:[{onClick:m},l,x]})}),Mo=c.forwardRef(function(t,n){const{render:o,className:r,style:s,id:a,...u}=t,l=ve(),i=Xt(a);return l.useSyncedValueWithCleanup("descriptionElementId",i),we("p",t,{ref:n,props:[{id:i},u]})});function M(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}function Pe(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Ye(e){const t=We(No,e).current;return t.next=e,B(t.effect),t}function No(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Sn={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},jo={...Sn,position:"fixed",top:0,left:0},as={...Sn,position:"absolute"},Xe=c.forwardRef(function(t,n){const[o,r]=c.useState();B(()=>{go&&Fe&&r("button")},[]);const s={tabIndex:0,role:o};return I.jsx("span",{...t,ref:n,style:jo,"aria-hidden":o?void 0:!0,...s,"data-base-ui-focus-guard":""})});function $e(e){return`data-base-ui-${e}`}let Ge=0;function nt(e,t={}){const{preventScroll:n=!1,sync:o=!1,shouldFocus:r}=t;cancelAnimationFrame(Ge);function s(){r&&!r()||e?.focus({preventScroll:n})}if(o)return s(),Gt;const a=requestAnimationFrame(s);return Ge=a,()=>{Ge===a&&(cancelAnimationFrame(a),Ge=0)}}const ot={inert:new WeakMap,"aria-hidden":new WeakMap},wt="data-base-ui-inert",ut={inert:new WeakSet,"aria-hidden":new WeakSet};let je=new WeakMap,rt=0;function Lo(e){return ut[e]}function xn(e){return e?dt(e)?e.host:xn(e.parentNode):null}const kt=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=xn(n);return e.contains(o)?o:null}).filter(n=>n!=null),Ft=e=>{const t=new Set;return e.forEach(n=>{let o=n;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},Dt=(e,t,n)=>{const o=[],r=s=>{!s||n.has(s)||Array.from(s.children).forEach(a=>{re(a)!=="script"&&(t.has(a)?r(a):o.push(a))})};return r(e),o};function Bo(e,t,n,o,{mark:r=!0}){let s=null;o?s="inert":n&&(s="aria-hidden");let a=null,u=null;const l=kt(t,e),i=r?Dt(t,Ft(l),new Set(l)):[],g=[],x=[];if(s){const d=ot[s],p=Lo(s);u=p,a=d;const m=kt(t,Array.from(t.querySelectorAll("[aria-live]"))),T=l.concat(m);Dt(t,Ft(T),new Set(T)).forEach(E=>{const b=E.getAttribute(s),Y=b!==null&&b!=="false",C=(d.get(E)||0)+1;d.set(E,C),g.push(E),C===1&&Y&&p.add(E),Y||E.setAttribute(s,s==="inert"?"":"true")})}return r&&i.forEach(d=>{const p=(je.get(d)||0)+1;je.set(d,p),x.push(d),p===1&&d.setAttribute(wt,"")}),rt+=1,()=>{a&&g.forEach(d=>{const m=(a.get(d)||0)-1;a.set(d,m),m||(!u?.has(d)&&s&&d.removeAttribute(s),u?.delete(d))}),r&&x.forEach(d=>{const p=(je.get(d)||0)-1;je.set(d,p),p||d.removeAttribute(wt)}),rt-=1,rt||(ot.inert=new WeakMap,ot["aria-hidden"]=new WeakMap,ut.inert=new WeakSet,ut["aria-hidden"]=new WeakSet,je=new WeakMap)}}function At(e,t={}){const{ariaHidden:n=!1,inert:o=!1,mark:r=!0}=t,s=U(e[0]).body;return Bo(e,s,n,o,{mark:r})}const us=500,cs=500,ls={style:{transition:"none"}},Ho="data-base-ui-click-trigger",ds={fallbackAxisSide:"none"},fs={fallbackAxisSide:"end"},Vo={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Rn=c.createContext(null),Tn=()=>c.useContext(Rn),Wo=$e("portal");function _o(e={}){const{ref:t,container:n,componentProps:o=Te,elementProps:r}=e,s=pt(),u=Tn()?.portalNode,[l,i]=c.useState(null),[g,x]=c.useState(null),d=q(y=>{y!==null&&x(y)}),p=c.useRef(null);B(()=>{if(n===null){p.current&&(p.current=null,x(null),i(null));return}const y=(n&&(Un(n)?n:n.current))??u??document.body;if(y==null){p.current&&(p.current=null,x(null),i(null));return}p.current!==y&&(p.current=y,x(null),i(y))},[n,u]);const m=we("div",o,{ref:[t,d],props:[{id:s,[Wo]:""},r]}),T=l&&m?ft.createPortal(m,l):null;return{node:g,nodeId:c.isValidElement(m)?m.props.id:void 0,subtree:T}}const Uo=c.forwardRef(function(t,n){const{render:o,className:r,style:s,children:a,container:u,...l}=t,{node:i,nodeId:g,subtree:x}=_o({container:u,ref:n,componentProps:t,elementProps:l}),d=c.useRef(null),p=c.useRef(null),m=c.useRef(null),T=c.useRef(null),[y,E]=c.useState(null),b=c.useRef(!1),Y=y?.modal,C=y?.open,j=!!y&&!y.modal&&y.open&&!!i;c.useEffect(()=>{if(!i||Y)return;function D(H){i&&H.relatedTarget&&Le(H)&&(H.type==="focusin"?b.current&&(Pt(i),b.current=!1):(Oo(i),b.current=!0))}return Pe(M(i,"focusin",D,!0),M(i,"focusout",D,!0))},[i,Y]),B(()=>{!i||C!==!0||!b.current||(Pt(i),b.current=!1)},[C,i]);const K=c.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:T,portalNode:i,setFocusManagerState:E}),[i]);return I.jsxs(c.Fragment,{children:[x,I.jsxs(Rn.Provider,{value:K,children:[j&&i&&I.jsx(Xe,{"data-type":"outside",ref:d,onFocus:D=>{if(Le(D,i))m.current?.focus();else{const H=y?y.domReference:null;hn(H)?.focus()}}}),j&&i&&I.jsx("span",{"aria-owns":g,style:Vo}),i&&ft.createPortal(a,i),j&&i&&I.jsx(Xe,{"data-type":"outside",ref:p,onFocus:D=>{if(Le(D,i))T.current?.focus();else{const H=y?y.domReference:null;gn(H)?.focus(),y?.closeOnFocusOut&&y?.onOpenChange(!1,ye($t,D.nativeEvent))}}})]})]})});function Cn(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Yo{nodesRef={current:[]};events=Cn();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const vn=c.createContext(null),On=c.createContext(null),mt=()=>c.useContext(vn)?.id||null,bt=e=>{const t=c.useContext(On);return e??t};function ps(e){const t=pt(),n=bt(e),o=mt();return B(()=>{if(!t)return;const r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function gs(e){const{children:t,id:n}=e,o=mt();return I.jsx(vn.Provider,{value:c.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function hs(e){const{children:t,externalTree:n}=e,o=We(()=>n??new Yo).current;return I.jsx(On.Provider,{value:o,children:t})}function Go(e,t){const n=qe(Ee(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Mt=20;let be=[];function yt(){be=be.filter(e=>e.deref()?.isConnected)}function Nt(e){yt(),e&&re(e)!=="body"&&(be.push(new WeakRef(e)),be.length>Mt&&(be=be.slice(-Mt)))}function jt(){return yt(),be[be.length-1]?.deref()}function Ko(e){return e?ht(e)?e:_e(e)[0]||e:null}function Lt(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=fn(e).filter(r=>{const s=r.getAttribute("data-tabindex")||"";return ht(r)||r.hasAttribute("data-tabindex")&&!s.startsWith("-")}),o=e.getAttribute("tabindex");n.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Xo(e){const{context:t,children:n,disabled:o=!1,initialFocus:r=!0,returnFocus:s=!0,restoreFocus:a=!1,modal:u=!0,closeOnFocusOut:l=!0,openInteractionType:i="",nextFocusableElement:g,previousFocusableElement:x,beforeContentFocusGuardRef:d,externalTree:p,getInsideElements:m}=e,T="rootStore"in t?t.rootStore:t,y=T.useState("open"),E=T.useState("domReferenceElement"),b=T.useState("floatingElement"),{events:Y,dataRef:C}=T.context,j=q(()=>C.current.floatingContext?.nodeId),K=r===!1,D=vt(E)&&K,H=Ye(r),A=Ye(s),$=Ye(i),ge=Ye(y),W=bt(p),P=Tn(),X=c.useRef(!1),ce=c.useRef(!1),se=c.useRef(!1),ie=c.useRef(null),Se=c.useRef(""),he=c.useRef(""),xe=c.useRef(null),Oe=c.useRef(null),w=Rt(xe,d,P?.beforeInsideRef),Z=Rt(Oe,P?.afterInsideRef),le=Ke(),de=Ke(),De=eo(),Ue=P!=null,v=Ot(b),ae=q((O=v)=>O?_e(O):[]),oe=q(()=>m?.().filter(O=>O!=null)??[]);c.useEffect(()=>{if(o||!u)return;function O(G){G.key==="Tab"&&F(v,pe(U(v)))&&ae().length===0&&!D&&mo(G)}const V=U(v);return M(V,"keydown",O)},[o,v,u,D,ae]),c.useEffect(()=>{if(o||!y)return;const O=U(v);function V(){se.current=!1}function G(ee){const R=Ee(ee),N=oe(),S=F(b,R)||F(E,R)||F(P?.portalNode,R)||N.some(_=>_===R||F(_,R));se.current=!S,he.current=ee.pointerType||"keyboard",R?.closest(`[${Ho}]`)&&(ce.current=!0,de.start(0,()=>{ce.current=!1}))}function z(){he.current="keyboard"}return Pe(M(O,"pointerdown",G,!0),M(O,"pointerup",V,!0),M(O,"pointercancel",V,!0),M(O,"keydown",z,!0),V)},[o,b,E,v,y,P,de,oe]),c.useEffect(()=>{if(o||!l)return;const O=U(v);function V(){ce.current=!0,de.start(0,()=>{ce.current=!1})}function G(N){const S=Ee(N);ht(S)&&(ie.current=S)}function z(N){const S=N.relatedTarget,_=N.currentTarget,J=Ee(N);u&&S==null&&J!=null&&F(b,J)&&Nt(J),queueMicrotask(()=>{const L=j(),te=T.context.triggerElements,f=oe(),h=S?.hasAttribute($e("focus-guard"))&&[xe.current,Oe.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,me(x),me(g)].includes(S),Q=!(F(E,S)||F(b,S)||F(S,b)||F(P?.portalNode,S)||f.some(k=>k===S||F(k,S))||te.hasMatchingElement(k=>F(k,S))||h||W&&(Ve(W.nodesRef.current,L).find(k=>F(k.context?.elements.floating,S)||F(k.context?.elements.domReference,S))||It(W.nodesRef.current,L).find(k=>[k.context?.elements.floating,Ot(k.context?.elements.floating)].includes(S)||k.context?.elements.domReference===S)));if(_===E&&v&&Lt(v),a&&_!==E&&!Zt(J)&&pe(O)===O.body){if(ne(v)&&(v.focus(),a==="popup")){De.request(()=>{v.focus()});return}const k=ae(),fe=ie.current,Ae=(fe&&k.includes(fe)?fe:null)||k[k.length-1]||v;ne(Ae)&&Ae.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(D||!u)&&S&&Q&&!ce.current&&(D||S!==jt())&&(X.current=!0,T.setOpen(!1,ye($t,N)))})}function ee(){se.current||(C.current.insideReactTree=!0,le.start(0,()=>{C.current.insideReactTree=!1}))}const R=ne(E)?E:null;if(!(!b&&!R))return Pe(R&&M(R,"focusout",z),R&&M(R,"pointerdown",V),b&&M(b,"focusin",G),b&&M(b,"focusout",z),b&&P&&M(b,"focusout",ee,!0))},[o,E,b,v,u,W,P,T,l,a,ae,D,j,C,le,de,De,g,x,oe]),c.useEffect(()=>{if(o||!b||!y)return;const O=Array.from(P?.portalNode?.querySelectorAll(`[${$e("portal")}]`)||[]),G=(W?It(W.nodesRef.current,j()):[]).find(_=>vt(_.context?.elements.domReference||null))?.context?.elements.domReference,ee=[...[b,...O,xe.current,Oe.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,...oe()],G,me(x),me(g),D?E:null].filter(_=>_!=null),R=At(ee,{ariaHidden:u||D,mark:!1}),N=[b,...O].filter(_=>_!=null),S=At(N);return()=>{S(),R()}},[y,o,E,b,u,P,D,W,j,g,x,oe]),B(()=>{if(!y||o||!ne(v))return;Se.current="",he.current="";const O=U(v),V=pe(O);queueMicrotask(()=>{const G=H.current,z=typeof G=="function"?G($.current||""):G;if(z===void 0||z===!1||F(v,V))return;let R=null;const N=()=>(R==null&&(R=ae(v)),R[0]||v);let S;z===!0||z===null?S=N():S=me(z),S=S||N();const _=F(v,pe(O));nt(S,{preventScroll:S===v,shouldFocus(){if(!ge.current)return!1;if(_)return!0;const J=pe(O);return!(J!==S&&F(v,J))}})})},[o,y,v,ae,H,$,ge]),B(()=>{if(o||!v)return;const O=U(v),V=pe(O),G=$.current==null;Nt(V);function z(R){if(R.open||(Se.current=Go(R.nativeEvent,he.current)),R.reason===qt&&R.nativeEvent.type==="mouseleave"&&(X.current=!0),R.reason===zt)if(R.nested)X.current=!1;else if(yo(R.nativeEvent)||Eo(R.nativeEvent))X.current=!1;else{let N=!1;U(v).createElement("div").focus({get preventScroll(){return N=!0,!1}}),N?X.current=!1:X.current=!0}}Y.on("openchange",z);function ee(R){const N=A.current;let S=typeof N=="function"?N(R):N;if(S===void 0||S===!1)return null;S===null&&(S=!0);const _=E?.isConnected?E:null,J=V?.isConnected&&re(V)!=="body"?V:null;let L=G?J||_:_||J;return L||(L=jt()||null),typeof S=="boolean"?L:me(S)||L||null}return()=>{Y.off("openchange",z);const R=pe(O),N=oe(),S=F(b,R)||N.some(te=>te===R||F(te,R))||W&&Ve(W.nodesRef.current,j(),!1).some(te=>F(te.context?.elements.floating,R)),_=A.current,J=Se.current,L=ee(J);queueMicrotask(()=>{const te=Ko(L),f=typeof _!="boolean";if(_&&!X.current&&ne(te)&&(!(!f&&te!==R&&R!==O.body)||S)){const h={preventScroll:!0};J==="keyboard"&&(h.focusVisible=!0),te.focus(h)}X.current=!1})}},[o,b,v,A,$,Y,W,E,j,oe]),B(()=>{if(!Fe||y||!b)return;const O=pe(U(b));!ne(O)||!rn(O)||F(b,O)&&O.blur()},[y,b]),B(()=>{if(!(o||!P))return P.setFocusManagerState({modal:u,closeOnFocusOut:l,open:y,onOpenChange:T.setOpen,domReference:E}),()=>{P.setFocusManagerState(null)}},[o,P,u,y,T,l,E]),B(()=>{if(!(o||!v))return Lt(v),()=>{queueMicrotask(yt)}},[o,v]);const Re=!o&&(u?!D:!0)&&(Ue||u);return I.jsxs(c.Fragment,{children:[Re&&I.jsx(Xe,{"data-type":"inside",ref:w,onFocus:O=>{if(u){const V=ae();nt(V[V.length-1])}else P?.portalNode&&(X.current=!1,Le(O,P.portalNode)?gn(E)?.focus():me(x??P.beforeOutsideRef)?.focus())}}),n,Re&&I.jsx(Xe,{"data-type":"inside",ref:Z,onFocus:O=>{u?nt(ae()[0]):P?.portalNode&&(l&&(X.current=!0),Le(O,P.portalNode)?hn(E)?.focus():me(g??P.afterOutsideRef)?.focus())}})]})}function $o(){return!1}function qo(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function zo(e,t={}){const{enabled:n=!0,escapeKey:o=!0,outsidePress:r=!0,outsidePressEvent:s="sloppy",referencePress:a=$o,bubbles:u,externalTree:l}=t,i="rootStore"in e?e.rootStore:e,g=i.useState("open"),x=i.useState("floatingElement"),{dataRef:d}=i.context,p=bt(l),m=q(typeof r=="function"?r:()=>!1),T=typeof r=="function"?m:r,y=T!==!1,E=q(()=>s),{escapeKey:b,outsidePress:Y}=qo(u),C=c.useRef(!1),j=c.useRef(!1),K=c.useRef(!1),D=c.useRef(!1),H=c.useRef(""),A=c.useRef(null),$=Ke(),ge=Ke(),W=q(()=>{ge.clear(),d.current.insideReactTree=!1}),P=q(w=>{const Z=d.current.floatingContext?.nodeId;return(p?Ve(p.nodesRef.current,Z):[]).some(de=>de.context?.open&&!de.context.dataRef.current[w])}),X=q(w=>et(w,i.select("floatingElement"))||et(w,i.select("domReferenceElement"))),ce=q(w=>{a()&&i.setOpen(!1,ye(Jt,w.nativeEvent))}),se=q(w=>{if(!g||!n||!o||w.key!=="Escape"||D.current||!b&&P("__escapeKeyBubbles"))return;const Z=bo(w)?w.nativeEvent:w,le=ye(Qt,Z);i.setOpen(!1,le),le.isCanceled||w.preventDefault(),!b&&!le.isPropagationAllowed&&w.stopPropagation()}),ie=q(()=>{d.current.insideReactTree=!0,ge.start(0,W)}),Se=q(w=>{if(!g||!n||w.button!==0)return;const Z=Ee(w.nativeEvent);F(i.select("floatingElement"),Z)&&(C.current||(C.current=!0,j.current=!1))}),he=q(w=>{!g||!n||(w.defaultPrevented||w.nativeEvent.defaultPrevented)&&C.current&&(j.current=!0)});c.useEffect(()=>{if(!g||!n)return W;d.current.__escapeKeyBubbles=b,d.current.__outsidePressBubbles=Y;const w=new Ce,Z=new Ce;function le(){w.clear(),D.current=!0}function de(){w.start(Fe?5:0,()=>{D.current=!1})}function De(){K.current=!0,Z.start(0,()=>{K.current=!1})}function Ue(){C.current=!1,j.current=!1}function v(){const f=H.current,h=f==="pen"||!f?"mouse":f,Q=E(),k=typeof Q=="function"?Q():Q;return typeof k=="string"?k:k[h]}function ae(f){const h=v();return h==="intentional"&&f.type!=="click"||h==="sloppy"&&f.type==="click"}function oe(f){const h=d.current.floatingContext?.nodeId,Q=p&&Ve(p.nodesRef.current,h).some(k=>et(f,k.context?.elements.floating));return X(f)||Q}function Re(f){if(ae(f)){f.type!=="click"&&!X(f)&&(Z.clear(),K.current=!1),W();return}if(d.current.insideReactTree){W();return}const h=Ee(f),Q=`[${$e("inert")}]`,k=Ie(h)?h.getRootNode():null,fe=Array.from((dt(k)?k:U(i.select("floatingElement"))).querySelectorAll(Q)),Ae=i.context.triggerElements;if(h&&(Ae.hasElement(h)||Ae.hasMatchingElement(ue=>F(ue,h))))return;let Me=Ie(h)?h:null;for(;Me&&!Ze(Me);){const ue=Yn(Me);if(Ze(ue)||!Ie(ue))break;Me=ue}if(!(fe.length&&Ie(h)&&!ho(h)&&!F(h,i.select("floatingElement"))&&fe.every(ue=>!F(Me,ue)))){if(ne(h)&&!("touches"in f)){const ue=Ze(h),Qe=Ut(h),xt=/auto|scroll/,Mn=ue||xt.test(Qe.overflowX),Nn=ue||xt.test(Qe.overflowY),jn=Mn&&h.clientWidth>0&&h.scrollWidth>h.clientWidth,Ln=Nn&&h.clientHeight>0&&h.scrollHeight>h.clientHeight,Bn=Qe.direction==="rtl",Hn=Ln&&(Bn?f.offsetX<=h.offsetWidth-h.clientWidth:f.offsetX>h.clientWidth),Vn=jn&&f.offsetY>h.clientHeight;if(Hn||Vn)return}if(!oe(f)){if(v()==="intentional"&&K.current){Z.clear(),K.current=!1;return}typeof T=="function"&&!T(f)||P("__outsidePressBubbles")||(i.setOpen(!1,ye(zt,f)),W())}}}function O(f){v()!=="sloppy"||f.pointerType==="touch"||!i.select("open")||!n||X(f)||Re(f)}function V(f){if(v()!=="sloppy"||!i.select("open")||!n||X(f))return;const h=f.touches[0];h&&(A.current={startTime:Date.now(),startX:h.clientX,startY:h.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},$.start(1e3,()=>{A.current&&(A.current.dismissOnTouchEnd=!1,A.current.dismissOnMouseDown=!1)}))}function G(f,h){const Q=Ee(f);if(!Q)return;const k=M(Q,f.type,()=>{h(f),k()})}function z(f){H.current="touch",G(f,V)}function ee(f){$.clear(),f.type==="pointerdown"&&(H.current=f.pointerType),!(f.type==="mousedown"&&A.current&&!A.current.dismissOnMouseDown)&&G(f,h=>{h.type==="pointerdown"?O(h):Re(h)})}function R(f){if(!C.current)return;const h=j.current;if(Ue(),v()==="intentional"){if(f.type==="pointercancel"){h&&De();return}if(!oe(f)){if(h){De();return}typeof T=="function"&&!T(f)||(Z.clear(),K.current=!0,W())}}}function N(f){if(v()!=="sloppy"||!A.current||X(f))return;const h=f.touches[0];if(!h)return;const Q=Math.abs(h.clientX-A.current.startX),k=Math.abs(h.clientY-A.current.startY),fe=Math.sqrt(Q*Q+k*k);fe>5&&(A.current.dismissOnTouchEnd=!0),fe>10&&(Re(f),$.clear(),A.current=null)}function S(f){G(f,N)}function _(f){v()!=="sloppy"||!A.current||X(f)||(A.current.dismissOnTouchEnd&&Re(f),$.clear(),A.current=null)}function J(f){G(f,_)}const L=U(x),te=Pe(o&&Pe(M(L,"keydown",se),M(L,"compositionstart",le),M(L,"compositionend",de)),y&&Pe(M(L,"click",ee,!0),M(L,"pointerdown",ee,!0),M(L,"pointerup",R,!0),M(L,"pointercancel",R,!0),M(L,"mousedown",ee,!0),M(L,"mouseup",R,!0),M(L,"touchstart",z,!0),M(L,"touchmove",S,!0),M(L,"touchend",J,!0)));return()=>{te(),w.clear(),Z.clear(),Ue(),K.current=!1,W()}},[d,x,o,y,T,g,n,b,Y,se,W,E,P,X,p,i,$]);const xe=c.useMemo(()=>({onKeyDown:se,onPointerDown:ce,onClick:ce}),[se,ce]),Oe=c.useMemo(()=>({onKeyDown:se,onPointerDown:he,onMouseDown:he,onClickCapture:ie,onMouseDownCapture(w){ie(),Se(w)},onPointerDownCapture(w){ie(),Se(w)},onMouseUpCapture:ie,onTouchEndCapture:ie,onTouchMoveCapture:ie}),[se,ie,Se,he]);return c.useMemo(()=>n?{reference:xe,floating:Oe,trigger:xe}:{},[n,xe,Oe])}var In=Gn();const ct=[];let lt;function Jo(){return lt}function Qo(e){ct.push(e)}function Zo(e){const t=(n,o)=>{const r=We(er).current;let s;try{lt=r;for(const a of ct)a.before(r);s=e(n,o);for(const a of ct)a.after(r);r.didInitialize=!0}finally{lt=void 0}return s};return t.displayName=e.displayName||e.name,t}function ms(e){return c.forwardRef(Zo(e))}function er(){return{didInitialize:!1}}const tr=Kn(19),nr=tr?rr:sr;function Pn(e,t,n,o,r){return nr(e,t,n,o,r)}function or(e,t,n,o,r){const s=c.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return In.useSyncExternalStore(e.subscribe,s,s)}Qo({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const o=e.syncHooks[n],r=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,r)||(t=!0,o.value=r)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const r of e.syncHooks)n.add(r.store);const o=[];for(const r of n)o.push(r.subscribe(t));return()=>{for(const r of o)r()}}),In.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function rr(e,t,n,o,r){const s=Jo();if(!s)return or(e,t,n,o,r);const a=s.syncIndex;s.syncIndex+=1;let u;return s.didInitialize?(u=s.syncHooks[a],(u.store!==e||u.selector!==t||!Object.is(u.a1,n)||!Object.is(u.a2,o)||!Object.is(u.a3,r))&&(u.store!==e&&(s.didChangeStore=!0),u.store=e,u.selector=t,u.a1=n,u.a2=o,u.a3=r,u.value=t(e.getSnapshot(),n,o,r))):(u={store:e,selector:t,a1:n,a2:o,a3:r,value:t(e.getSnapshot(),n,o,r)},s.syncHooks.push(u)),u.value}function sr(e,t,n,o,r){return Xn.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class ir{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,o,r){return Pn(this,t,n,o,r)}}class wn extends ir{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}useSyncedValue(t,n){c.useDebugValue(t);const o=this;B(()=>{o.state[t]!==n&&o.set(t,n)},[o,t,n])}useSyncedValueWithCleanup(t,n){const o=this;B(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);B(()=>{n.update(t)},[n,...o])}useControlledProp(t,n){c.useDebugValue(t);const o=this,r=n!==void 0;B(()=>{r&&!Object.is(o.state[t],n)&&o.setState({...o.state,[t]:n})},[o,t,n,r])}select(t,n,o,r){const s=this.selectors[t];return s(this.state,n,o,r)}useState(t,n,o,r){return c.useDebugValue(t),Pn(this,this.selectors[t],n,o,r)}useContextCallback(t,n){c.useDebugValue(t);const o=q(n??Gt);this.context[t]=o}useStateSetter(t){const n=c.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const a=o(s);if(!Object.is(r,a)){const u=r;r=a,n(a,u,this)}})}}const ar={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Et extends wn{constructor(t){const{syncOnly:n,nested:o,onOpenChange:r,triggerElements:s,...a}=t;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Cn(),nested:o,triggerElements:s},ar),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&So(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function ur(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:o,floatingId:r,nested:s,onOpenChange:a}=e,u=t.useState("open"),l=t.useState("activeTriggerElement"),i=t.useState(n?"popupElement":"positionerElement"),g=t.context.triggerElements,x=a,d=c.useRef(null);o===void 0&&d.current===null&&(d.current=new Et({open:u,transitionStatus:void 0,referenceElement:l,floatingElement:i,triggerElements:g,onOpenChange:x,floatingId:r,syncOnly:!0,nested:s}));const p=o??d.current;return t.useSyncedValue("floatingId",r),B(()=>{const m={open:u,floatingId:r,referenceElement:l,floatingElement:i};Ie(l)&&(m.domReferenceElement=l),p.state.positionReference===p.state.referenceElement&&(m.positionReference=l),p.update(m)},[u,r,l,i,p]),p.context.onOpenChange=x,p.context.nested=s,p}const cr={tabIndex:-1,[it]:""};function lr(e){return t=>t==="touch"?e.current:!0}function dr(e,t=!1){const n=pt(),o=mt()!=null,r=We(()=>e(n,o)).current;return ur({popupStore:r,treatPopupAsFloatingElement:t,floatingRootContext:r.state.floatingRootContext,floatingId:n,nested:o,onOpenChange:r.setOpen}),r}function fr({handle:e,store:t}){return B(()=>e.attachStore(t),[e,t]),null}function pr(e,t){const n=c.useRef(null),o=c.useRef(null);return c.useCallback(r=>{if(e===void 0)return;let s=!1;if(n.current!==null){const a=n.current,u=o.current,l=t.context.triggerElements.getById(a);u&&l===u&&(t.context.triggerElements.delete(a),s=!0),n.current=null,o.current=null}if(r!==null&&(n.current=e,o.current=r,t.context.triggerElements.add(e,r),s=!0),s){const a=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==a&&t.set("triggerCount",a)}},[t,e])}function kn(e,t,n,o=!1){t?e.preventUnmountingOnClose=!1:o&&(e.preventUnmountingOnClose=!0);const r=n?.id??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function gr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function bs(e,t,n,o={}){const r=n.reason,s=r===qt,a=t&&r===Jn,u=!t&&(r===Jt||r===Qt),l=gr(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const i=()=>{const g={...o.extraState,open:t};a?g.instantType="focus":u?g.instantType="dismiss":s&&(g.instantType=void 0),kn(g,t,n.trigger,l()),e.update(g)};s?ft.flushSync(i):i()}function ys(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=pr(e,n),a=q(l=>{const i=n.select("open"),g=n.select("activeTriggerId");if(g===e){n.update({activeTriggerElement:l,...i?o:null});return}g==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:l,...o})}),u=c.useCallback(l=>{s(l),l&&a(l)},[s,a]);return B(()=>{r&&n.update({activeTriggerElement:t.current,...o})},[r,n,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:r}}function hr(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,o=c.useRef(null),r=e.useState("open"),s=e.useState("triggerCount"),a=e.useState("activeTriggerId"),u=e.useState("activeTriggerElement");B(()=>{if(!r){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const l=e.context.triggerElements.size,i={};e.state.triggerCount!==l&&(i.triggerCount=l);const g=e.select("activeTriggerId");let x=null;if(g){const d=e.context.triggerElements.getById(g);if(d)o.current=g,d!==e.state.activeTriggerElement&&(i.activeTriggerElement=d);else{for(const[p,m]of e.context.triggerElements.entries())if(m===e.state.activeTriggerElement){i.activeTriggerId=p,i.activeTriggerElement=m,o.current=p;break}i.activeTriggerId===void 0&&(o.current===g?x=g:o.current=null)}}else o.current=null;if(!x&&!g&&l===1){const d=e.context.triggerElements.entries().next();if(!d.done){const[p,m]=d.value;i.activeTriggerId=p,i.activeTriggerElement=m,o.current=p}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),x&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===x&&!e.context.triggerElements.getById(x)){const d=ye(zn);e.setOpen(!1,d),d.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,a,u,n])}function mr(e,t,n){const{mounted:o,setMounted:r,transitionStatus:s}=to(e),a=t.useState("preventUnmountingOnClose"),u=e?!1:a;t.useSyncedValues({mounted:o,transitionStatus:s,preventUnmountingOnClose:u});const l=q(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return tn({enabled:o&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:s}}function br(e,t){e.useSyncedValues(t),B(()=>()=>{e.update({activeTriggerProps:Te,inactiveTriggerProps:Te,popupProps:Te})},[e])}function yr(e,t){B(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),B(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Fn{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Er(){return new Et({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Fn,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Sr(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Er(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Te,inactiveTriggerProps:Te,popupProps:Te}}function xr(e,t,n=!1){return new Et({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const Be=e=>e.triggerIdProp??e.activeTriggerId,St=e=>e.openProp??e.open,Bt=e=>(e.popupElement?.id??e.floatingId)||void 0;function Dn(e,t){return t!==void 0&&St(e)&&Be(e)===t}function Rr(e,t){return Dn(e,t)?!0:t!==void 0&&St(e)&&Be(e)==null&&e.triggerCount===1}const Tr={open:St,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Be,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Bt,isTriggerActive:(e,t)=>t!==void 0&&Be(e)===t,isOpenedByTrigger:(e,t)=>Dn(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Be(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Rr(e,t)?Bt(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement},An=c.createContext(void 0);function Cr(){const e=c.useContext(An);if(e===void 0)throw new Error(Yt(26));return e}const vr={...yn,...en,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},Or=c.forwardRef(function(t,n){const{render:o,className:r,style:s,finalFocus:a,initialFocus:u,...l}=t,i=ve(),g=i.useState("descriptionElementId"),x=i.useState("disablePointerDismissal"),d=i.useState("floatingRootContext"),p=i.useState("popupProps"),m=i.useState("modal"),T=i.useState("mounted"),y=i.useState("nested"),E=i.useState("nestedOpenDialogCount"),b=i.useState("open"),Y=i.useState("openMethod"),C=i.useState("titleElementId"),j=i.useState("transitionStatus"),K=i.useState("role"),D=d.useState("floatingId");Cr(),tn({open:b,ref:i.context.popupRef,onComplete(){b&&i.context.onOpenChangeComplete?.(!0)}});const H=u===void 0?lr(i.context.popupRef):u,A=E>0,$=i.useStateSetter("popupElement"),W=we("div",t,{state:{open:b,nested:y,transitionStatus:j,nestedDialogOpen:A},props:[p,{id:D,"aria-labelledby":C,"aria-describedby":g,role:K,...cr,hidden:!T,onKeyDown(P){no.has(P.key)&&P.stopPropagation()},style:{"--nested-dialogs":E}},l],ref:[n,i.context.popupRef,$],stateAttributesMapping:vr});return I.jsx(Xo,{context:d,openInteractionType:Y,disabled:!T,closeOnFocusOut:!x,initialFocus:H,returnFocus:a,modal:m!==!1,restoreFocus:"popup",children:W})}),Ir=c.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const a=o.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${a.left}px ${a.top}px,${a.left}px ${a.bottom}px,${a.right}px ${a.bottom}px,${a.right}px ${a.top}px,${a.left}px ${a.top}px)`}return I.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),Pr=c.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,s=ve(),a=s.useState("mounted"),u=s.useState("modal"),l=s.useState("open");return a||o?I.jsx(An.Provider,{value:o,children:I.jsxs(Uo,{ref:n,...r,children:[a&&u===!0&&I.jsx(Ir,{ref:s.context.internalBackdropRef,inert:oo(!l)}),t.children]})}):null});let Ht={},Vt={},Wt="";function Je(e,t){return $n(e)?e:t}function _t(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Je(t,n)).overflowY)}function wr(e){if(typeof document>"u")return!1;const t=U(e);return qe(t).innerWidth-t.documentElement.clientWidth>0}function kr(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=U(e),o=n.documentElement,r=n.body,s=Je(o,r),a=s.style.overflowY,u=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",s.style.overflowY="scroll";const l=s.offsetWidth;s.style.overflowY="hidden";const i=s.offsetWidth;return s.style.overflowY=a,o.style.scrollbarGutter=u,l===i}function Fr(e){const t=U(e),n=t.documentElement,o=t.body,r=Je(n,o),s={overflowY:r.style.overflowY,overflowX:r.style.overflowX};return Object.assign(r.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(r.style,s)}}function Dr(e){const t=U(e),n=t.documentElement,o=t.body,r=qe(n);let s=0,a=0,u=!1;const l=ro.create();if(Fe&&(r.visualViewport?.scale??1)!==1)return()=>{};function i(){const p=r.getComputedStyle(n),m=r.getComputedStyle(o),E=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,a=n.scrollLeft,Ht={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Wt=n.style.scrollBehavior,Vt={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const b=n.scrollHeight>n.clientHeight,Y=n.scrollWidth>n.clientWidth,C=p.overflowY==="scroll"||m.overflowY==="scroll",j=p.overflowX==="scroll"||m.overflowX==="scroll",K=Math.max(0,r.innerWidth-o.clientWidth),D=Math.max(0,r.innerHeight-o.clientHeight),H=parseFloat(m.marginTop)+parseFloat(m.marginBottom),A=parseFloat(m.marginLeft)+parseFloat(m.marginRight),$=Je(n,o);if(u=kr(e),u){n.style.scrollbarGutter=E,$.style.overflowY="hidden",$.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(b||C)&&(n.style.overflowY="scroll"),(Y||j)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:H||D?`calc(100dvh - ${H+D}px)`:"100dvh",width:A||K?`calc(100vw - ${A+K}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=a,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function g(){Object.assign(n.style,Ht),Object.assign(o.style,Vt),u||(n.scrollTop=s,n.scrollLeft=a,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Wt)}function x(){g(),l.request(i)}i();const d=M(r,"resize",x);return()=>{l.cancel(),g(),typeof r.removeEventListener=="function"&&d()}}class Ar{lockCount=0;restore=null;timeoutLock=Ce.create();timeoutUnlock=Ce.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=U(t),o=n.documentElement,r=n.body,s=qe(o);if(_t(s,o,r)){const u=new s.MutationObserver(()=>{_t(s,o,r)||(u.disconnect(),this.restore=null,this.lock(t))}),l={attributes:!0};u.observe(o,l),u.observe(r,l),this.restore=()=>u.disconnect();return}const a=gt||!wr(t);this.restore=a?Fr(t):Dr(t)}}const Mr=new Ar;function Nr(e=!0,t=null){B(()=>{if(e)return Mr.acquire(t)},[e,t])}function jr({store:e,parentContext:t,isDrawer:n}){const o=e.useState("open"),r=e.useState("disablePointerDismissal"),s=e.useState("modal"),a=e.useState("popupElement"),u=e.useState("floatingRootContext"),[l,i]=c.useState(0),[g,x]=c.useState(0),d=l===0,p=zo(u,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(m){if(!e.context.outsidePressEnabledRef.current||"button"in m&&m.button!==0)return!1;if("touches"in m){if(m.type==="touchend"){if(m.changedTouches.length!==1||m.touches.length!==0)return!1}else if(m.touches.length!==1)return!1}const T=Ee(m);if(d&&!r){if(s){const y=e.context.internalBackdropRef.current,E=e.context.backdropRef.current;return y||E?y===T||E===T||F(T,a)&&!T?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:d});return Nr(o&&s===!0,a),e.useContextCallback("onNestedDialogOpen",(m,T)=>{i(m),x(T)}),B(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(l+1,g+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[n,o,l,g,t]),br(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:g}),null}const Lr={...Tr,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class Br extends wn{constructor(t,n,o){const r=new Fn,s=Hr(t,r,n,o);super(s,Vr(r),Lr)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const o={open:t};kn(o,t,n.trigger),this.update(o)}}function Hr(e,t,n,o=!1){const r={...Sr(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return r.floatingRootContext=xr(t,n,o),r}function Vr(e){return{popupRef:c.createRef(),backdropRef:c.createRef(),internalBackdropRef:c.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Wr(e,t){const{children:n,open:o,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:a,disablePointerDismissal:u=!1,modal:l=!0,actionsRef:i,handle:g,triggerId:x,defaultTriggerId:d=null}=t,p=e==="drawer",m=l,T=u,y="dialog",E=ve(!0),b=E!=null,Y={modal:m,disablePointerDismissal:T,nested:b,role:y},C=dr(($,ge)=>new Br({open:r,openProp:o,activeTriggerId:d,triggerIdProp:x,...Y},$,ge),!0);C.useControlledProp("openProp",o),C.useControlledProp("triggerIdProp",x),C.useSyncedValues(Y),C.useContextCallback("onOpenChange",s),C.useContextCallback("onOpenChangeComplete",a);const j=C.useState("open"),K=C.useState("mounted"),D=C.useState("payload");yr(C,j),hr(C);const{forceUnmount:H}=mr(j,C);c.useImperativeHandle(i,()=>({unmount:H,close:()=>C.setOpen(!1,ye(Qn))}),[H,C]);const A=j||K;return I.jsxs(bn.Provider,{value:C,children:[g&&I.jsx(fr,{handle:g,store:C}),A&&I.jsx(jr,{store:C,parentContext:E?.context,isDrawer:p}),typeof n=="function"?n({payload:D}):n]})}function _r(e){return Wr("dialog",e)}const Ur=c.forwardRef(function(t,n){const{render:o,className:r,style:s,id:a,...u}=t,l=ve(),i=Xt(a);return l.useSyncedValueWithCleanup("titleElementId",i),we("h2",t,{ref:n,props:[{id:i},u]})});function Es({...e}){return I.jsx(_r,{"data-slot":"dialog",...e})}function Yr({...e}){return I.jsx(Pr,{"data-slot":"dialog-portal",...e})}function Gr({className:e,...t}){return I.jsx(Ao,{"data-slot":"dialog-overlay",className:ke("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Ss({className:e,children:t,showCloseButton:n=!0,...o}){return I.jsxs(Yr,{children:[I.jsx(Gr,{}),I.jsxs(Or,{"data-slot":"dialog-content",className:ke("fixed top-1/2 left-1/2 z-50 grid grid-cols-[minmax(0,1fr)] max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o,children:[t,n&&I.jsxs(En,{"data-slot":"dialog-close",render:I.jsx(Kt,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[I.jsx(io,{}),I.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function xs({className:e,...t}){return I.jsx("div",{"data-slot":"dialog-header",className:ke("flex flex-col gap-2",e),...t})}function Rs({className:e,showCloseButton:t=!1,children:n,...o}){return I.jsxs("div",{"data-slot":"dialog-footer",className:ke("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...o,children:[n,t&&I.jsx(En,{render:I.jsx(Kt,{variant:"outline"}),children:"Close"})]})}function Ts({className:e,...t}){return I.jsx(Ur,{"data-slot":"dialog-title",className:ke("font-heading text-base leading-none font-medium",e),...t})}function Cs({className:e,...t}){return I.jsx(Mo,{"data-slot":"dialog-description",className:ke("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}export{In as $,Do as A,yn as B,Es as C,_r as D,Ss as E,cr as F,Ts as G,xs as H,Cs as I,Rs as J,mt as K,Et as L,Pn as M,as as N,jo as O,Fn as P,Ot as Q,wn as R,is as S,Ce as T,Uo as U,ds as V,Ir as W,io as X,Fe as Y,Xo as Z,yo as _,M as a,Pe as a0,fo as a1,$e as a2,Zr as a3,rn as a4,ts as a5,bt as a6,es as a7,Ve as a8,gs as a9,Yo as aa,ps as ab,gr as ac,kn as ad,ur as ae,us as af,hs as ag,Le as ah,os as ai,gn as aj,rs as ak,Xe as al,cs as am,Eo as an,vt as ao,nt as ap,mo as aq,qr as ar,zr as as,Jr as at,Qr as au,gt as av,ls as aw,Nr as ax,nn as ay,Or as b,En as c,Ur as d,Mo as e,Pr as f,Ao as g,bs as h,ns as i,Sr as j,xr as k,Zo as l,hr as m,mr as n,fr as o,Tr as p,zo as q,br as r,ms as s,ys as t,dr as u,Ye as v,Ke as w,ss as x,_o as y,fs as z};