opencami 1.8.8 → 1.8.9

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 (61) hide show
  1. package/dist/client/assets/{CSPContext-nHSyQniZ.js → CSPContext-DI-5GAnQ.js} +1 -1
  2. package/dist/client/assets/{DirectionContext-B1cuzwIr.js → DirectionContext-CrIsc5n9.js} +1 -1
  3. package/dist/client/assets/_sessionKey-B4NZmxf3.js +21 -0
  4. package/dist/client/assets/agents-bptidK8z.js +2 -0
  5. package/dist/client/assets/{agents-screen-DpNSh5Ok.js → agents-screen-6qdnPmx2.js} +1 -1
  6. package/dist/client/assets/bots-BWpbaQ-E.js +2 -0
  7. package/dist/client/assets/{bots-screen-Qh_IK9hC.js → bots-screen-BTKCOohV.js} +1 -1
  8. package/dist/client/assets/{button-DdG8c-XQ.js → button-8ab4wOwy.js} +1 -1
  9. package/dist/client/assets/{composite-Cx-QHT9o.js → composite-B2qsrzf3.js} +1 -1
  10. package/dist/client/assets/{connect-CSbeSBTn.js → connect-B3_p7C4I.js} +1 -1
  11. package/dist/client/assets/dashboard-BtClHYpn.js +1 -0
  12. package/dist/client/assets/{event-Dwf9IDxK.js → event-DG3RKJz8.js} +1 -1
  13. package/dist/client/assets/{file-explorer-screen-DzDX4HcB.js → file-explorer-screen-Djl8x-8P.js} +1 -1
  14. package/dist/client/assets/files-CjbCJDgC.js +2 -0
  15. package/dist/client/assets/{follow-up-suggestions-BYWq-d8P.js → follow-up-suggestions-BSCMXRXh.js} +1 -1
  16. package/dist/client/assets/{index-BxsgifDH.js → index-BXiha-Vz.js} +1 -1
  17. package/dist/client/assets/{index-B551ln24.js → index-CtlYu8Ug.js} +1 -1
  18. package/dist/client/assets/{keyboard-shortcuts-dialog-BX-hH4Wf.js → keyboard-shortcuts-dialog-HAufCn9C.js} +1 -1
  19. package/dist/client/assets/{main-DBmooBKx.js → main-CQKtcNr3.js} +2 -2
  20. package/dist/client/assets/{markdown-Bpat4kTr.js → markdown-DFJF-FsV.js} +1 -1
  21. package/dist/client/assets/memory-DnJOmcwU.js +2 -0
  22. package/dist/client/assets/{memory-screen-1DgDLyZf.js → memory-screen-Bm4NMAnU.js} +1 -1
  23. package/dist/client/assets/{menu-ByR1BVmq.js → menu-D26Vmgxl.js} +1 -1
  24. package/dist/client/assets/{opencami-logo-BV1uPYe6.js → opencami-logo-BSed2Wez.js} +1 -1
  25. package/dist/client/assets/{popupStateMapping-CGDLUl5Y.js → popupStateMapping-DkI2OCkW.js} +1 -1
  26. package/dist/client/assets/{proxy-DYrSkM35.js → proxy-CHQ-VCN1.js} +1 -1
  27. package/dist/client/assets/{react-dSDkXQu6.js → react-WkSlhZJd.js} +1 -1
  28. package/dist/client/assets/{search-dialog-B3XJLq-O.js → search-dialog-CCl4d0Pi.js} +1 -1
  29. package/dist/client/assets/{search-sources-badge-CTd0gLuz.js → search-sources-badge-Du8KpUEb.js} +1 -1
  30. package/dist/client/assets/{session-export-dialog-Cib97JLm.js → session-export-dialog-io9FvLKq.js} +1 -1
  31. package/dist/client/assets/{settings-dialog-B4NLq1ZS.js → settings-dialog-B93qswor.js} +1 -1
  32. package/dist/client/assets/skills-BNDGnHwM.js +2 -0
  33. package/dist/client/assets/{skills-panel-Cj7yHGbX.js → skills-panel-CVh1I-7D.js} +1 -1
  34. package/dist/client/assets/{switch-kXs1I0oW.js → switch-CSnzINDW.js} +1 -1
  35. package/dist/client/assets/{tabs-B6GW7TBf.js → tabs-CWfn44FL.js} +1 -1
  36. package/dist/client/assets/{thinking-DTP9JDQl.js → thinking-BmoLlbFC.js} +1 -1
  37. package/dist/client/assets/{tooltip-CtHpm-sQ.js → tooltip-CSGMH2t4.js} +1 -1
  38. package/dist/client/assets/{use-file-explorer-state-C-D2CShe.js → use-file-explorer-state-BYVzjwPA.js} +1 -1
  39. package/dist/client/assets/{useBaseUiId-Ckx_aJky.js → useBaseUiId-DiwX_3so.js} +1 -1
  40. package/dist/client/assets/{useCompositeItem-CkvfeGmG.js → useCompositeItem-UPIPwR9H.js} +1 -1
  41. package/dist/client/assets/{useControlled-8D4PSDAL.js → useControlled-CT2hRlcU.js} +1 -1
  42. package/dist/client/assets/{useMutation-DckvFKPC.js → useMutation-rx8UH99I.js} +1 -1
  43. package/dist/client/assets/{useQuery-CtUiG53w.js → useQuery-Boaa6oF3.js} +1 -1
  44. package/dist/server/assets/{_sessionKey-LV6xK9IM.js → _sessionKey-B6iYeyCS.js} +342 -257
  45. package/dist/server/assets/{_tanstack-start-manifest_v-qVhiIEVc.js → _tanstack-start-manifest_v-C9chPgNH.js} +1 -1
  46. package/dist/server/assets/{dashboard-GCKodTiJ.js → dashboard-UYRCu_mQ.js} +19 -3
  47. package/dist/server/assets/{follow-up-suggestions-CSSc4PDe.js → follow-up-suggestions-mzRQIB0k.js} +2 -2
  48. package/dist/server/assets/{index-DMKS4aeI.js → index-COElhwGA.js} +1 -1
  49. package/dist/server/assets/{router-Cr2xCvGA.js → router-BqLGFd4L.js} +3 -3
  50. package/dist/server/assets/{search-dialog-DR6zBnui.js → search-dialog-CmI7naPN.js} +2 -2
  51. package/dist/server/assets/{settings-dialog-DEMlCMCP.js → settings-dialog-BZ67gr9N.js} +2 -2
  52. package/dist/server/assets/{thinking-BpAc3itF.js → thinking-CA8PSwKJ.js} +2 -2
  53. package/dist/server/server.js +2 -2
  54. package/package.json +2 -2
  55. package/dist/client/assets/_sessionKey-CNw4O2rY.js +0 -19
  56. package/dist/client/assets/agents-C6Ev94B1.js +0 -2
  57. package/dist/client/assets/bots-B2_u-OmP.js +0 -2
  58. package/dist/client/assets/dashboard-DA1fTRcH.js +0 -1
  59. package/dist/client/assets/files-PsZnGOUx.js +0 -2
  60. package/dist/client/assets/memory-Bs8hOoEv.js +0 -2
  61. package/dist/client/assets/skills-pueagQNc.js +0 -2
@@ -1 +1 @@
1
- import{r as p,j as G,w as _e}from"./main-DBmooBKx.js";import{C as qt,ab as Vn,ac as Ue,ag as lt,c as Kt}from"./button-DdG8c-XQ.js";import{a as $e,E as Gt,c as Qt,W as $n,g as Jt,d as at,K as Zt,b as Re,N as Wn,X as jn,R as Nn,h as Yn,o as Xn,k as _n,i as me,m as Un,n as zn,q as qn,r as Kn,v as Gn,Y as Qn,Z as Jn,P as Zn,p as en,e as eo,t as to}from"./popupStateMapping-CGDLUl5Y.js";import{u as z,g as K,n as tn,a as Z,z as le,E as st,e as j,F as ge,G as kt,h as ue,i as fe,H as nn,I as ut,x as Pe,w as We,J as no,K as on,L as oo,B as ft,A as dt,M as ze,p as ro,q as Fe,t as rn,r as sn,m as ce,N as so,v as io,d as co}from"./useBaseUiId-Ckx_aJky.js";import{i as Oe,l as qe,e as ee,d as Ft,g as lo,r as ao,k as Ae,t as uo,v as fo,T as go,o as cn}from"./event-Dwf9IDxK.js";import{e as de,g as te,a as re,b as mo,c as po,d as ho,h as yo,i as be,m as Me,j as J,s as xo,k as ln,l as an,n as je,o as un,p as it,q as fn,t as ae,f as ke,r as Ne,u as vo}from"./DirectionContext-B1cuzwIr.js";const Ye={isSidebarCollapsed:!1},dn=["chat","ui"];function Kr(t){const e=t.getQueryData(dn);return e&&typeof e=="object"?{...Ye,...e}:Ye}function Gr(t,e){t.setQueryData(dn,function(o){const r=o&&typeof o=="object"?{...Ye,...o}:Ye;return e(r)})}function He(t,e,n){if(n&&!Oe(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const o=t();return typeof o=="number"?o:o?.[e]}return t?.[e]}const gn=p.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Gt,currentIdRef:{current:null},currentContextRef:{current:null}});function Ro(t){const{children:e,delay:n,timeoutMs:o=0}=t,r=p.useRef(n),s=p.useRef(n),i=p.useRef(null),c=p.useRef(null),a=$e();return G.jsx(gn.Provider,{value:p.useMemo(()=>({hasProvider:!0,delayRef:r,initialDelayRef:s,currentIdRef:i,timeoutMs:o,currentContextRef:c,timeout:a}),[o,a]),children:e})}function wo(t,e={open:!1}){const n="rootStore"in t?t.rootStore:t,o=n.useState("floatingId"),{enabled:r=!0,open:s}=e,i=p.useContext(gn),{currentIdRef:c,delayRef:a,timeoutMs:d,initialDelayRef:u,currentContextRef:f,hasProvider:m,timeout:l}=i,[g,h]=p.useState(!1);return z(()=>{function R(){h(!1),f.current?.setIsInstantPhase(!1),c.current=null,f.current=null,a.current=u.current}if(r&&c.current&&!s&&c.current===o){if(h(!1),d){const x=o;return l.start(d,()=>{n.select("open")||c.current&&c.current!==x||R()}),()=>{l.clear()}}R()}},[r,s,o,c,a,d,u,f,l,n]),z(()=>{if(!r||!s)return;const R=f.current,x=c.current;l.clear(),f.current={onOpenChange:n.setOpen,setIsInstantPhase:h},c.current=o,a.current={open:0,close:He(u.current,"close")},x!==null&&x!==o?(h(!0),R?.setIsInstantPhase(!0),R?.onOpenChange(!1,K(tn))):(h(!1),R?.setIsInstantPhase(!1))},[r,s,o,n,c,a,d,u,f,l]),z(()=>()=>{f.current=null},[f]),p.useMemo(()=>({hasProvider:m,delayRef:a,isInstantPhase:g}),[m,a,g])}function bo(t,e){let n=null,o=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const s=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=e.axis==="x"||e.axis==="both",c=e.axis==="y"||e.axis==="both",a=["mouseenter","mousemove"].includes(e.dataRef.current.openEvent?.type||"")&&e.pointerType!=="touch";let d=s.width,u=s.height,f=s.x,m=s.y;return n==null&&e.x&&i&&(n=s.x-e.x),o==null&&e.y&&c&&(o=s.y-e.y),f-=n||0,m-=o||0,d=0,u=0,!r||a?(d=e.axis==="y"?s.width:0,u=e.axis==="x"?s.height:0,f=i&&e.x!=null?e.x:f,m=c&&e.y!=null?e.y:m):r&&!a&&(u=e.axis==="x"?s.height:u,d=e.axis==="y"?s.width:d),r=!0,{width:d,height:u,x:f,y:m,top:m,right:f+d,bottom:m+u,left:f}}}}function Ht(t){return t!=null&&t.clientX!=null}function Eo(t,e={}){const n="rootStore"in t?t.rootStore:t,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{enabled:c=!0,axis:a="both",x:d=null,y:u=null}=e,f=p.useRef(!1),m=p.useRef(null),[l,g]=p.useState(),[h,R]=p.useState([]),x=Z((S,b,O)=>{f.current||i.current.openEvent&&!Ht(i.current.openEvent)||n.set("positionReference",bo(O??s,{x:S,y:b,axis:a,dataRef:i,pointerType:l}))}),v=Z(S=>{d!=null||u!=null||(o?m.current||R([]):x(S.clientX,S.clientY,S.currentTarget))}),E=Oe(l)?r:o,C=p.useCallback(()=>{if(!E||!c||d!=null||u!=null)return;const S=le(r);function b(O){const F=qe(O);ee(r,F)?(S.removeEventListener("mousemove",b),m.current=null):x(O.clientX,O.clientY)}if(!i.current.openEvent||Ht(i.current.openEvent)){S.addEventListener("mousemove",b);const O=()=>{S.removeEventListener("mousemove",b),m.current=null};return m.current=O,O}n.set("positionReference",s)},[E,c,d,u,r,i,s,n,x]);p.useEffect(()=>C(),[C,h]),p.useEffect(()=>{c&&!r&&(f.current=!1)},[c,r]),p.useEffect(()=>{!c&&o&&(f.current=!0)},[c,o]),z(()=>{c&&(d!=null||u!=null)&&(f.current=!1,x(d,u))},[c,d,u,x]);const P=p.useMemo(()=>{function S(b){g(b.pointerType)}return{onPointerDown:S,onPointerEnter:S,onMouseMove:v,onMouseEnter:v}},[v]);return p.useMemo(()=>c?{reference:P,trigger:P}:{},[c,P])}function Bt(t,e,n){let{reference:o,floating:r}=t;const s=re(e),i=ln(e),c=un(i),a=te(e),d=s==="y",u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,m=o[c]/2-r[c]/2;let l;switch(a){case"top":l={x:u,y:o.y-r.height};break;case"bottom":l={x:u,y:o.y+o.height};break;case"right":l={x:o.x+o.width,y:f};break;case"left":l={x:o.x-r.width,y:f};break;default:l={x:o.x,y:o.y}}switch(be(e)){case"start":l[i]-=m*(n&&d?-1:1);break;case"end":l[i]+=m*(n&&d?-1:1);break}return l}async function Co(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:s,rects:i,elements:c,strategy:a}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:l=0}=de(e,t),g=an(l),R=c[m?f==="floating"?"reference":"floating":f],x=je(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:d,rootBoundary:u,strategy:a})),v=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),C=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},P=je(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:E,strategy:a}):v);return{top:(x.top-P.top+g.top)/C.y,bottom:(P.bottom-x.bottom+g.bottom)/C.y,left:(x.left-P.left+g.left)/C.x,right:(P.right-x.right+g.right)/C.x}}const So=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(e));let d=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:f}=Bt(d,o,a),m=o,l={},g=0;for(let R=0;R<c.length;R++){var h;const{name:x,fn:v}=c[R],{x:E,y:C,data:P,reset:S}=await v({x:u,y:f,initialPlacement:o,placement:m,strategy:r,middlewareData:l,rects:d,platform:{...i,detectOverflow:(h=i.detectOverflow)!=null?h:Co},elements:{reference:t,floating:e}});u=E??u,f=C??f,l={...l,[x]:{...l[x],...P}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):S.rects),{x:u,y:f}=Bt(d,m,a)),R=-1)}return{x:u,y:f,placement:m,strategy:r,middlewareData:l}},To=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:l="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...R}=de(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=te(r),v=re(c),E=te(c)===c,C=await(a.isRTL==null?void 0:a.isRTL(d.floating)),P=m||(E||!h?[mo(c)]:po(c)),S=g!=="none";!m&&S&&P.push(...ho(c,h,g,C));const b=[c,...P],O=await a.detectOverflow(e,R),F=[];let M=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&F.push(O[x]),f){const D=yo(r,i,C);F.push(O[D[0]],O[D[1]])}if(M=[...M,{placement:r,overflows:F}],!F.every(D=>D<=0)){var k,T;const D=(((k=s.flip)==null?void 0:k.index)||0)+1,I=b[D];if(I&&(!(f==="alignment"?v!==re(I):!1)||M.every(w=>re(w.placement)===v?w.overflows[0]>0:!0)))return{data:{index:D,overflows:M},reset:{placement:I}};let H=(T=M.filter(A=>A.overflows[0]<=0).sort((A,w)=>A.overflows[1]-w.overflows[1])[0])==null?void 0:T.placement;if(!H)switch(l){case"bestFit":{var y;const A=(y=M.filter(w=>{if(S){const L=re(w.placement);return L===v||L==="y"}return!0}).map(w=>[w.placement,w.overflows.filter(L=>L>0).reduce((L,W)=>L+W,0)]).sort((w,L)=>w[1]-L[1])[0])==null?void 0:y[0];A&&(H=A);break}case"initialPlacement":H=c;break}if(r!==H)return{reset:{placement:H}}}return{}}}};function Vt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function $t(t){return xo.some(e=>t[e]>=0)}const Po=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:r="referenceHidden",...s}=de(t,e);switch(r){case"referenceHidden":{const i=await o.detectOverflow(e,{...s,elementContext:"reference"}),c=Vt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:$t(c)}}}case"escaped":{const i=await o.detectOverflow(e,{...s,altBoundary:!0}),c=Vt(i,n.floating);return{data:{escapedOffsets:c,escaped:$t(c)}}}default:return{}}}}},mn=new Set(["left","top"]);async function Oo(t,e){const{placement:n,platform:o,elements:r}=t,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=te(n),c=be(n),a=re(n)==="y",d=mn.has(i)?-1:1,u=s&&a?-1:1,f=de(e,t);let{mainAxis:m,crossAxis:l,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof g=="number"&&(l=c==="end"?g*-1:g),a?{x:l*u,y:m*d}:{x:m*d,y:l*u}}const Ao=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:s,placement:i,middlewareData:c}=e,a=await Oo(e,t);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:i}}}}},Mo=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r,platform:s}=e,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:x=>{let{x:v,y:E}=x;return{x:v,y:E}}},...d}=de(t,e),u={x:n,y:o},f=await s.detectOverflow(e,d),m=re(te(r)),l=fn(m);let g=u[l],h=u[m];if(i){const x=l==="y"?"top":"left",v=l==="y"?"bottom":"right",E=g+f[x],C=g-f[v];g=it(E,g,C)}if(c){const x=m==="y"?"top":"left",v=m==="y"?"bottom":"right",E=h+f[x],C=h-f[v];h=it(E,h,C)}const R=a.fn({...e,[l]:g,[m]:h});return{...R,data:{x:R.x-n,y:R.y-o,enabled:{[l]:i,[m]:c}}}}}},Lo=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=e,{offset:c=0,mainAxis:a=!0,crossAxis:d=!0}=de(t,e),u={x:n,y:o},f=re(r),m=fn(f);let l=u[m],g=u[f];const h=de(c,e),R=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(a){const E=m==="y"?"height":"width",C=s.reference[m]-s.floating[E]+R.mainAxis,P=s.reference[m]+s.reference[E]-R.mainAxis;l<C?l=C:l>P&&(l=P)}if(d){var x,v;const E=m==="y"?"width":"height",C=mn.has(te(r)),P=s.reference[f]-s.floating[E]+(C&&((x=i.offset)==null?void 0:x[f])||0)+(C?0:R.crossAxis),S=s.reference[f]+s.reference[E]+(C?0:((v=i.offset)==null?void 0:v[f])||0)-(C?R.crossAxis:0);g<P?g=P:g>S&&(g=S)}return{[m]:l,[f]:g}}}},Do=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:s,platform:i,elements:c}=e,{apply:a=()=>{},...d}=de(t,e),u=await i.detectOverflow(e,d),f=te(r),m=be(r),l=re(r)==="y",{width:g,height:h}=s.floating;let R,x;f==="top"||f==="bottom"?(R=f,x=m===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(x=f,R=m==="end"?"top":"bottom");const v=h-u.top-u.bottom,E=g-u.left-u.right,C=Me(h-u[R],v),P=Me(g-u[x],E),S=!e.middlewareData.shift;let b=C,O=P;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(b=v),S&&!m){const M=J(u.left,0),k=J(u.right,0),T=J(u.top,0),y=J(u.bottom,0);l?O=g-2*(M!==0||k!==0?M+k:J(u.left,u.right)):b=h-2*(T!==0||y!==0?T+y:J(u.top,u.bottom))}await a({...e,availableWidth:O,availableHeight:b});const F=await i.getDimensions(c.floating);return g!==F.width||h!==F.height?{reset:{rects:!0}}:{}}}};function pn(t){const e=ue(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=fe(t),s=r?t.offsetWidth:n,i=r?t.offsetHeight:o,c=Ne(n)!==s||Ne(o)!==i;return c&&(n=s,o=i),{width:n,height:o,$:c}}function gt(t){return j(t)?t:t.contextElement}function we(t){const e=gt(t);if(!fe(e))return ae(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:s}=pn(e);let i=(s?Ne(n.width):n.width)/o,c=(s?Ne(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Io=ae(0);function hn(t){const e=le(t);return!nn()||!e.visualViewport?Io:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ko(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==le(t)?!1:e}function pe(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=gt(t);let i=ae(1);e&&(o?j(o)&&(i=we(o)):i=we(t));const c=ko(s,n,o)?hn(s):ae(0);let a=(r.left+c.x)/i.x,d=(r.top+c.y)/i.y,u=r.width/i.x,f=r.height/i.y;if(s){const m=le(s),l=o&&j(o)?le(o):o;let g=m,h=kt(g);for(;h&&o&&l!==g;){const R=we(h),x=h.getBoundingClientRect(),v=ue(h),E=x.left+(h.clientLeft+parseFloat(v.paddingLeft))*R.x,C=x.top+(h.clientTop+parseFloat(v.paddingTop))*R.y;a*=R.x,d*=R.y,u*=R.x,f*=R.y,a+=E,d+=C,g=le(h),h=kt(g)}}return je({width:u,height:f,x:a,y:d})}function Ke(t,e){const n=ze(t).scrollLeft;return e?e.left+n:pe(ge(t)).left+n}function yn(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-Ke(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function Fo(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const s=r==="fixed",i=ge(o),c=e?ut(e.floating):!1;if(o===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},d=ae(1);const u=ae(0),f=fe(o);if((f||!f&&!s)&&((ft(o)!=="body"||dt(i))&&(a=ze(o)),fe(o))){const l=pe(o);d=we(o),u.x=l.x+o.clientLeft,u.y=l.y+o.clientTop}const m=i&&!f&&!s?yn(i,a):ae(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-a.scrollTop*d.y+u.y+m.y}}function Ho(t){return Array.from(t.getClientRects())}function Bo(t){const e=ge(t),n=ze(t),o=t.ownerDocument.body,r=J(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),s=J(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ke(t);const c=-n.scrollTop;return ue(o).direction==="rtl"&&(i+=J(e.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:c}}const Wt=25;function Vo(t,e){const n=le(t),o=ge(t),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,c=0,a=0;if(r){s=r.width,i=r.height;const u=nn();(!u||u&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}const d=Ke(o);if(d<=0){const u=o.ownerDocument,f=u.body,m=getComputedStyle(f),l=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(o.clientWidth-f.clientWidth-l);g<=Wt&&(s-=g)}else d<=Wt&&(s+=d);return{width:s,height:i,x:c,y:a}}const $o=new Set(["absolute","fixed"]);function Wo(t,e){const n=pe(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,s=fe(t)?we(t):ae(1),i=t.clientWidth*s.x,c=t.clientHeight*s.y,a=r*s.x,d=o*s.y;return{width:i,height:c,x:a,y:d}}function jt(t,e,n){let o;if(e==="viewport")o=Vo(t,n);else if(e==="document")o=Bo(ge(t));else if(j(e))o=Wo(e,n);else{const r=hn(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return je(o)}function xn(t,e){const n=Pe(t);return n===e||!j(n)||We(n)?!1:ue(n).position==="fixed"||xn(n,e)}function jo(t,e){const n=e.get(t);if(n)return n;let o=st(t,[],!1).filter(c=>j(c)&&ft(c)!=="body"),r=null;const s=ue(t).position==="fixed";let i=s?Pe(t):t;for(;j(i)&&!We(i);){const c=ue(i),a=on(i);!a&&c.position==="fixed"&&(r=null),(s?!a&&!r:!a&&c.position==="static"&&!!r&&$o.has(r.position)||dt(i)&&!a&&xn(t,i))?o=o.filter(u=>u!==i):r=c,i=Pe(i)}return e.set(t,o),o}function No(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[...n==="clippingAncestors"?ut(e)?[]:jo(e,this._c):[].concat(n),o],c=i[0],a=i.reduce((d,u)=>{const f=jt(e,u,r);return d.top=J(f.top,d.top),d.right=Me(f.right,d.right),d.bottom=Me(f.bottom,d.bottom),d.left=J(f.left,d.left),d},jt(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Yo(t){const{width:e,height:n}=pn(t);return{width:e,height:n}}function Xo(t,e,n){const o=fe(e),r=ge(e),s=n==="fixed",i=pe(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const a=ae(0);function d(){a.x=Ke(r)}if(o||!o&&!s)if((ft(e)!=="body"||dt(r))&&(c=ze(e)),o){const l=pe(e,!0,s,e);a.x=l.x+e.clientLeft,a.y=l.y+e.clientTop}else r&&d();s&&!o&&r&&d();const u=r&&!o&&!s?yn(r,c):ae(0),f=i.left+c.scrollLeft-a.x-u.x,m=i.top+c.scrollTop-a.y-u.y;return{x:f,y:m,width:i.width,height:i.height}}function tt(t){return ue(t).position==="static"}function Nt(t,e){if(!fe(t)||ue(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ge(t)===n&&(n=n.ownerDocument.body),n}function vn(t,e){const n=le(t);if(ut(t))return n;if(!fe(t)){let r=Pe(t);for(;r&&!We(r);){if(j(r)&&!tt(r))return r;r=Pe(r)}return n}let o=Nt(t,e);for(;o&&no(o)&&tt(o);)o=Nt(o,e);return o&&We(o)&&tt(o)&&!on(o)?n:o||oo(t)||n}const _o=async function(t){const e=this.getOffsetParent||vn,n=this.getDimensions,o=await n(t.floating);return{reference:Xo(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Uo(t){return ue(t).direction==="rtl"}const zo={convertOffsetParentRelativeRectToViewportRelativeRect:Fo,getDocumentElement:ge,getClippingRect:No,getOffsetParent:vn,getElementRects:_o,getClientRects:Ho,getDimensions:Yo,getScale:we,isElement:j,isRTL:Uo};function Rn(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function qo(t,e){let n=null,o;const r=ge(t);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const d=t.getBoundingClientRect(),{left:u,top:f,width:m,height:l}=d;if(c||e(),!m||!l)return;const g=ke(f),h=ke(r.clientWidth-(u+m)),R=ke(r.clientHeight-(f+l)),x=ke(u),E={rootMargin:-g+"px "+-h+"px "+-R+"px "+-x+"px",threshold:J(0,Me(1,a))||1};let C=!0;function P(S){const b=S[0].intersectionRatio;if(b!==a){if(!C)return i();b?i(!1,b):o=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!Rn(d,t.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(P,{...E,root:r.ownerDocument})}catch{n=new IntersectionObserver(P,E)}n.observe(t)}return i(!0),s}function Yt(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,d=gt(t),u=r||s?[...d?st(d):[],...st(e)]:[];u.forEach(x=>{r&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const f=d&&c?qo(d,n):null;let m=-1,l=null;i&&(l=new ResizeObserver(x=>{let[v]=x;v&&v.target===d&&l&&(l.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var E;(E=l)==null||E.observe(e)})),n()}),d&&!a&&l.observe(d),l.observe(e));let g,h=a?pe(t):null;a&&R();function R(){const x=pe(t);h&&!Rn(h,x)&&n(),h=x,g=requestAnimationFrame(R)}return n(),()=>{var x;u.forEach(v=>{r&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f?.(),(x=l)==null||x.disconnect(),l=null,a&&cancelAnimationFrame(g)}}const Ko=Ao,Go=Mo,Qo=To,Jo=Do,Zo=Po,er=Lo,tr=(t,e,n)=>{const o=new Map,r={platform:zo,...n},s={...r.platform,_c:o};return So(t,e,{...r,platform:s})};var nr=typeof document<"u",or=function(){},Be=nr?p.useLayoutEffect:or;function Xe(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!Xe(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&t.$$typeof)&&!Xe(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function wn(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Xt(t,e){const n=wn(t);return Math.round(e*n)/n}function nt(t){const e=p.useRef(t);return Be(()=>{e.current=t}),e}function rr(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:d}=t,[u,f]=p.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,l]=p.useState(o);Xe(m,o)||l(o);const[g,h]=p.useState(null),[R,x]=p.useState(null),v=p.useCallback(w=>{w!==S.current&&(S.current=w,h(w))},[]),E=p.useCallback(w=>{w!==b.current&&(b.current=w,x(w))},[]),C=s||g,P=i||R,S=p.useRef(null),b=p.useRef(null),O=p.useRef(u),F=a!=null,M=nt(a),k=nt(r),T=nt(d),y=p.useCallback(()=>{if(!S.current||!b.current)return;const w={placement:e,strategy:n,middleware:m};k.current&&(w.platform=k.current),tr(S.current,b.current,w).then(L=>{const W={...L,isPositioned:T.current!==!1};D.current&&!Xe(O.current,W)&&(O.current=W,_e.flushSync(()=>{f(W)}))})},[m,e,n,k,T]);Be(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(w=>({...w,isPositioned:!1})))},[d]);const D=p.useRef(!1);Be(()=>(D.current=!0,()=>{D.current=!1}),[]),Be(()=>{if(C&&(S.current=C),P&&(b.current=P),C&&P){if(M.current)return M.current(C,P,y);y()}},[C,P,y,M,F]);const I=p.useMemo(()=>({reference:S,floating:b,setReference:v,setFloating:E}),[v,E]),H=p.useMemo(()=>({reference:C,floating:P}),[C,P]),A=p.useMemo(()=>{const w={position:n,left:0,top:0};if(!H.floating)return w;const L=Xt(H.floating,u.x),W=Xt(H.floating,u.y);return c?{...w,transform:"translate("+L+"px, "+W+"px)",...wn(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:W}},[n,c,H.floating,u.x,u.y]);return p.useMemo(()=>({...u,update:y,refs:I,elements:H,floatingStyles:A}),[u,y,I,H,A])}const sr=(t,e)=>({...Ko(t),options:[t,e]}),ir=(t,e)=>({...Go(t),options:[t,e]}),cr=(t,e)=>({...er(t),options:[t,e]}),lr=(t,e)=>({...Qo(t),options:[t,e]}),ar=(t,e)=>({...Jo(t),options:[t,e]}),ur=(t,e)=>({...Zo(t),options:[t,e]});function fr(t){const{open:e=!1,onOpenChange:n,elements:o={}}=t,r=ro(),s=Qt()!=null,i=qt(()=>new $n({open:e,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new Jt,floatingId:r,nested:s,noEmit:t.noEmit||!1})).current;return z(()=>{const c={open:e,floatingId:r};o.reference!==void 0&&(c.referenceElement=o.reference,c.domReferenceElement=j(o.reference)?o.reference:null),o.floating!==void 0&&(c.floatingElement=o.floating),i.update(c)},[e,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=t.noEmit||!1,i}function dr(t={}){const{nodeId:e,externalTree:n}=t,o=fr(t),r=t.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,c]=p.useState(null),a=p.useRef(null),d=at(n);z(()=>{s.domReference&&(a.current=s.domReference)},[s.domReference]);const u=rr({...t,elements:{...s,...i&&{reference:i}}}),f=p.useCallback(b=>{const O=j(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;c(O),u.refs.setReference(O)},[u.refs]),[m,l]=p.useState(null),[g,h]=p.useState(null);r.useSyncedValue("referenceElement",m),r.useSyncedValue("domReferenceElement",j(m)?m:null),r.useSyncedValue("floatingElement",g);const R=p.useCallback(b=>{(j(b)||b===null)&&(a.current=b,l(b)),(j(u.refs.reference.current)||u.refs.reference.current===null||b!==null&&!j(b))&&u.refs.setReference(b)},[u.refs,l]),x=p.useCallback(b=>{h(b),u.refs.setFloating(b)},[u.refs]),v=p.useMemo(()=>({...u.refs,setReference:R,setFloating:x,setPositionReference:f,domReference:a}),[u.refs,R,x,f]),E=p.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),C=r.useState("open"),P=r.useState("floatingId"),S=p.useMemo(()=>({...u,dataRef:r.context.dataRef,open:C,onOpenChange:r.setOpen,events:r.context.events,floatingId:P,refs:v,elements:E,nodeId:e,rootStore:r}),[u,v,E,e,r,C,P]);return z(()=>{r.context.dataRef.current.floatingContext=S;const b=d?.nodesRef.current.find(O=>O.id===e);b&&(b.context=S)}),p.useMemo(()=>({...u,context:S,refs:v,elements:E,rootStore:r}),[u,v,E,S,r])}const ot=uo&&fo;function gr(t,e={}){const n="rootStore"in t?t.rootStore:t,{events:o,dataRef:r}=n.context,{enabled:s=!0,visibleOnly:i=!0,delay:c}=e,a=p.useRef(!1),d=p.useRef(null),u=$e(),f=p.useRef(!0);p.useEffect(()=>{const l=n.select("domReferenceElement");if(!s)return;const g=le(l);function h(){const v=n.select("domReferenceElement");!n.select("open")&&fe(v)&&v===Ft(Ae(v))&&(a.current=!0)}function R(){f.current=!0}function x(){f.current=!1}return g.addEventListener("blur",h),ot&&(g.addEventListener("keydown",R,!0),g.addEventListener("pointerdown",x,!0)),()=>{g.removeEventListener("blur",h),ot&&(g.removeEventListener("keydown",R,!0),g.removeEventListener("pointerdown",x,!0))}},[n,s]),p.useEffect(()=>{if(!s)return;function l(g){if(g.reason===rn||g.reason===sn){const h=n.select("domReferenceElement");j(h)&&(d.current=h,a.current=!0)}}return o.on("openchange",l),()=>{o.off("openchange",l)}},[o,s,n]);const m=p.useMemo(()=>({onMouseLeave(){a.current=!1,d.current=null},onFocus(l){const g=l.currentTarget;if(a.current){if(d.current===g)return;a.current=!1,d.current=null}const h=qe(l.nativeEvent);if(i&&j(h)){if(ot&&!l.relatedTarget){if(!f.current&&!lo(h))return}else if(!ao(h))return}const R=l.relatedTarget&&n.context.triggerElements.hasElement(l.relatedTarget),{nativeEvent:x,currentTarget:v}=l,E=typeof c=="function"?c():c;if(n.select("open")&&R||E===0||E===void 0){n.setOpen(!0,K(Fe,x,v));return}u.start(E,()=>{a.current||n.setOpen(!0,K(Fe,x,v))})},onBlur(l){a.current=!1,d.current=null;const g=l.relatedTarget,h=l.nativeEvent,R=j(g)&&g.hasAttribute(Zt("focus-guard"))&&g.getAttribute("data-type")==="outside";u.start(0,()=>{const x=n.select("domReferenceElement"),v=Ft(x?x.ownerDocument:document);if(!g&&v===x||ee(r.current.floatingContext?.refs.floating.current,v)||ee(x,v)||R)return;const E=g??v;if(j(E)){const C=n.context.triggerElements;if(C.hasElement(E)||C.hasMatchingElement(P=>ee(P,E)))return}n.setOpen(!1,K(Fe,h))})}}),[r,n,i,u,c]);return p.useMemo(()=>s?{reference:m,trigger:m}:{},[s,m])}const ct=Zt("safe-polygon"),mr=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${go}`;function pr(t){return t?!!t.closest(mr):!1}function bn(t){const e=p.useRef(void 0),n=p.useRef(!1),o=p.useRef(void 0),r=p.useRef(!0),s=p.useRef(!1),i=p.useRef(()=>{}),c=p.useRef(!1),a=$e(),d=$e(),u=p.useRef(void 0);return p.useMemo(()=>{const f=t.context.dataRef.current;return f.hoverInteractionState||(f.hoverInteractionState={pointerTypeRef:e,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:r,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:c,openChangeTimeout:a,restTimeout:d,handleCloseOptionsRef:u}),f.hoverInteractionState},[t,e,n,o,r,s,i,c,a,d,u])}const hr=new Set(["click","mousedown"]);function yr(t,e={}){const n="rootStore"in t?t.rootStore:t,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:c=!0,closeDelay:a=0,externalTree:d}=e,{pointerTypeRef:u,interactedInsideRef:f,handlerRef:m,performedPointerEventsMutationRef:l,unbindMouseMoveRef:g,restTimeoutPendingRef:h,openChangeTimeout:R,handleCloseOptionsRef:x}=bn(n),v=at(d),E=Qt(),C=Z(()=>f.current?!0:i.current.openEvent?hr.has(i.current.openEvent.type):!1),P=Z(()=>{const M=i.current.openEvent?.type;return M?.includes("mouse")&&M!=="mousedown"}),S=p.useCallback((M,k=!0)=>{const T=xr(a,u.current);T&&!m.current?R.start(T,()=>n.setOpen(!1,K(ce,M))):k&&(R.clear(),n.setOpen(!1,K(ce,M)))},[a,m,n,u,R]),b=Z(()=>{g.current(),m.current=void 0}),O=Z(()=>{if(l.current){const M=Ae(r).body;M.style.pointerEvents="",M.removeAttribute(ct),l.current=!1}}),F=Z(M=>{const k=qe(M);if(!pr(k)){f.current=!1;return}f.current=!0});z(()=>{o||(u.current=void 0,h.current=!1,f.current=!1,b(),O())},[o,u,h,f,b,O]),p.useEffect(()=>()=>{b()},[b]),p.useEffect(()=>O,[O]),z(()=>{if(c&&o&&x.current?.blockPointerEvents&&P()&&j(s)&&r){l.current=!0;const M=Ae(r).body;M.setAttribute(ct,"");const k=s,T=r,y=v?.nodesRef.current.find(D=>D.id===E)?.context?.elements.floating;return y&&(y.style.pointerEvents=""),M.style.pointerEvents="none",k.style.pointerEvents="auto",T.style.pointerEvents="auto",()=>{M.style.pointerEvents="",k.style.pointerEvents="",T.style.pointerEvents=""}}},[c,o,s,r,x,P,v,E,l]),p.useEffect(()=>{if(!c)return;function M(D){if(C()||!i.current.floatingContext||!n.select("open"))return;const I=n.context.triggerElements;D.relatedTarget&&I.hasElement(D.relatedTarget)||(O(),b(),C()||S(D))}function k(D){R.clear(),O(),m.current?.(D),b()}function T(D){C()||S(D,!1)}const y=r;return y&&(y.addEventListener("mouseleave",M),y.addEventListener("mouseenter",k),y.addEventListener("mouseleave",T),y.addEventListener("pointerdown",F,!0)),()=>{y&&(y.removeEventListener("mouseleave",M),y.removeEventListener("mouseenter",k),y.removeEventListener("mouseleave",T),y.removeEventListener("pointerdown",F,!0))}})}function xr(t,e){return e&&!Oe(e)?0:typeof t=="function"?t():t}function rt(t){return typeof t=="function"?t():t}const vr={current:null};function Rr(t,e={}){const n="rootStore"in t?t.rootStore:t,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:c=null,mouseOnly:a=!1,restMs:d=0,move:u=!0,triggerElementRef:f=vr,externalTree:m,isActiveTrigger:l=!0}=e,g=at(m),{pointerTypeRef:h,interactedInsideRef:R,handlerRef:x,blockMouseMoveRef:v,performedPointerEventsMutationRef:E,unbindMouseMoveRef:C,restTimeoutPendingRef:P,openChangeTimeout:S,restTimeout:b,handleCloseOptionsRef:O}=bn(n),F=Re(c),M=Re(i),k=Re(d);l&&(O.current=F.current?.__options);const T=Z(()=>R.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),y=p.useCallback((A,w=!0)=>{const L=He(M.current,"close",h.current);L&&!x.current?S.start(L,()=>n.setOpen(!1,K(ce,A))):w&&(S.clear(),n.setOpen(!1,K(ce,A)))},[M,x,n,h,S]),D=Z(()=>{C.current(),x.current=void 0}),I=Z(()=>{if(E.current){const A=Ae(n.select("domReferenceElement")).body;A.style.pointerEvents="",A.removeAttribute(ct),E.current=!1}});p.useEffect(()=>{if(!s)return;function A(w){w.open||(S.clear(),b.clear(),v.current=!0,P.current=!1)}return r.on("openchange",A),()=>{r.off("openchange",A)}},[s,r,S,b,v,P]);const H=Z(A=>{if(T()||!o.current.floatingContext)return;const w=n.context.triggerElements;if(A.relatedTarget&&w.hasElement(A.relatedTarget))return;const L=f.current;F.current?.({...o.current.floatingContext,tree:g,x:A.clientX,y:A.clientY,onClose(){I(),D(),!T()&&L===n.select("domReferenceElement")&&y(A)}})(A)});return p.useEffect(()=>{if(!s)return;const A=f.current??(l?n.select("domReferenceElement"):null);if(!j(A))return;function w(V){if(S.clear(),v.current=!1,a&&!Oe(h.current)||rt(k.current)>0&&!He(M.current,"open"))return;const U=He(M.current,"open",h.current),X=n.select("domReferenceElement"),N=n.context.triggerElements,_=(N.hasElement(V.target)||N.hasMatchingElement(se=>ee(se,V.target)))&&(!X||!ee(X,V.target)),B=V.currentTarget??null,$=n.select("open"),ne=!$||_;_&&$?n.setOpen(!0,K(ce,V,B)):U?S.start(U,()=>{ne&&n.setOpen(!0,K(ce,V,B))}):ne&&n.setOpen(!0,K(ce,V,B))}function L(V){if(T()){I();return}C.current();const U=n.select("domReferenceElement"),X=Ae(U);b.clear(),P.current=!1;const N=n.context.triggerElements;if(V.relatedTarget&&N.hasElement(V.relatedTarget))return;if(F.current&&o.current.floatingContext){n.select("open")||S.clear();const B=f.current;x.current=F.current({...o.current.floatingContext,tree:g,x:V.clientX,y:V.clientY,onClose(){I(),D(),!T()&&B===n.select("domReferenceElement")&&y(V,!0)}});const $=x.current;$(V),X.addEventListener("mousemove",$),C.current=()=>{X.removeEventListener("mousemove",$)};return}(h.current!=="touch"||!ee(n.select("floatingElement"),V.relatedTarget))&&y(V)}function W(V){H(V)}return n.select("open")&&A.addEventListener("mouseleave",W),u&&A.addEventListener("mousemove",w,{once:!0}),A.addEventListener("mouseenter",w),A.addEventListener("mouseleave",L),()=>{A.removeEventListener("mouseleave",W),u&&A.removeEventListener("mousemove",w),A.removeEventListener("mouseenter",w),A.removeEventListener("mouseleave",L)}},[D,I,v,o,M,y,n,s,F,H,l,T,a,u,h,k,b,P,S,f,g,C,x]),p.useMemo(()=>{function A(w){h.current=w.pointerType}return{onPointerDown:A,onPointerEnter:A,onMouseMove(w){const{nativeEvent:L}=w,W=w.currentTarget,V=n.select("domReferenceElement"),U=n.context.triggerElements,X=n.select("open"),N=(U.hasElement(w.target)||U.hasMatchingElement(B=>ee(B,w.target)))&&(!V||!ee(V,w.target));if(a&&!Oe(h.current)||X&&!N||rt(k.current)===0||!N&&P.current&&w.movementX**2+w.movementY**2<2)return;b.clear();function _(){if(P.current=!1,T())return;const B=n.select("open");!v.current&&(!B||N)&&n.setOpen(!0,K(ce,L,W))}h.current==="touch"?_e.flushSync(()=>{_()}):N&&X?_():(P.current=!0,b.start(rt(k.current),_))}}},[v,T,a,n,h,k,b,P])}function _t(t,e){const[n,o]=t;let r=!1;const s=e.length;for(let i=0,c=s-1;i<s;c=i++){const[a,d]=e[i]||[0,0],[u,f]=e[c]||[0,0];d>=o!=f>=o&&n<=(u-a)*(o-d)/(f-d)+a&&(r=!r)}return r}function wr(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function br(t={}){const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=t,r=new Gt;let s=!1,i=null,c=null,a=typeof performance<"u"?performance.now():0;function d(f,m){const l=performance.now(),g=l-a;if(i===null||c===null||g===0)return i=f,c=m,a=l,null;const h=f-i,R=m-c,v=Math.sqrt(h*h+R*R)/g;return i=f,c=m,a=l,v}const u=({x:f,y:m,placement:l,elements:g,onClose:h,nodeId:R,tree:x})=>function(E){function C(){r.clear(),h()}if(r.clear(),!g.domReference||!g.floating||l==null||f==null||m==null)return;const{clientX:P,clientY:S}=E,b=[P,S],O=qe(E),F=E.type==="mouseleave",M=ee(g.floating,O),k=ee(g.domReference,O),T=g.domReference.getBoundingClientRect(),y=g.floating.getBoundingClientRect(),D=l.split("-")[0],I=f>y.right-y.width/2,H=m>y.bottom-y.height/2,A=wr(b,T),w=y.width>T.width,L=y.height>T.height,W=(w?T:y).left,V=(w?T:y).right,U=(L?T:y).top,X=(L?T:y).bottom;if(M&&(s=!0,!F))return;if(k&&(s=!1),k&&!F){s=!0;return}if(F&&j(E.relatedTarget)&&ee(g.floating,E.relatedTarget)||x&&Wn(x.nodesRef.current,R).some(({context:B})=>B?.open))return;if(D==="top"&&m>=T.bottom-1||D==="bottom"&&m<=T.top+1||D==="left"&&f>=T.right-1||D==="right"&&f<=T.left+1)return C();let N=[];switch(D){case"top":N=[[W,T.top+1],[W,y.bottom-1],[V,y.bottom-1],[V,T.top+1]];break;case"bottom":N=[[W,y.top+1],[W,T.bottom-1],[V,T.bottom-1],[V,y.top+1]];break;case"left":N=[[y.right-1,X],[y.right-1,U],[T.left+1,U],[T.left+1,X]];break;case"right":N=[[T.right-1,X],[T.right-1,U],[y.left+1,U],[y.left+1,X]];break}function _([B,$]){switch(D){case"top":{const ne=[w?B+e/2:I?B+e*4:B-e*4,$+e+1],se=[w?B-e/2:I?B+e*4:B-e*4,$+e+1],oe=[[y.left,I||w?y.bottom-e:y.top],[y.right,I?w?y.bottom-e:y.top:y.bottom-e]];return[ne,se,...oe]}case"bottom":{const ne=[w?B+e/2:I?B+e*4:B-e*4,$-e],se=[w?B-e/2:I?B+e*4:B-e*4,$-e],oe=[[y.left,I||w?y.top+e:y.bottom],[y.right,I?w?y.top+e:y.bottom:y.top+e]];return[ne,se,...oe]}case"left":{const ne=[B+e+1,L?$+e/2:H?$+e*4:$-e*4],se=[B+e+1,L?$-e/2:H?$+e*4:$-e*4];return[...[[H||L?y.right-e:y.left,y.top],[H?L?y.right-e:y.left:y.right-e,y.bottom]],ne,se]}case"right":{const ne=[B-e,L?$+e/2:H?$+e*4:$-e*4],se=[B-e,L?$-e/2:H?$+e*4:$-e*4],oe=[[H||L?y.left+e:y.right,y.top],[H?L?y.left+e:y.right:y.left+e,y.bottom]];return[ne,se,...oe]}default:return[]}}if(!_t([P,S],N)){if(s&&!A)return C();if(!F&&o){const B=d(E.clientX,E.clientY);if(B!==null&&B<.1)return C()}_t([P,S],_([f,m]))?!s&&o&&r.start(40,C):C()}};return u.__options={blockPointerEvents:n},u}function En(t){return t==="starting"?jn:Vn}const Er=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:a}=e,{element:d,padding:u=0,offsetParent:f="real"}=de(t,e)||{};if(d==null)return{};const m=an(u),l={x:n,y:o},g=ln(r),h=un(g),R=await i.getDimensions(d),x=g==="y",v=x?"top":"left",E=x?"bottom":"right",C=x?"clientHeight":"clientWidth",P=s.reference[h]+s.reference[g]-l[g]-s.floating[h],S=l[g]-s.reference[g],b=f==="real"?await i.getOffsetParent?.(d):c.floating;let O=c.floating[C]||s.floating[h];(!O||!await i.isElement?.(b))&&(O=c.floating[C]||s.floating[h]);const F=P/2-S/2,M=O/2-R[h]/2-1,k=Math.min(m[v],M),T=Math.min(m[E],M),y=k,D=O-R[h]-T,I=O/2-R[h]/2+F,H=it(y,I,D),A=!a.arrow&&be(r)!=null&&I!==H&&s.reference[h]/2-(I<y?k:T)-R[h]/2<0,w=A?I<y?I-y:I-D:0;return{[g]:l[g]+w,data:{[g]:H,centerOffset:I-H-w,...A&&{alignmentOffset:w}},reset:A}}}),Cr=(t,e)=>({...Er(t),options:[t,e]}),Sr={name:"hide",async fn(t){const{width:e,height:n,x:o,y:r}=t.rects.reference,s=e===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await ur().fn(t)).data?.referenceHidden||s}}}},Ve={sideX:"left",sideY:"top"},Tr={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:c}=t,a=le(r),d=a.getComputedStyle(r);if(!(d.transitionDuration!=="0s"&&d.transitionDuration!==""))return{x:e,y:n,data:Ve};const f=await s.getOffsetParent?.(r);let m={width:0,height:0};if(i==="fixed"&&a?.visualViewport)m={width:a.visualViewport.width,height:a.visualViewport.height};else if(f===a){const v=cn(r);m={width:v.documentElement.clientWidth,height:v.documentElement.clientHeight}}else await s.isElement?.(f)&&(m=await s.getDimensions(f));const l=te(c);let g=e,h=n;l==="left"&&(g=m.width-(e+o.width)),l==="top"&&(h=m.height-(n+o.height));const R=l==="left"?"right":Ve.sideX,x=l==="top"?"bottom":Ve.sideY;return{x:g,y:h,data:{sideX:R,sideY:x}}}};function Cn(t,e,n){const o=t==="inline-start"||t==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[e]}function Ut(t,e,n){const{rects:o,placement:r}=t;return{side:Cn(e,te(r),n),align:be(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Pr(t){const{anchor:e,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:d=!1,arrowPadding:u=5,disableAnchorTracking:f=!1,keepMounted:m=!1,floatingRootContext:l,mounted:g,collisionAvoidance:h,shiftCrossAxis:R=!1,nodeId:x,adaptiveOrigin:v,lazyFlip:E=!1,externalTree:C}=t,[P,S]=p.useState(null);!g&&P!==null&&S(null);const b=h.side||"flip",O=h.align||"flip",F=h.fallbackAxisSide||"end",M=typeof e=="function"?e:void 0,k=Z(M),T=M?k:e,y=Re(e),I=vo()==="rtl",H=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[o],A=s==="center"?H:`${H}-${s}`;let w=a;const L=1,W=o==="bottom"?L:0,V=o==="top"?L:0,U=o==="right"?L:0,X=o==="left"?L:0;typeof w=="number"?w={top:w+W,right:w+X,bottom:w+V,left:w+U}:w&&(w={top:(w.top||0)+W,right:(w.right||0)+X,bottom:(w.bottom||0)+V,left:(w.left||0)+U});const N={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:w},_=p.useRef(null),B=Re(r),$=Re(i),oe=[sr(Y=>{const q=Ut(Y,o,I),ie=typeof B.current=="function"?B.current(q):B.current,Q=typeof $.current=="function"?$.current(q):$.current;return{mainAxis:ie,crossAxis:Q,alignmentAxis:Q}},[typeof r!="function"?r:0,typeof i!="function"?i:0,I,o])],pt=O==="none"&&b!=="shift",ht=!pt&&(d||R||b==="shift"),yt=b==="none"?null:lr({...N,padding:{top:w.top+L,right:w.right+L,bottom:w.bottom+L,left:w.left+L},mainAxis:!R&&b==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),xt=pt?null:ir(Y=>{const q=cn(Y.elements.floating).documentElement;return{...N,rootBoundary:R?{x:0,y:0,width:q.clientWidth,height:q.clientHeight}:void 0,mainAxis:O!=="none",crossAxis:ht,limiter:d||R?void 0:cr(ie=>{if(!_.current)return{};const{width:Q,height:xe}=_.current.getBoundingClientRect(),ve=re(te(ie.placement)),Ie=ve==="y"?Q:xe,Ze=ve==="y"?w.left+w.right:w.top+w.bottom;return{offset:Ie/2+Ze/2}})}},[N,d,R,w,O]);b==="shift"||O==="shift"||s==="center"?oe.push(xt,yt):oe.push(yt,xt),oe.push(ar({...N,apply({elements:{floating:Y},rects:{reference:q},availableWidth:ie,availableHeight:Q}){Object.entries({"--available-width":`${ie}px`,"--available-height":`${Q}px`,"--anchor-width":`${q.width}px`,"--anchor-height":`${q.height}px`}).forEach(([xe,ve])=>{Y.style.setProperty(xe,ve)})}}),Cr(()=>({element:_.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(Y){const{elements:q,middlewareData:ie,placement:Q,rects:xe,y:ve}=Y,Ie=te(Q),Ze=re(Ie),Dt=_.current,An=ie.arrow?.x||0,Mn=ie.arrow?.y||0,Ln=Dt?.clientWidth||0,Dn=Dt?.clientHeight||0,et=An+Ln/2,It=Mn+Dn/2,In=Math.abs(ie.shift?.y||0),kn=xe.reference.height/2,Te=typeof r=="function"?r(Ut(Y,o,I)):r,Fn=In>Te,Hn={top:`${et}px calc(100% + ${Te}px)`,bottom:`${et}px ${-Te}px`,left:`calc(100% + ${Te}px) ${It}px`,right:`${-Te}px ${It}px`}[Ie],Bn=`${et}px ${xe.reference.y+kn-ve}px`;return q.floating.style.setProperty("--transform-origin",ht&&Ze==="y"&&Fn?Bn:Hn),{}}},Sr,v),z(()=>{!g&&l&&l.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,l]);const Qe=p.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:he,elements:Ee,x:vt,y:Rt,middlewareData:ye,update:Le,placement:wt,context:bt,isPositioned:Ce,floatingStyles:Et}=dr({rootContext:l,placement:A,middleware:oe,strategy:n,whileElementsMounted:m?void 0:(...Y)=>Yt(...Y,Qe),nodeId:x,externalTree:C}),{sideX:Ct,sideY:St}=ye.adaptiveOrigin||Ve,Je=Ce?n:"fixed",Tt=p.useMemo(()=>v?{position:Je,[Ct]:vt,[St]:Rt}:{position:Je,...Et},[v,Je,Ct,vt,St,Rt,Et]),De=p.useRef(null);z(()=>{if(!g)return;const Y=y.current,q=typeof Y=="function"?Y():Y,Q=(zt(q)?q.current:q)||null||null;Q!==De.current&&(he.setPositionReference(Q),De.current=Q)},[g,he,T,y]),p.useEffect(()=>{if(!g)return;const Y=y.current;typeof Y!="function"&&zt(Y)&&Y.current!==De.current&&(he.setPositionReference(Y.current),De.current=Y.current)},[g,he,T,y]),p.useEffect(()=>{if(m&&g&&Ee.domReference&&Ee.floating)return Yt(Ee.domReference,Ee.floating,Le,Qe)},[m,g,Ee,Le,Qe]);const Se=te(wt),Pt=Cn(o,Se,I),Ot=be(wt)||"center",At=!!ye.hide?.referenceHidden;z(()=>{E&&g&&Ce&&S(Se)},[E,g,Ce,Se]);const Mt=p.useMemo(()=>({position:"absolute",top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Lt=ye.arrow?.centerOffset!==0;return p.useMemo(()=>({positionerStyles:Tt,arrowStyles:Mt,arrowRef:_,arrowUncentered:Lt,side:Pt,align:Ot,physicalSide:Se,anchorHidden:At,refs:he,context:bt,isPositioned:Ce,update:Le}),[Tt,Mt,_,Lt,Pt,Ot,Se,At,he,bt,Ce,Le])}function zt(t){return t!=null&&"current"in t}const Sn=p.createContext(void 0);function Ge(t){const e=p.useContext(Sn);if(e===void 0&&!t)throw new Error(Ue(72));return e}const Or={...Yn,disabled:me(t=>t.disabled),instantType:me(t=>t.instantType),isInstantPhase:me(t=>t.isInstantPhase),trackCursorAxis:me(t=>t.trackCursorAxis),disableHoverablePopup:me(t=>t.disableHoverablePopup),lastOpenChangeReason:me(t=>t.openChangeReason),closeDelay:me(t=>t.closeDelay),hasViewport:me(t=>t.hasViewport)};class mt extends Nn{constructor(e){super({...Ar(),...e},{popupRef:p.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Jt},Or)}setOpen=(e,n)=>{const o=n.reason,r=o===ce,s=e&&o===Fe,i=!e&&(o===rn||o===sn);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,n),n.isCanceled)return;const c=()=>{const a={open:e,openChangeReason:o};s?a.instantType="focus":i?a.instantType="dismiss":o===ce&&(a.instantType=void 0);const d=n.trigger?.id??null;(d||e)&&(a.activeTriggerId=d,a.activeTriggerElement=n.trigger??null),this.update(a)};r?_e.flushSync(c):c()};static useStore(e,n){const o=qt(()=>new mt(n)).current,r=e??o,s=Xn({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=s,r}}function Ar(){return{..._n(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}function Mr(t){const{disabled:e=!1,defaultOpen:n=!1,open:o,disableHoverablePopup:r=!1,trackCursorAxis:s="none",actionsRef:i,onOpenChange:c,onOpenChangeComplete:a,handle:d,triggerId:u,defaultTriggerId:f=null,children:m}=t,l=mt.useStore(d?.store,{open:o??n,activeTriggerId:u!==void 0?u:f});l.useControlledProp("open",o,n),l.useControlledProp("activeTriggerId",u,f),l.useContextCallback("onOpenChange",c),l.useContextCallback("onOpenChangeComplete",a);const g=l.useState("open"),h=!e&&g,R=l.useState("activeTriggerId"),x=l.useState("payload");l.useSyncedValues({trackCursorAxis:s,disableHoverablePopup:r}),z(()=>{g&&e&&l.setOpen(!1,K(so))},[g,e,l]),l.useSyncedValue("disabled",e),Un(l);const{forceUnmount:v,transitionStatus:E}=zn(h,l),C=l.useState("isInstantPhase"),P=l.useState("instantType"),S=l.useState("lastOpenChangeReason"),b=p.useRef(null);z(()=>{E==="ending"&&S===tn||E!=="ending"&&C?(P!=="delay"&&(b.current=P),l.set("instantType","delay")):b.current!==null&&(l.set("instantType",b.current),b.current=null)},[E,C,S,P,l]),z(()=>{h&&R==null&&l.set("payload",void 0)},[l,R,h]);const O=p.useCallback(()=>{l.setOpen(!1,Lr(l,io))},[l]);p.useImperativeHandle(i,()=>({unmount:v,close:O}),[v,O]);const F=l.useState("floatingRootContext"),M=gr(F,{enabled:!e}),k=qn(F,{enabled:!e,referencePress:!0}),T=Eo(F,{enabled:!e&&s!=="none",axis:s==="none"?void 0:s}),{getReferenceProps:y,getFloatingProps:D,getTriggerProps:I}=Kn([M,k,T]),H=p.useMemo(()=>y(),[y]),A=p.useMemo(()=>I(),[I]),w=p.useMemo(()=>D(),[D]);return l.useSyncedValues({activeTriggerProps:H,inactiveTriggerProps:A,popupProps:w}),G.jsx(Sn.Provider,{value:l,children:typeof m=="function"?m({payload:x}):m})}function Lr(t,e){const n=K(e);return n.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},n}const Tn=p.createContext(void 0);function Dr(){return p.useContext(Tn)}const Ir=600,kr=p.forwardRef(function(e,n){const{className:o,render:r,handle:s,payload:i,disabled:c,delay:a,closeDelay:d,id:u,...f}=e,m=Ge(!0),l=s?.store??m;if(!l)throw new Error(Ue(82));const g=co(u),h=l.useState("isTriggerActive",g),R=l.useState("isOpenedByTrigger",g),x=l.useState("floatingRootContext"),v=p.useRef(null),E=a??Ir,C=d??0,{registerTrigger:P,isMountedByThisTrigger:S}=Gn(g,v,l,{payload:i,closeDelay:C}),b=Dr(),{delayRef:O,isInstantPhase:F,hasProvider:M}=wo(x,{open:R});l.useSyncedValue("isInstantPhase",F);const k=l.useState("disabled"),T=c??k,y=l.useState("trackCursorAxis"),D=l.useState("disableHoverablePopup"),I=Rr(x,{enabled:!T,mouseOnly:!0,move:!1,handleClose:!D&&y!=="both"?br():null,restMs(){const L=b?.delay,W=typeof O.current=="object"?O.current.open:void 0;let V=E;return M&&(W!==0?V=a??L??E:V=0),V},delay(){const L=typeof O.current=="object"?O.current.close:void 0;let W=C;return d==null&&M&&(W=L),{close:W}},triggerElementRef:v,isActiveTrigger:h}),H=p.useMemo(()=>({open:R}),[R]),A=l.useState("triggerProps",S);return lt("button",e,{state:H,ref:[n,P,v],props:[I,A,{id:g},f],stateAttributesMapping:Qn})}),Pn=p.createContext(void 0);function Fr(){const t=p.useContext(Pn);if(t===void 0)throw new Error(Ue(70));return t}const Hr=p.forwardRef(function(e,n){const{children:o,container:r,className:s,render:i,...c}=e,{portalNode:a,portalSubtree:d}=Jn({container:r,ref:n,componentProps:e,elementProps:c});return!d&&!a?null:G.jsxs(p.Fragment,{children:[d,a&&_e.createPortal(o,a)]})}),Br=p.forwardRef(function(e,n){const{keepMounted:o=!1,...r}=e;return Ge().useState("mounted")||o?G.jsx(Pn.Provider,{value:o,children:G.jsx(Hr,{ref:n,...r})}):null}),On=p.createContext(void 0);function Vr(){const t=p.useContext(On);if(t===void 0)throw new Error(Ue(71));return t}const $r=p.forwardRef(function(e,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:c="top",align:a="center",sideOffset:d=0,alignOffset:u=0,collisionBoundary:f="clipping-ancestors",collisionPadding:m=5,arrowPadding:l=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:R=Zn,...x}=e,v=Ge(),E=Fr(),C=v.useState("open"),P=v.useState("mounted"),S=v.useState("trackCursorAxis"),b=v.useState("disableHoverablePopup"),O=v.useState("floatingRootContext"),F=v.useState("instantType"),M=v.useState("transitionStatus"),k=v.useState("hasViewport"),T=Pr({anchor:s,positionMethod:i,floatingRootContext:O,mounted:P,side:c,sideOffset:d,align:a,alignOffset:u,collisionBoundary:f,collisionPadding:m,sticky:g,arrowPadding:l,disableAnchorTracking:h,keepMounted:E,collisionAvoidance:R,adaptiveOrigin:k?Tr:void 0}),y=p.useMemo(()=>{const A={};return(!C||S==="both"||b)&&(A.pointerEvents="none"),{role:"presentation",hidden:!P,style:{...T.positionerStyles,...A}}},[C,S,b,P,T.positionerStyles]),D=p.useMemo(()=>({open:C,side:T.side,align:T.align,anchorHidden:T.anchorHidden,instant:S!=="none"?"tracking-cursor":F}),[C,T.side,T.align,T.anchorHidden,S,F]),I=p.useMemo(()=>({...D,arrowRef:T.arrowRef,arrowStyles:T.arrowStyles,arrowUncentered:T.arrowUncentered}),[D,T.arrowRef,T.arrowStyles,T.arrowUncentered]),H=lt("div",e,{state:D,props:[y,En(M),x],ref:[n,v.useStateSetter("positionerElement")],stateAttributesMapping:en});return G.jsx(On.Provider,{value:I,children:H})}),Wr={...en,...to},jr=p.forwardRef(function(e,n){const{className:o,render:r,...s}=e,i=Ge(),{side:c,align:a}=Vr(),d=i.useState("open"),u=i.useState("instantType"),f=i.useState("transitionStatus"),m=i.useState("popupProps"),l=i.useState("floatingRootContext");eo({open:d,ref:i.context.popupRef,onComplete(){d&&i.context.onOpenChangeComplete?.(!0)}});const g=i.useState("disabled"),h=i.useState("closeDelay");yr(l,{enabled:!g,closeDelay:h});const R=p.useMemo(()=>({open:d,side:c,align:a,instant:u,transitionStatus:f}),[d,c,a,u,f]);return lt("div",e,{state:R,ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],props:[m,En(f),s],stateAttributesMapping:Wr})}),Nr=function(e){const{delay:n,closeDelay:o,timeout:r=400}=e,s=p.useMemo(()=>({delay:n,closeDelay:o}),[n,o]),i=p.useMemo(()=>({open:n,close:o}),[n,o]);return G.jsx(Tn.Provider,{value:s,children:G.jsx(Ro,{delay:i,timeoutMs:r,children:e.children})})};function Qr({children:t}){return G.jsx(Nr,{delay:0,closeDelay:0,timeout:0,children:t})}function Jr({children:t,...e}){return G.jsx(Mr,{...e,children:t})}function Zr({className:t,...e}){return G.jsx(kr,{className:Kt(t),...e})}function es({className:t,side:e="top",children:n}){return G.jsx(Br,{children:G.jsx($r,{side:e,children:G.jsx(jr,{className:Kt("rounded-md border border-primary-900 bg-primary-950 px-2 py-1 text-xs text-primary-50 shadow-sm",t),children:n})})})}export{Qr as T,Jr as a,Zr as b,es as c,dn as d,En as e,Pr as f,Kr as g,Rr as h,br as i,gr as j,Gr as s,yr as u};
1
+ import{r as p,j as G,w as _e}from"./main-CQKtcNr3.js";import{C as qt,ab as Vn,ac as Ue,ag as lt,c as Kt}from"./button-8ab4wOwy.js";import{a as $e,E as Gt,c as Qt,W as $n,g as Jt,d as at,K as Zt,b as Re,N as Wn,X as jn,R as Nn,h as Yn,o as Xn,k as _n,i as me,m as Un,n as zn,q as qn,r as Kn,v as Gn,Y as Qn,Z as Jn,P as Zn,p as en,e as eo,t as to}from"./popupStateMapping-DkI2OCkW.js";import{u as z,g as K,n as tn,a as Z,z as le,E as st,e as j,F as ge,G as kt,h as ue,i as fe,H as nn,I as ut,x as Pe,w as We,J as no,K as on,L as oo,B as ft,A as dt,M as ze,p as ro,q as Fe,t as rn,r as sn,m as ce,N as so,v as io,d as co}from"./useBaseUiId-DiwX_3so.js";import{i as Oe,l as qe,e as ee,d as Ft,g as lo,r as ao,k as Ae,t as uo,v as fo,T as go,o as cn}from"./event-DG3RKJz8.js";import{e as de,g as te,a as re,b as mo,c as po,d as ho,h as yo,i as be,m as Me,j as J,s as xo,k as ln,l as an,n as je,o as un,p as it,q as fn,t as ae,f as ke,r as Ne,u as vo}from"./DirectionContext-CrIsc5n9.js";const Ye={isSidebarCollapsed:!1},dn=["chat","ui"];function Kr(t){const e=t.getQueryData(dn);return e&&typeof e=="object"?{...Ye,...e}:Ye}function Gr(t,e){t.setQueryData(dn,function(o){const r=o&&typeof o=="object"?{...Ye,...o}:Ye;return e(r)})}function He(t,e,n){if(n&&!Oe(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const o=t();return typeof o=="number"?o:o?.[e]}return t?.[e]}const gn=p.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Gt,currentIdRef:{current:null},currentContextRef:{current:null}});function Ro(t){const{children:e,delay:n,timeoutMs:o=0}=t,r=p.useRef(n),s=p.useRef(n),i=p.useRef(null),c=p.useRef(null),a=$e();return G.jsx(gn.Provider,{value:p.useMemo(()=>({hasProvider:!0,delayRef:r,initialDelayRef:s,currentIdRef:i,timeoutMs:o,currentContextRef:c,timeout:a}),[o,a]),children:e})}function wo(t,e={open:!1}){const n="rootStore"in t?t.rootStore:t,o=n.useState("floatingId"),{enabled:r=!0,open:s}=e,i=p.useContext(gn),{currentIdRef:c,delayRef:a,timeoutMs:d,initialDelayRef:u,currentContextRef:f,hasProvider:m,timeout:l}=i,[g,h]=p.useState(!1);return z(()=>{function R(){h(!1),f.current?.setIsInstantPhase(!1),c.current=null,f.current=null,a.current=u.current}if(r&&c.current&&!s&&c.current===o){if(h(!1),d){const x=o;return l.start(d,()=>{n.select("open")||c.current&&c.current!==x||R()}),()=>{l.clear()}}R()}},[r,s,o,c,a,d,u,f,l,n]),z(()=>{if(!r||!s)return;const R=f.current,x=c.current;l.clear(),f.current={onOpenChange:n.setOpen,setIsInstantPhase:h},c.current=o,a.current={open:0,close:He(u.current,"close")},x!==null&&x!==o?(h(!0),R?.setIsInstantPhase(!0),R?.onOpenChange(!1,K(tn))):(h(!1),R?.setIsInstantPhase(!1))},[r,s,o,n,c,a,d,u,f,l]),z(()=>()=>{f.current=null},[f]),p.useMemo(()=>({hasProvider:m,delayRef:a,isInstantPhase:g}),[m,a,g])}function bo(t,e){let n=null,o=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const s=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=e.axis==="x"||e.axis==="both",c=e.axis==="y"||e.axis==="both",a=["mouseenter","mousemove"].includes(e.dataRef.current.openEvent?.type||"")&&e.pointerType!=="touch";let d=s.width,u=s.height,f=s.x,m=s.y;return n==null&&e.x&&i&&(n=s.x-e.x),o==null&&e.y&&c&&(o=s.y-e.y),f-=n||0,m-=o||0,d=0,u=0,!r||a?(d=e.axis==="y"?s.width:0,u=e.axis==="x"?s.height:0,f=i&&e.x!=null?e.x:f,m=c&&e.y!=null?e.y:m):r&&!a&&(u=e.axis==="x"?s.height:u,d=e.axis==="y"?s.width:d),r=!0,{width:d,height:u,x:f,y:m,top:m,right:f+d,bottom:m+u,left:f}}}}function Ht(t){return t!=null&&t.clientX!=null}function Eo(t,e={}){const n="rootStore"in t?t.rootStore:t,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{enabled:c=!0,axis:a="both",x:d=null,y:u=null}=e,f=p.useRef(!1),m=p.useRef(null),[l,g]=p.useState(),[h,R]=p.useState([]),x=Z((S,b,O)=>{f.current||i.current.openEvent&&!Ht(i.current.openEvent)||n.set("positionReference",bo(O??s,{x:S,y:b,axis:a,dataRef:i,pointerType:l}))}),v=Z(S=>{d!=null||u!=null||(o?m.current||R([]):x(S.clientX,S.clientY,S.currentTarget))}),E=Oe(l)?r:o,C=p.useCallback(()=>{if(!E||!c||d!=null||u!=null)return;const S=le(r);function b(O){const F=qe(O);ee(r,F)?(S.removeEventListener("mousemove",b),m.current=null):x(O.clientX,O.clientY)}if(!i.current.openEvent||Ht(i.current.openEvent)){S.addEventListener("mousemove",b);const O=()=>{S.removeEventListener("mousemove",b),m.current=null};return m.current=O,O}n.set("positionReference",s)},[E,c,d,u,r,i,s,n,x]);p.useEffect(()=>C(),[C,h]),p.useEffect(()=>{c&&!r&&(f.current=!1)},[c,r]),p.useEffect(()=>{!c&&o&&(f.current=!0)},[c,o]),z(()=>{c&&(d!=null||u!=null)&&(f.current=!1,x(d,u))},[c,d,u,x]);const P=p.useMemo(()=>{function S(b){g(b.pointerType)}return{onPointerDown:S,onPointerEnter:S,onMouseMove:v,onMouseEnter:v}},[v]);return p.useMemo(()=>c?{reference:P,trigger:P}:{},[c,P])}function Bt(t,e,n){let{reference:o,floating:r}=t;const s=re(e),i=ln(e),c=un(i),a=te(e),d=s==="y",u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,m=o[c]/2-r[c]/2;let l;switch(a){case"top":l={x:u,y:o.y-r.height};break;case"bottom":l={x:u,y:o.y+o.height};break;case"right":l={x:o.x+o.width,y:f};break;case"left":l={x:o.x-r.width,y:f};break;default:l={x:o.x,y:o.y}}switch(be(e)){case"start":l[i]-=m*(n&&d?-1:1);break;case"end":l[i]+=m*(n&&d?-1:1);break}return l}async function Co(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:s,rects:i,elements:c,strategy:a}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:l=0}=de(e,t),g=an(l),R=c[m?f==="floating"?"reference":"floating":f],x=je(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:d,rootBoundary:u,strategy:a})),v=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),C=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},P=je(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:E,strategy:a}):v);return{top:(x.top-P.top+g.top)/C.y,bottom:(P.bottom-x.bottom+g.bottom)/C.y,left:(x.left-P.left+g.left)/C.x,right:(P.right-x.right+g.right)/C.x}}const So=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(e));let d=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:f}=Bt(d,o,a),m=o,l={},g=0;for(let R=0;R<c.length;R++){var h;const{name:x,fn:v}=c[R],{x:E,y:C,data:P,reset:S}=await v({x:u,y:f,initialPlacement:o,placement:m,strategy:r,middlewareData:l,rects:d,platform:{...i,detectOverflow:(h=i.detectOverflow)!=null?h:Co},elements:{reference:t,floating:e}});u=E??u,f=C??f,l={...l,[x]:{...l[x],...P}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):S.rects),{x:u,y:f}=Bt(d,m,a)),R=-1)}return{x:u,y:f,placement:m,strategy:r,middlewareData:l}},To=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:l="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...R}=de(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=te(r),v=re(c),E=te(c)===c,C=await(a.isRTL==null?void 0:a.isRTL(d.floating)),P=m||(E||!h?[mo(c)]:po(c)),S=g!=="none";!m&&S&&P.push(...ho(c,h,g,C));const b=[c,...P],O=await a.detectOverflow(e,R),F=[];let M=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&F.push(O[x]),f){const D=yo(r,i,C);F.push(O[D[0]],O[D[1]])}if(M=[...M,{placement:r,overflows:F}],!F.every(D=>D<=0)){var k,T;const D=(((k=s.flip)==null?void 0:k.index)||0)+1,I=b[D];if(I&&(!(f==="alignment"?v!==re(I):!1)||M.every(w=>re(w.placement)===v?w.overflows[0]>0:!0)))return{data:{index:D,overflows:M},reset:{placement:I}};let H=(T=M.filter(A=>A.overflows[0]<=0).sort((A,w)=>A.overflows[1]-w.overflows[1])[0])==null?void 0:T.placement;if(!H)switch(l){case"bestFit":{var y;const A=(y=M.filter(w=>{if(S){const L=re(w.placement);return L===v||L==="y"}return!0}).map(w=>[w.placement,w.overflows.filter(L=>L>0).reduce((L,W)=>L+W,0)]).sort((w,L)=>w[1]-L[1])[0])==null?void 0:y[0];A&&(H=A);break}case"initialPlacement":H=c;break}if(r!==H)return{reset:{placement:H}}}return{}}}};function Vt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function $t(t){return xo.some(e=>t[e]>=0)}const Po=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:r="referenceHidden",...s}=de(t,e);switch(r){case"referenceHidden":{const i=await o.detectOverflow(e,{...s,elementContext:"reference"}),c=Vt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:$t(c)}}}case"escaped":{const i=await o.detectOverflow(e,{...s,altBoundary:!0}),c=Vt(i,n.floating);return{data:{escapedOffsets:c,escaped:$t(c)}}}default:return{}}}}},mn=new Set(["left","top"]);async function Oo(t,e){const{placement:n,platform:o,elements:r}=t,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=te(n),c=be(n),a=re(n)==="y",d=mn.has(i)?-1:1,u=s&&a?-1:1,f=de(e,t);let{mainAxis:m,crossAxis:l,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof g=="number"&&(l=c==="end"?g*-1:g),a?{x:l*u,y:m*d}:{x:m*d,y:l*u}}const Ao=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:s,placement:i,middlewareData:c}=e,a=await Oo(e,t);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:i}}}}},Mo=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r,platform:s}=e,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:x=>{let{x:v,y:E}=x;return{x:v,y:E}}},...d}=de(t,e),u={x:n,y:o},f=await s.detectOverflow(e,d),m=re(te(r)),l=fn(m);let g=u[l],h=u[m];if(i){const x=l==="y"?"top":"left",v=l==="y"?"bottom":"right",E=g+f[x],C=g-f[v];g=it(E,g,C)}if(c){const x=m==="y"?"top":"left",v=m==="y"?"bottom":"right",E=h+f[x],C=h-f[v];h=it(E,h,C)}const R=a.fn({...e,[l]:g,[m]:h});return{...R,data:{x:R.x-n,y:R.y-o,enabled:{[l]:i,[m]:c}}}}}},Lo=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=e,{offset:c=0,mainAxis:a=!0,crossAxis:d=!0}=de(t,e),u={x:n,y:o},f=re(r),m=fn(f);let l=u[m],g=u[f];const h=de(c,e),R=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(a){const E=m==="y"?"height":"width",C=s.reference[m]-s.floating[E]+R.mainAxis,P=s.reference[m]+s.reference[E]-R.mainAxis;l<C?l=C:l>P&&(l=P)}if(d){var x,v;const E=m==="y"?"width":"height",C=mn.has(te(r)),P=s.reference[f]-s.floating[E]+(C&&((x=i.offset)==null?void 0:x[f])||0)+(C?0:R.crossAxis),S=s.reference[f]+s.reference[E]+(C?0:((v=i.offset)==null?void 0:v[f])||0)-(C?R.crossAxis:0);g<P?g=P:g>S&&(g=S)}return{[m]:l,[f]:g}}}},Do=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:s,platform:i,elements:c}=e,{apply:a=()=>{},...d}=de(t,e),u=await i.detectOverflow(e,d),f=te(r),m=be(r),l=re(r)==="y",{width:g,height:h}=s.floating;let R,x;f==="top"||f==="bottom"?(R=f,x=m===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(x=f,R=m==="end"?"top":"bottom");const v=h-u.top-u.bottom,E=g-u.left-u.right,C=Me(h-u[R],v),P=Me(g-u[x],E),S=!e.middlewareData.shift;let b=C,O=P;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(b=v),S&&!m){const M=J(u.left,0),k=J(u.right,0),T=J(u.top,0),y=J(u.bottom,0);l?O=g-2*(M!==0||k!==0?M+k:J(u.left,u.right)):b=h-2*(T!==0||y!==0?T+y:J(u.top,u.bottom))}await a({...e,availableWidth:O,availableHeight:b});const F=await i.getDimensions(c.floating);return g!==F.width||h!==F.height?{reset:{rects:!0}}:{}}}};function pn(t){const e=ue(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=fe(t),s=r?t.offsetWidth:n,i=r?t.offsetHeight:o,c=Ne(n)!==s||Ne(o)!==i;return c&&(n=s,o=i),{width:n,height:o,$:c}}function gt(t){return j(t)?t:t.contextElement}function we(t){const e=gt(t);if(!fe(e))return ae(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:s}=pn(e);let i=(s?Ne(n.width):n.width)/o,c=(s?Ne(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Io=ae(0);function hn(t){const e=le(t);return!nn()||!e.visualViewport?Io:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ko(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==le(t)?!1:e}function pe(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=gt(t);let i=ae(1);e&&(o?j(o)&&(i=we(o)):i=we(t));const c=ko(s,n,o)?hn(s):ae(0);let a=(r.left+c.x)/i.x,d=(r.top+c.y)/i.y,u=r.width/i.x,f=r.height/i.y;if(s){const m=le(s),l=o&&j(o)?le(o):o;let g=m,h=kt(g);for(;h&&o&&l!==g;){const R=we(h),x=h.getBoundingClientRect(),v=ue(h),E=x.left+(h.clientLeft+parseFloat(v.paddingLeft))*R.x,C=x.top+(h.clientTop+parseFloat(v.paddingTop))*R.y;a*=R.x,d*=R.y,u*=R.x,f*=R.y,a+=E,d+=C,g=le(h),h=kt(g)}}return je({width:u,height:f,x:a,y:d})}function Ke(t,e){const n=ze(t).scrollLeft;return e?e.left+n:pe(ge(t)).left+n}function yn(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-Ke(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function Fo(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const s=r==="fixed",i=ge(o),c=e?ut(e.floating):!1;if(o===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},d=ae(1);const u=ae(0),f=fe(o);if((f||!f&&!s)&&((ft(o)!=="body"||dt(i))&&(a=ze(o)),fe(o))){const l=pe(o);d=we(o),u.x=l.x+o.clientLeft,u.y=l.y+o.clientTop}const m=i&&!f&&!s?yn(i,a):ae(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-a.scrollTop*d.y+u.y+m.y}}function Ho(t){return Array.from(t.getClientRects())}function Bo(t){const e=ge(t),n=ze(t),o=t.ownerDocument.body,r=J(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),s=J(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ke(t);const c=-n.scrollTop;return ue(o).direction==="rtl"&&(i+=J(e.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:c}}const Wt=25;function Vo(t,e){const n=le(t),o=ge(t),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,c=0,a=0;if(r){s=r.width,i=r.height;const u=nn();(!u||u&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}const d=Ke(o);if(d<=0){const u=o.ownerDocument,f=u.body,m=getComputedStyle(f),l=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(o.clientWidth-f.clientWidth-l);g<=Wt&&(s-=g)}else d<=Wt&&(s+=d);return{width:s,height:i,x:c,y:a}}const $o=new Set(["absolute","fixed"]);function Wo(t,e){const n=pe(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,s=fe(t)?we(t):ae(1),i=t.clientWidth*s.x,c=t.clientHeight*s.y,a=r*s.x,d=o*s.y;return{width:i,height:c,x:a,y:d}}function jt(t,e,n){let o;if(e==="viewport")o=Vo(t,n);else if(e==="document")o=Bo(ge(t));else if(j(e))o=Wo(e,n);else{const r=hn(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return je(o)}function xn(t,e){const n=Pe(t);return n===e||!j(n)||We(n)?!1:ue(n).position==="fixed"||xn(n,e)}function jo(t,e){const n=e.get(t);if(n)return n;let o=st(t,[],!1).filter(c=>j(c)&&ft(c)!=="body"),r=null;const s=ue(t).position==="fixed";let i=s?Pe(t):t;for(;j(i)&&!We(i);){const c=ue(i),a=on(i);!a&&c.position==="fixed"&&(r=null),(s?!a&&!r:!a&&c.position==="static"&&!!r&&$o.has(r.position)||dt(i)&&!a&&xn(t,i))?o=o.filter(u=>u!==i):r=c,i=Pe(i)}return e.set(t,o),o}function No(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[...n==="clippingAncestors"?ut(e)?[]:jo(e,this._c):[].concat(n),o],c=i[0],a=i.reduce((d,u)=>{const f=jt(e,u,r);return d.top=J(f.top,d.top),d.right=Me(f.right,d.right),d.bottom=Me(f.bottom,d.bottom),d.left=J(f.left,d.left),d},jt(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Yo(t){const{width:e,height:n}=pn(t);return{width:e,height:n}}function Xo(t,e,n){const o=fe(e),r=ge(e),s=n==="fixed",i=pe(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const a=ae(0);function d(){a.x=Ke(r)}if(o||!o&&!s)if((ft(e)!=="body"||dt(r))&&(c=ze(e)),o){const l=pe(e,!0,s,e);a.x=l.x+e.clientLeft,a.y=l.y+e.clientTop}else r&&d();s&&!o&&r&&d();const u=r&&!o&&!s?yn(r,c):ae(0),f=i.left+c.scrollLeft-a.x-u.x,m=i.top+c.scrollTop-a.y-u.y;return{x:f,y:m,width:i.width,height:i.height}}function tt(t){return ue(t).position==="static"}function Nt(t,e){if(!fe(t)||ue(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ge(t)===n&&(n=n.ownerDocument.body),n}function vn(t,e){const n=le(t);if(ut(t))return n;if(!fe(t)){let r=Pe(t);for(;r&&!We(r);){if(j(r)&&!tt(r))return r;r=Pe(r)}return n}let o=Nt(t,e);for(;o&&no(o)&&tt(o);)o=Nt(o,e);return o&&We(o)&&tt(o)&&!on(o)?n:o||oo(t)||n}const _o=async function(t){const e=this.getOffsetParent||vn,n=this.getDimensions,o=await n(t.floating);return{reference:Xo(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Uo(t){return ue(t).direction==="rtl"}const zo={convertOffsetParentRelativeRectToViewportRelativeRect:Fo,getDocumentElement:ge,getClippingRect:No,getOffsetParent:vn,getElementRects:_o,getClientRects:Ho,getDimensions:Yo,getScale:we,isElement:j,isRTL:Uo};function Rn(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function qo(t,e){let n=null,o;const r=ge(t);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const d=t.getBoundingClientRect(),{left:u,top:f,width:m,height:l}=d;if(c||e(),!m||!l)return;const g=ke(f),h=ke(r.clientWidth-(u+m)),R=ke(r.clientHeight-(f+l)),x=ke(u),E={rootMargin:-g+"px "+-h+"px "+-R+"px "+-x+"px",threshold:J(0,Me(1,a))||1};let C=!0;function P(S){const b=S[0].intersectionRatio;if(b!==a){if(!C)return i();b?i(!1,b):o=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!Rn(d,t.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(P,{...E,root:r.ownerDocument})}catch{n=new IntersectionObserver(P,E)}n.observe(t)}return i(!0),s}function Yt(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,d=gt(t),u=r||s?[...d?st(d):[],...st(e)]:[];u.forEach(x=>{r&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const f=d&&c?qo(d,n):null;let m=-1,l=null;i&&(l=new ResizeObserver(x=>{let[v]=x;v&&v.target===d&&l&&(l.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var E;(E=l)==null||E.observe(e)})),n()}),d&&!a&&l.observe(d),l.observe(e));let g,h=a?pe(t):null;a&&R();function R(){const x=pe(t);h&&!Rn(h,x)&&n(),h=x,g=requestAnimationFrame(R)}return n(),()=>{var x;u.forEach(v=>{r&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f?.(),(x=l)==null||x.disconnect(),l=null,a&&cancelAnimationFrame(g)}}const Ko=Ao,Go=Mo,Qo=To,Jo=Do,Zo=Po,er=Lo,tr=(t,e,n)=>{const o=new Map,r={platform:zo,...n},s={...r.platform,_c:o};return So(t,e,{...r,platform:s})};var nr=typeof document<"u",or=function(){},Be=nr?p.useLayoutEffect:or;function Xe(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!Xe(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&t.$$typeof)&&!Xe(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function wn(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Xt(t,e){const n=wn(t);return Math.round(e*n)/n}function nt(t){const e=p.useRef(t);return Be(()=>{e.current=t}),e}function rr(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:d}=t,[u,f]=p.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,l]=p.useState(o);Xe(m,o)||l(o);const[g,h]=p.useState(null),[R,x]=p.useState(null),v=p.useCallback(w=>{w!==S.current&&(S.current=w,h(w))},[]),E=p.useCallback(w=>{w!==b.current&&(b.current=w,x(w))},[]),C=s||g,P=i||R,S=p.useRef(null),b=p.useRef(null),O=p.useRef(u),F=a!=null,M=nt(a),k=nt(r),T=nt(d),y=p.useCallback(()=>{if(!S.current||!b.current)return;const w={placement:e,strategy:n,middleware:m};k.current&&(w.platform=k.current),tr(S.current,b.current,w).then(L=>{const W={...L,isPositioned:T.current!==!1};D.current&&!Xe(O.current,W)&&(O.current=W,_e.flushSync(()=>{f(W)}))})},[m,e,n,k,T]);Be(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(w=>({...w,isPositioned:!1})))},[d]);const D=p.useRef(!1);Be(()=>(D.current=!0,()=>{D.current=!1}),[]),Be(()=>{if(C&&(S.current=C),P&&(b.current=P),C&&P){if(M.current)return M.current(C,P,y);y()}},[C,P,y,M,F]);const I=p.useMemo(()=>({reference:S,floating:b,setReference:v,setFloating:E}),[v,E]),H=p.useMemo(()=>({reference:C,floating:P}),[C,P]),A=p.useMemo(()=>{const w={position:n,left:0,top:0};if(!H.floating)return w;const L=Xt(H.floating,u.x),W=Xt(H.floating,u.y);return c?{...w,transform:"translate("+L+"px, "+W+"px)",...wn(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:W}},[n,c,H.floating,u.x,u.y]);return p.useMemo(()=>({...u,update:y,refs:I,elements:H,floatingStyles:A}),[u,y,I,H,A])}const sr=(t,e)=>({...Ko(t),options:[t,e]}),ir=(t,e)=>({...Go(t),options:[t,e]}),cr=(t,e)=>({...er(t),options:[t,e]}),lr=(t,e)=>({...Qo(t),options:[t,e]}),ar=(t,e)=>({...Jo(t),options:[t,e]}),ur=(t,e)=>({...Zo(t),options:[t,e]});function fr(t){const{open:e=!1,onOpenChange:n,elements:o={}}=t,r=ro(),s=Qt()!=null,i=qt(()=>new $n({open:e,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new Jt,floatingId:r,nested:s,noEmit:t.noEmit||!1})).current;return z(()=>{const c={open:e,floatingId:r};o.reference!==void 0&&(c.referenceElement=o.reference,c.domReferenceElement=j(o.reference)?o.reference:null),o.floating!==void 0&&(c.floatingElement=o.floating),i.update(c)},[e,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=t.noEmit||!1,i}function dr(t={}){const{nodeId:e,externalTree:n}=t,o=fr(t),r=t.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,c]=p.useState(null),a=p.useRef(null),d=at(n);z(()=>{s.domReference&&(a.current=s.domReference)},[s.domReference]);const u=rr({...t,elements:{...s,...i&&{reference:i}}}),f=p.useCallback(b=>{const O=j(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;c(O),u.refs.setReference(O)},[u.refs]),[m,l]=p.useState(null),[g,h]=p.useState(null);r.useSyncedValue("referenceElement",m),r.useSyncedValue("domReferenceElement",j(m)?m:null),r.useSyncedValue("floatingElement",g);const R=p.useCallback(b=>{(j(b)||b===null)&&(a.current=b,l(b)),(j(u.refs.reference.current)||u.refs.reference.current===null||b!==null&&!j(b))&&u.refs.setReference(b)},[u.refs,l]),x=p.useCallback(b=>{h(b),u.refs.setFloating(b)},[u.refs]),v=p.useMemo(()=>({...u.refs,setReference:R,setFloating:x,setPositionReference:f,domReference:a}),[u.refs,R,x,f]),E=p.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),C=r.useState("open"),P=r.useState("floatingId"),S=p.useMemo(()=>({...u,dataRef:r.context.dataRef,open:C,onOpenChange:r.setOpen,events:r.context.events,floatingId:P,refs:v,elements:E,nodeId:e,rootStore:r}),[u,v,E,e,r,C,P]);return z(()=>{r.context.dataRef.current.floatingContext=S;const b=d?.nodesRef.current.find(O=>O.id===e);b&&(b.context=S)}),p.useMemo(()=>({...u,context:S,refs:v,elements:E,rootStore:r}),[u,v,E,S,r])}const ot=uo&&fo;function gr(t,e={}){const n="rootStore"in t?t.rootStore:t,{events:o,dataRef:r}=n.context,{enabled:s=!0,visibleOnly:i=!0,delay:c}=e,a=p.useRef(!1),d=p.useRef(null),u=$e(),f=p.useRef(!0);p.useEffect(()=>{const l=n.select("domReferenceElement");if(!s)return;const g=le(l);function h(){const v=n.select("domReferenceElement");!n.select("open")&&fe(v)&&v===Ft(Ae(v))&&(a.current=!0)}function R(){f.current=!0}function x(){f.current=!1}return g.addEventListener("blur",h),ot&&(g.addEventListener("keydown",R,!0),g.addEventListener("pointerdown",x,!0)),()=>{g.removeEventListener("blur",h),ot&&(g.removeEventListener("keydown",R,!0),g.removeEventListener("pointerdown",x,!0))}},[n,s]),p.useEffect(()=>{if(!s)return;function l(g){if(g.reason===rn||g.reason===sn){const h=n.select("domReferenceElement");j(h)&&(d.current=h,a.current=!0)}}return o.on("openchange",l),()=>{o.off("openchange",l)}},[o,s,n]);const m=p.useMemo(()=>({onMouseLeave(){a.current=!1,d.current=null},onFocus(l){const g=l.currentTarget;if(a.current){if(d.current===g)return;a.current=!1,d.current=null}const h=qe(l.nativeEvent);if(i&&j(h)){if(ot&&!l.relatedTarget){if(!f.current&&!lo(h))return}else if(!ao(h))return}const R=l.relatedTarget&&n.context.triggerElements.hasElement(l.relatedTarget),{nativeEvent:x,currentTarget:v}=l,E=typeof c=="function"?c():c;if(n.select("open")&&R||E===0||E===void 0){n.setOpen(!0,K(Fe,x,v));return}u.start(E,()=>{a.current||n.setOpen(!0,K(Fe,x,v))})},onBlur(l){a.current=!1,d.current=null;const g=l.relatedTarget,h=l.nativeEvent,R=j(g)&&g.hasAttribute(Zt("focus-guard"))&&g.getAttribute("data-type")==="outside";u.start(0,()=>{const x=n.select("domReferenceElement"),v=Ft(x?x.ownerDocument:document);if(!g&&v===x||ee(r.current.floatingContext?.refs.floating.current,v)||ee(x,v)||R)return;const E=g??v;if(j(E)){const C=n.context.triggerElements;if(C.hasElement(E)||C.hasMatchingElement(P=>ee(P,E)))return}n.setOpen(!1,K(Fe,h))})}}),[r,n,i,u,c]);return p.useMemo(()=>s?{reference:m,trigger:m}:{},[s,m])}const ct=Zt("safe-polygon"),mr=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${go}`;function pr(t){return t?!!t.closest(mr):!1}function bn(t){const e=p.useRef(void 0),n=p.useRef(!1),o=p.useRef(void 0),r=p.useRef(!0),s=p.useRef(!1),i=p.useRef(()=>{}),c=p.useRef(!1),a=$e(),d=$e(),u=p.useRef(void 0);return p.useMemo(()=>{const f=t.context.dataRef.current;return f.hoverInteractionState||(f.hoverInteractionState={pointerTypeRef:e,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:r,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:c,openChangeTimeout:a,restTimeout:d,handleCloseOptionsRef:u}),f.hoverInteractionState},[t,e,n,o,r,s,i,c,a,d,u])}const hr=new Set(["click","mousedown"]);function yr(t,e={}){const n="rootStore"in t?t.rootStore:t,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:c=!0,closeDelay:a=0,externalTree:d}=e,{pointerTypeRef:u,interactedInsideRef:f,handlerRef:m,performedPointerEventsMutationRef:l,unbindMouseMoveRef:g,restTimeoutPendingRef:h,openChangeTimeout:R,handleCloseOptionsRef:x}=bn(n),v=at(d),E=Qt(),C=Z(()=>f.current?!0:i.current.openEvent?hr.has(i.current.openEvent.type):!1),P=Z(()=>{const M=i.current.openEvent?.type;return M?.includes("mouse")&&M!=="mousedown"}),S=p.useCallback((M,k=!0)=>{const T=xr(a,u.current);T&&!m.current?R.start(T,()=>n.setOpen(!1,K(ce,M))):k&&(R.clear(),n.setOpen(!1,K(ce,M)))},[a,m,n,u,R]),b=Z(()=>{g.current(),m.current=void 0}),O=Z(()=>{if(l.current){const M=Ae(r).body;M.style.pointerEvents="",M.removeAttribute(ct),l.current=!1}}),F=Z(M=>{const k=qe(M);if(!pr(k)){f.current=!1;return}f.current=!0});z(()=>{o||(u.current=void 0,h.current=!1,f.current=!1,b(),O())},[o,u,h,f,b,O]),p.useEffect(()=>()=>{b()},[b]),p.useEffect(()=>O,[O]),z(()=>{if(c&&o&&x.current?.blockPointerEvents&&P()&&j(s)&&r){l.current=!0;const M=Ae(r).body;M.setAttribute(ct,"");const k=s,T=r,y=v?.nodesRef.current.find(D=>D.id===E)?.context?.elements.floating;return y&&(y.style.pointerEvents=""),M.style.pointerEvents="none",k.style.pointerEvents="auto",T.style.pointerEvents="auto",()=>{M.style.pointerEvents="",k.style.pointerEvents="",T.style.pointerEvents=""}}},[c,o,s,r,x,P,v,E,l]),p.useEffect(()=>{if(!c)return;function M(D){if(C()||!i.current.floatingContext||!n.select("open"))return;const I=n.context.triggerElements;D.relatedTarget&&I.hasElement(D.relatedTarget)||(O(),b(),C()||S(D))}function k(D){R.clear(),O(),m.current?.(D),b()}function T(D){C()||S(D,!1)}const y=r;return y&&(y.addEventListener("mouseleave",M),y.addEventListener("mouseenter",k),y.addEventListener("mouseleave",T),y.addEventListener("pointerdown",F,!0)),()=>{y&&(y.removeEventListener("mouseleave",M),y.removeEventListener("mouseenter",k),y.removeEventListener("mouseleave",T),y.removeEventListener("pointerdown",F,!0))}})}function xr(t,e){return e&&!Oe(e)?0:typeof t=="function"?t():t}function rt(t){return typeof t=="function"?t():t}const vr={current:null};function Rr(t,e={}){const n="rootStore"in t?t.rootStore:t,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:c=null,mouseOnly:a=!1,restMs:d=0,move:u=!0,triggerElementRef:f=vr,externalTree:m,isActiveTrigger:l=!0}=e,g=at(m),{pointerTypeRef:h,interactedInsideRef:R,handlerRef:x,blockMouseMoveRef:v,performedPointerEventsMutationRef:E,unbindMouseMoveRef:C,restTimeoutPendingRef:P,openChangeTimeout:S,restTimeout:b,handleCloseOptionsRef:O}=bn(n),F=Re(c),M=Re(i),k=Re(d);l&&(O.current=F.current?.__options);const T=Z(()=>R.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),y=p.useCallback((A,w=!0)=>{const L=He(M.current,"close",h.current);L&&!x.current?S.start(L,()=>n.setOpen(!1,K(ce,A))):w&&(S.clear(),n.setOpen(!1,K(ce,A)))},[M,x,n,h,S]),D=Z(()=>{C.current(),x.current=void 0}),I=Z(()=>{if(E.current){const A=Ae(n.select("domReferenceElement")).body;A.style.pointerEvents="",A.removeAttribute(ct),E.current=!1}});p.useEffect(()=>{if(!s)return;function A(w){w.open||(S.clear(),b.clear(),v.current=!0,P.current=!1)}return r.on("openchange",A),()=>{r.off("openchange",A)}},[s,r,S,b,v,P]);const H=Z(A=>{if(T()||!o.current.floatingContext)return;const w=n.context.triggerElements;if(A.relatedTarget&&w.hasElement(A.relatedTarget))return;const L=f.current;F.current?.({...o.current.floatingContext,tree:g,x:A.clientX,y:A.clientY,onClose(){I(),D(),!T()&&L===n.select("domReferenceElement")&&y(A)}})(A)});return p.useEffect(()=>{if(!s)return;const A=f.current??(l?n.select("domReferenceElement"):null);if(!j(A))return;function w(V){if(S.clear(),v.current=!1,a&&!Oe(h.current)||rt(k.current)>0&&!He(M.current,"open"))return;const U=He(M.current,"open",h.current),X=n.select("domReferenceElement"),N=n.context.triggerElements,_=(N.hasElement(V.target)||N.hasMatchingElement(se=>ee(se,V.target)))&&(!X||!ee(X,V.target)),B=V.currentTarget??null,$=n.select("open"),ne=!$||_;_&&$?n.setOpen(!0,K(ce,V,B)):U?S.start(U,()=>{ne&&n.setOpen(!0,K(ce,V,B))}):ne&&n.setOpen(!0,K(ce,V,B))}function L(V){if(T()){I();return}C.current();const U=n.select("domReferenceElement"),X=Ae(U);b.clear(),P.current=!1;const N=n.context.triggerElements;if(V.relatedTarget&&N.hasElement(V.relatedTarget))return;if(F.current&&o.current.floatingContext){n.select("open")||S.clear();const B=f.current;x.current=F.current({...o.current.floatingContext,tree:g,x:V.clientX,y:V.clientY,onClose(){I(),D(),!T()&&B===n.select("domReferenceElement")&&y(V,!0)}});const $=x.current;$(V),X.addEventListener("mousemove",$),C.current=()=>{X.removeEventListener("mousemove",$)};return}(h.current!=="touch"||!ee(n.select("floatingElement"),V.relatedTarget))&&y(V)}function W(V){H(V)}return n.select("open")&&A.addEventListener("mouseleave",W),u&&A.addEventListener("mousemove",w,{once:!0}),A.addEventListener("mouseenter",w),A.addEventListener("mouseleave",L),()=>{A.removeEventListener("mouseleave",W),u&&A.removeEventListener("mousemove",w),A.removeEventListener("mouseenter",w),A.removeEventListener("mouseleave",L)}},[D,I,v,o,M,y,n,s,F,H,l,T,a,u,h,k,b,P,S,f,g,C,x]),p.useMemo(()=>{function A(w){h.current=w.pointerType}return{onPointerDown:A,onPointerEnter:A,onMouseMove(w){const{nativeEvent:L}=w,W=w.currentTarget,V=n.select("domReferenceElement"),U=n.context.triggerElements,X=n.select("open"),N=(U.hasElement(w.target)||U.hasMatchingElement(B=>ee(B,w.target)))&&(!V||!ee(V,w.target));if(a&&!Oe(h.current)||X&&!N||rt(k.current)===0||!N&&P.current&&w.movementX**2+w.movementY**2<2)return;b.clear();function _(){if(P.current=!1,T())return;const B=n.select("open");!v.current&&(!B||N)&&n.setOpen(!0,K(ce,L,W))}h.current==="touch"?_e.flushSync(()=>{_()}):N&&X?_():(P.current=!0,b.start(rt(k.current),_))}}},[v,T,a,n,h,k,b,P])}function _t(t,e){const[n,o]=t;let r=!1;const s=e.length;for(let i=0,c=s-1;i<s;c=i++){const[a,d]=e[i]||[0,0],[u,f]=e[c]||[0,0];d>=o!=f>=o&&n<=(u-a)*(o-d)/(f-d)+a&&(r=!r)}return r}function wr(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function br(t={}){const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=t,r=new Gt;let s=!1,i=null,c=null,a=typeof performance<"u"?performance.now():0;function d(f,m){const l=performance.now(),g=l-a;if(i===null||c===null||g===0)return i=f,c=m,a=l,null;const h=f-i,R=m-c,v=Math.sqrt(h*h+R*R)/g;return i=f,c=m,a=l,v}const u=({x:f,y:m,placement:l,elements:g,onClose:h,nodeId:R,tree:x})=>function(E){function C(){r.clear(),h()}if(r.clear(),!g.domReference||!g.floating||l==null||f==null||m==null)return;const{clientX:P,clientY:S}=E,b=[P,S],O=qe(E),F=E.type==="mouseleave",M=ee(g.floating,O),k=ee(g.domReference,O),T=g.domReference.getBoundingClientRect(),y=g.floating.getBoundingClientRect(),D=l.split("-")[0],I=f>y.right-y.width/2,H=m>y.bottom-y.height/2,A=wr(b,T),w=y.width>T.width,L=y.height>T.height,W=(w?T:y).left,V=(w?T:y).right,U=(L?T:y).top,X=(L?T:y).bottom;if(M&&(s=!0,!F))return;if(k&&(s=!1),k&&!F){s=!0;return}if(F&&j(E.relatedTarget)&&ee(g.floating,E.relatedTarget)||x&&Wn(x.nodesRef.current,R).some(({context:B})=>B?.open))return;if(D==="top"&&m>=T.bottom-1||D==="bottom"&&m<=T.top+1||D==="left"&&f>=T.right-1||D==="right"&&f<=T.left+1)return C();let N=[];switch(D){case"top":N=[[W,T.top+1],[W,y.bottom-1],[V,y.bottom-1],[V,T.top+1]];break;case"bottom":N=[[W,y.top+1],[W,T.bottom-1],[V,T.bottom-1],[V,y.top+1]];break;case"left":N=[[y.right-1,X],[y.right-1,U],[T.left+1,U],[T.left+1,X]];break;case"right":N=[[T.right-1,X],[T.right-1,U],[y.left+1,U],[y.left+1,X]];break}function _([B,$]){switch(D){case"top":{const ne=[w?B+e/2:I?B+e*4:B-e*4,$+e+1],se=[w?B-e/2:I?B+e*4:B-e*4,$+e+1],oe=[[y.left,I||w?y.bottom-e:y.top],[y.right,I?w?y.bottom-e:y.top:y.bottom-e]];return[ne,se,...oe]}case"bottom":{const ne=[w?B+e/2:I?B+e*4:B-e*4,$-e],se=[w?B-e/2:I?B+e*4:B-e*4,$-e],oe=[[y.left,I||w?y.top+e:y.bottom],[y.right,I?w?y.top+e:y.bottom:y.top+e]];return[ne,se,...oe]}case"left":{const ne=[B+e+1,L?$+e/2:H?$+e*4:$-e*4],se=[B+e+1,L?$-e/2:H?$+e*4:$-e*4];return[...[[H||L?y.right-e:y.left,y.top],[H?L?y.right-e:y.left:y.right-e,y.bottom]],ne,se]}case"right":{const ne=[B-e,L?$+e/2:H?$+e*4:$-e*4],se=[B-e,L?$-e/2:H?$+e*4:$-e*4],oe=[[H||L?y.left+e:y.right,y.top],[H?L?y.left+e:y.right:y.left+e,y.bottom]];return[ne,se,...oe]}default:return[]}}if(!_t([P,S],N)){if(s&&!A)return C();if(!F&&o){const B=d(E.clientX,E.clientY);if(B!==null&&B<.1)return C()}_t([P,S],_([f,m]))?!s&&o&&r.start(40,C):C()}};return u.__options={blockPointerEvents:n},u}function En(t){return t==="starting"?jn:Vn}const Er=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:a}=e,{element:d,padding:u=0,offsetParent:f="real"}=de(t,e)||{};if(d==null)return{};const m=an(u),l={x:n,y:o},g=ln(r),h=un(g),R=await i.getDimensions(d),x=g==="y",v=x?"top":"left",E=x?"bottom":"right",C=x?"clientHeight":"clientWidth",P=s.reference[h]+s.reference[g]-l[g]-s.floating[h],S=l[g]-s.reference[g],b=f==="real"?await i.getOffsetParent?.(d):c.floating;let O=c.floating[C]||s.floating[h];(!O||!await i.isElement?.(b))&&(O=c.floating[C]||s.floating[h]);const F=P/2-S/2,M=O/2-R[h]/2-1,k=Math.min(m[v],M),T=Math.min(m[E],M),y=k,D=O-R[h]-T,I=O/2-R[h]/2+F,H=it(y,I,D),A=!a.arrow&&be(r)!=null&&I!==H&&s.reference[h]/2-(I<y?k:T)-R[h]/2<0,w=A?I<y?I-y:I-D:0;return{[g]:l[g]+w,data:{[g]:H,centerOffset:I-H-w,...A&&{alignmentOffset:w}},reset:A}}}),Cr=(t,e)=>({...Er(t),options:[t,e]}),Sr={name:"hide",async fn(t){const{width:e,height:n,x:o,y:r}=t.rects.reference,s=e===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await ur().fn(t)).data?.referenceHidden||s}}}},Ve={sideX:"left",sideY:"top"},Tr={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:c}=t,a=le(r),d=a.getComputedStyle(r);if(!(d.transitionDuration!=="0s"&&d.transitionDuration!==""))return{x:e,y:n,data:Ve};const f=await s.getOffsetParent?.(r);let m={width:0,height:0};if(i==="fixed"&&a?.visualViewport)m={width:a.visualViewport.width,height:a.visualViewport.height};else if(f===a){const v=cn(r);m={width:v.documentElement.clientWidth,height:v.documentElement.clientHeight}}else await s.isElement?.(f)&&(m=await s.getDimensions(f));const l=te(c);let g=e,h=n;l==="left"&&(g=m.width-(e+o.width)),l==="top"&&(h=m.height-(n+o.height));const R=l==="left"?"right":Ve.sideX,x=l==="top"?"bottom":Ve.sideY;return{x:g,y:h,data:{sideX:R,sideY:x}}}};function Cn(t,e,n){const o=t==="inline-start"||t==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[e]}function Ut(t,e,n){const{rects:o,placement:r}=t;return{side:Cn(e,te(r),n),align:be(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Pr(t){const{anchor:e,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:d=!1,arrowPadding:u=5,disableAnchorTracking:f=!1,keepMounted:m=!1,floatingRootContext:l,mounted:g,collisionAvoidance:h,shiftCrossAxis:R=!1,nodeId:x,adaptiveOrigin:v,lazyFlip:E=!1,externalTree:C}=t,[P,S]=p.useState(null);!g&&P!==null&&S(null);const b=h.side||"flip",O=h.align||"flip",F=h.fallbackAxisSide||"end",M=typeof e=="function"?e:void 0,k=Z(M),T=M?k:e,y=Re(e),I=vo()==="rtl",H=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[o],A=s==="center"?H:`${H}-${s}`;let w=a;const L=1,W=o==="bottom"?L:0,V=o==="top"?L:0,U=o==="right"?L:0,X=o==="left"?L:0;typeof w=="number"?w={top:w+W,right:w+X,bottom:w+V,left:w+U}:w&&(w={top:(w.top||0)+W,right:(w.right||0)+X,bottom:(w.bottom||0)+V,left:(w.left||0)+U});const N={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:w},_=p.useRef(null),B=Re(r),$=Re(i),oe=[sr(Y=>{const q=Ut(Y,o,I),ie=typeof B.current=="function"?B.current(q):B.current,Q=typeof $.current=="function"?$.current(q):$.current;return{mainAxis:ie,crossAxis:Q,alignmentAxis:Q}},[typeof r!="function"?r:0,typeof i!="function"?i:0,I,o])],pt=O==="none"&&b!=="shift",ht=!pt&&(d||R||b==="shift"),yt=b==="none"?null:lr({...N,padding:{top:w.top+L,right:w.right+L,bottom:w.bottom+L,left:w.left+L},mainAxis:!R&&b==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),xt=pt?null:ir(Y=>{const q=cn(Y.elements.floating).documentElement;return{...N,rootBoundary:R?{x:0,y:0,width:q.clientWidth,height:q.clientHeight}:void 0,mainAxis:O!=="none",crossAxis:ht,limiter:d||R?void 0:cr(ie=>{if(!_.current)return{};const{width:Q,height:xe}=_.current.getBoundingClientRect(),ve=re(te(ie.placement)),Ie=ve==="y"?Q:xe,Ze=ve==="y"?w.left+w.right:w.top+w.bottom;return{offset:Ie/2+Ze/2}})}},[N,d,R,w,O]);b==="shift"||O==="shift"||s==="center"?oe.push(xt,yt):oe.push(yt,xt),oe.push(ar({...N,apply({elements:{floating:Y},rects:{reference:q},availableWidth:ie,availableHeight:Q}){Object.entries({"--available-width":`${ie}px`,"--available-height":`${Q}px`,"--anchor-width":`${q.width}px`,"--anchor-height":`${q.height}px`}).forEach(([xe,ve])=>{Y.style.setProperty(xe,ve)})}}),Cr(()=>({element:_.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(Y){const{elements:q,middlewareData:ie,placement:Q,rects:xe,y:ve}=Y,Ie=te(Q),Ze=re(Ie),Dt=_.current,An=ie.arrow?.x||0,Mn=ie.arrow?.y||0,Ln=Dt?.clientWidth||0,Dn=Dt?.clientHeight||0,et=An+Ln/2,It=Mn+Dn/2,In=Math.abs(ie.shift?.y||0),kn=xe.reference.height/2,Te=typeof r=="function"?r(Ut(Y,o,I)):r,Fn=In>Te,Hn={top:`${et}px calc(100% + ${Te}px)`,bottom:`${et}px ${-Te}px`,left:`calc(100% + ${Te}px) ${It}px`,right:`${-Te}px ${It}px`}[Ie],Bn=`${et}px ${xe.reference.y+kn-ve}px`;return q.floating.style.setProperty("--transform-origin",ht&&Ze==="y"&&Fn?Bn:Hn),{}}},Sr,v),z(()=>{!g&&l&&l.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,l]);const Qe=p.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:he,elements:Ee,x:vt,y:Rt,middlewareData:ye,update:Le,placement:wt,context:bt,isPositioned:Ce,floatingStyles:Et}=dr({rootContext:l,placement:A,middleware:oe,strategy:n,whileElementsMounted:m?void 0:(...Y)=>Yt(...Y,Qe),nodeId:x,externalTree:C}),{sideX:Ct,sideY:St}=ye.adaptiveOrigin||Ve,Je=Ce?n:"fixed",Tt=p.useMemo(()=>v?{position:Je,[Ct]:vt,[St]:Rt}:{position:Je,...Et},[v,Je,Ct,vt,St,Rt,Et]),De=p.useRef(null);z(()=>{if(!g)return;const Y=y.current,q=typeof Y=="function"?Y():Y,Q=(zt(q)?q.current:q)||null||null;Q!==De.current&&(he.setPositionReference(Q),De.current=Q)},[g,he,T,y]),p.useEffect(()=>{if(!g)return;const Y=y.current;typeof Y!="function"&&zt(Y)&&Y.current!==De.current&&(he.setPositionReference(Y.current),De.current=Y.current)},[g,he,T,y]),p.useEffect(()=>{if(m&&g&&Ee.domReference&&Ee.floating)return Yt(Ee.domReference,Ee.floating,Le,Qe)},[m,g,Ee,Le,Qe]);const Se=te(wt),Pt=Cn(o,Se,I),Ot=be(wt)||"center",At=!!ye.hide?.referenceHidden;z(()=>{E&&g&&Ce&&S(Se)},[E,g,Ce,Se]);const Mt=p.useMemo(()=>({position:"absolute",top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Lt=ye.arrow?.centerOffset!==0;return p.useMemo(()=>({positionerStyles:Tt,arrowStyles:Mt,arrowRef:_,arrowUncentered:Lt,side:Pt,align:Ot,physicalSide:Se,anchorHidden:At,refs:he,context:bt,isPositioned:Ce,update:Le}),[Tt,Mt,_,Lt,Pt,Ot,Se,At,he,bt,Ce,Le])}function zt(t){return t!=null&&"current"in t}const Sn=p.createContext(void 0);function Ge(t){const e=p.useContext(Sn);if(e===void 0&&!t)throw new Error(Ue(72));return e}const Or={...Yn,disabled:me(t=>t.disabled),instantType:me(t=>t.instantType),isInstantPhase:me(t=>t.isInstantPhase),trackCursorAxis:me(t=>t.trackCursorAxis),disableHoverablePopup:me(t=>t.disableHoverablePopup),lastOpenChangeReason:me(t=>t.openChangeReason),closeDelay:me(t=>t.closeDelay),hasViewport:me(t=>t.hasViewport)};class mt extends Nn{constructor(e){super({...Ar(),...e},{popupRef:p.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Jt},Or)}setOpen=(e,n)=>{const o=n.reason,r=o===ce,s=e&&o===Fe,i=!e&&(o===rn||o===sn);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,n),n.isCanceled)return;const c=()=>{const a={open:e,openChangeReason:o};s?a.instantType="focus":i?a.instantType="dismiss":o===ce&&(a.instantType=void 0);const d=n.trigger?.id??null;(d||e)&&(a.activeTriggerId=d,a.activeTriggerElement=n.trigger??null),this.update(a)};r?_e.flushSync(c):c()};static useStore(e,n){const o=qt(()=>new mt(n)).current,r=e??o,s=Xn({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=s,r}}function Ar(){return{..._n(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}function Mr(t){const{disabled:e=!1,defaultOpen:n=!1,open:o,disableHoverablePopup:r=!1,trackCursorAxis:s="none",actionsRef:i,onOpenChange:c,onOpenChangeComplete:a,handle:d,triggerId:u,defaultTriggerId:f=null,children:m}=t,l=mt.useStore(d?.store,{open:o??n,activeTriggerId:u!==void 0?u:f});l.useControlledProp("open",o,n),l.useControlledProp("activeTriggerId",u,f),l.useContextCallback("onOpenChange",c),l.useContextCallback("onOpenChangeComplete",a);const g=l.useState("open"),h=!e&&g,R=l.useState("activeTriggerId"),x=l.useState("payload");l.useSyncedValues({trackCursorAxis:s,disableHoverablePopup:r}),z(()=>{g&&e&&l.setOpen(!1,K(so))},[g,e,l]),l.useSyncedValue("disabled",e),Un(l);const{forceUnmount:v,transitionStatus:E}=zn(h,l),C=l.useState("isInstantPhase"),P=l.useState("instantType"),S=l.useState("lastOpenChangeReason"),b=p.useRef(null);z(()=>{E==="ending"&&S===tn||E!=="ending"&&C?(P!=="delay"&&(b.current=P),l.set("instantType","delay")):b.current!==null&&(l.set("instantType",b.current),b.current=null)},[E,C,S,P,l]),z(()=>{h&&R==null&&l.set("payload",void 0)},[l,R,h]);const O=p.useCallback(()=>{l.setOpen(!1,Lr(l,io))},[l]);p.useImperativeHandle(i,()=>({unmount:v,close:O}),[v,O]);const F=l.useState("floatingRootContext"),M=gr(F,{enabled:!e}),k=qn(F,{enabled:!e,referencePress:!0}),T=Eo(F,{enabled:!e&&s!=="none",axis:s==="none"?void 0:s}),{getReferenceProps:y,getFloatingProps:D,getTriggerProps:I}=Kn([M,k,T]),H=p.useMemo(()=>y(),[y]),A=p.useMemo(()=>I(),[I]),w=p.useMemo(()=>D(),[D]);return l.useSyncedValues({activeTriggerProps:H,inactiveTriggerProps:A,popupProps:w}),G.jsx(Sn.Provider,{value:l,children:typeof m=="function"?m({payload:x}):m})}function Lr(t,e){const n=K(e);return n.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},n}const Tn=p.createContext(void 0);function Dr(){return p.useContext(Tn)}const Ir=600,kr=p.forwardRef(function(e,n){const{className:o,render:r,handle:s,payload:i,disabled:c,delay:a,closeDelay:d,id:u,...f}=e,m=Ge(!0),l=s?.store??m;if(!l)throw new Error(Ue(82));const g=co(u),h=l.useState("isTriggerActive",g),R=l.useState("isOpenedByTrigger",g),x=l.useState("floatingRootContext"),v=p.useRef(null),E=a??Ir,C=d??0,{registerTrigger:P,isMountedByThisTrigger:S}=Gn(g,v,l,{payload:i,closeDelay:C}),b=Dr(),{delayRef:O,isInstantPhase:F,hasProvider:M}=wo(x,{open:R});l.useSyncedValue("isInstantPhase",F);const k=l.useState("disabled"),T=c??k,y=l.useState("trackCursorAxis"),D=l.useState("disableHoverablePopup"),I=Rr(x,{enabled:!T,mouseOnly:!0,move:!1,handleClose:!D&&y!=="both"?br():null,restMs(){const L=b?.delay,W=typeof O.current=="object"?O.current.open:void 0;let V=E;return M&&(W!==0?V=a??L??E:V=0),V},delay(){const L=typeof O.current=="object"?O.current.close:void 0;let W=C;return d==null&&M&&(W=L),{close:W}},triggerElementRef:v,isActiveTrigger:h}),H=p.useMemo(()=>({open:R}),[R]),A=l.useState("triggerProps",S);return lt("button",e,{state:H,ref:[n,P,v],props:[I,A,{id:g},f],stateAttributesMapping:Qn})}),Pn=p.createContext(void 0);function Fr(){const t=p.useContext(Pn);if(t===void 0)throw new Error(Ue(70));return t}const Hr=p.forwardRef(function(e,n){const{children:o,container:r,className:s,render:i,...c}=e,{portalNode:a,portalSubtree:d}=Jn({container:r,ref:n,componentProps:e,elementProps:c});return!d&&!a?null:G.jsxs(p.Fragment,{children:[d,a&&_e.createPortal(o,a)]})}),Br=p.forwardRef(function(e,n){const{keepMounted:o=!1,...r}=e;return Ge().useState("mounted")||o?G.jsx(Pn.Provider,{value:o,children:G.jsx(Hr,{ref:n,...r})}):null}),On=p.createContext(void 0);function Vr(){const t=p.useContext(On);if(t===void 0)throw new Error(Ue(71));return t}const $r=p.forwardRef(function(e,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:c="top",align:a="center",sideOffset:d=0,alignOffset:u=0,collisionBoundary:f="clipping-ancestors",collisionPadding:m=5,arrowPadding:l=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:R=Zn,...x}=e,v=Ge(),E=Fr(),C=v.useState("open"),P=v.useState("mounted"),S=v.useState("trackCursorAxis"),b=v.useState("disableHoverablePopup"),O=v.useState("floatingRootContext"),F=v.useState("instantType"),M=v.useState("transitionStatus"),k=v.useState("hasViewport"),T=Pr({anchor:s,positionMethod:i,floatingRootContext:O,mounted:P,side:c,sideOffset:d,align:a,alignOffset:u,collisionBoundary:f,collisionPadding:m,sticky:g,arrowPadding:l,disableAnchorTracking:h,keepMounted:E,collisionAvoidance:R,adaptiveOrigin:k?Tr:void 0}),y=p.useMemo(()=>{const A={};return(!C||S==="both"||b)&&(A.pointerEvents="none"),{role:"presentation",hidden:!P,style:{...T.positionerStyles,...A}}},[C,S,b,P,T.positionerStyles]),D=p.useMemo(()=>({open:C,side:T.side,align:T.align,anchorHidden:T.anchorHidden,instant:S!=="none"?"tracking-cursor":F}),[C,T.side,T.align,T.anchorHidden,S,F]),I=p.useMemo(()=>({...D,arrowRef:T.arrowRef,arrowStyles:T.arrowStyles,arrowUncentered:T.arrowUncentered}),[D,T.arrowRef,T.arrowStyles,T.arrowUncentered]),H=lt("div",e,{state:D,props:[y,En(M),x],ref:[n,v.useStateSetter("positionerElement")],stateAttributesMapping:en});return G.jsx(On.Provider,{value:I,children:H})}),Wr={...en,...to},jr=p.forwardRef(function(e,n){const{className:o,render:r,...s}=e,i=Ge(),{side:c,align:a}=Vr(),d=i.useState("open"),u=i.useState("instantType"),f=i.useState("transitionStatus"),m=i.useState("popupProps"),l=i.useState("floatingRootContext");eo({open:d,ref:i.context.popupRef,onComplete(){d&&i.context.onOpenChangeComplete?.(!0)}});const g=i.useState("disabled"),h=i.useState("closeDelay");yr(l,{enabled:!g,closeDelay:h});const R=p.useMemo(()=>({open:d,side:c,align:a,instant:u,transitionStatus:f}),[d,c,a,u,f]);return lt("div",e,{state:R,ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],props:[m,En(f),s],stateAttributesMapping:Wr})}),Nr=function(e){const{delay:n,closeDelay:o,timeout:r=400}=e,s=p.useMemo(()=>({delay:n,closeDelay:o}),[n,o]),i=p.useMemo(()=>({open:n,close:o}),[n,o]);return G.jsx(Tn.Provider,{value:s,children:G.jsx(Ro,{delay:i,timeoutMs:r,children:e.children})})};function Qr({children:t}){return G.jsx(Nr,{delay:0,closeDelay:0,timeout:0,children:t})}function Jr({children:t,...e}){return G.jsx(Mr,{...e,children:t})}function Zr({className:t,...e}){return G.jsx(kr,{className:Kt(t),...e})}function es({className:t,side:e="top",children:n}){return G.jsx(Br,{children:G.jsx($r,{side:e,children:G.jsx(jr,{className:Kt("rounded-md border border-primary-900 bg-primary-950 px-2 py-1 text-xs text-primary-50 shadow-sm",t),children:n})})})}export{Qr as T,Jr as a,Zr as b,es as c,dn as d,En as e,Pr as f,Kr as g,Rr as h,br as i,gr as j,Gr as s,yr as u};
@@ -1,4 +1,4 @@
1
- import{r as a,j as M}from"./main-DBmooBKx.js";import{af as ht,E as Be,ab as yt,ac as Ze,ag as re,ai as vt,C as St,c as pe,B as Et}from"./button-DdG8c-XQ.js";import{u as oe,z as ge,A as et,B as tt,a as Q,i as te,m as xt,o as Ct,g as we,j as Rt,h as wt,p as kt,v as Tt,f as It,D as Ft,d as nt}from"./useBaseUiId-Ckx_aJky.js";import{o as ie,p as ot,q as Ot,k as U,j as je,h as Re,d as ne,e as L,m as Pt,n as Mt,s as Dt,l as se}from"./event-Dwf9IDxK.js";import{E as Ve,G as Lt,b as ce,d as At,H as Nt,a as We,u as Bt,I as st,J as ke,K as Ge,L as $e,M as X,N as Ye,B as qe,x as He,z as jt,O as Vt,Q as rt,S as Wt,U as Gt,c as $t,m as Yt,n as qt,o as Ht,q as Ut,r as Xt,R as Kt,g as zt,h as _t,k as Jt,i as H,p as it,t as at,V as ue,e as Qt,F as Zt}from"./popupStateMapping-CGDLUl5Y.js";import{C as en}from"./composite-Cx-QHT9o.js";import{a as tn}from"./visuallyHidden-COI6QeQH.js";import{c as nn}from"./react-dSDkXQu6.js";let Ue={},Xe={},Ke="";function on(e){if(typeof document>"u")return!1;const n=ie(e);return ge(n).innerWidth-n.documentElement.clientWidth>0}function sn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const o=ie(e).documentElement,s={scrollbarGutter:o.style.scrollbarGutter,overflowY:o.style.overflowY};o.style.scrollbarGutter="stable",o.style.overflowY="scroll";const i=o.offsetWidth;o.style.overflowY="hidden";const l=o.offsetWidth;return Object.assign(o.style,s),i===l}function rn(e){const n=ie(e),t=n.documentElement,o=n.body,s=et(t)?t:o,i=s.style.overflow;return s.style.overflow="hidden",()=>{s.style.overflow=i}}function an(e){const n=ie(e),t=n.documentElement,o=n.body,s=ge(t);let i=0,l=0,u=!1;const r=Lt.create();if(Ot&&(s.visualViewport?.scale??1)!==1)return()=>{};function C(){const f=s.getComputedStyle(t),c=s.getComputedStyle(o),v=(f.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";i=t.scrollTop,l=t.scrollLeft,Ue={scrollbarGutter:t.style.scrollbarGutter,overflowY:t.style.overflowY,overflowX:t.style.overflowX},Ke=t.style.scrollBehavior,Xe={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 S=t.scrollHeight>t.clientHeight,b=t.scrollWidth>t.clientWidth,m=f.overflowY==="scroll"||c.overflowY==="scroll",N=f.overflowX==="scroll"||c.overflowX==="scroll",P=Math.max(0,s.innerWidth-o.clientWidth),A=Math.max(0,s.innerHeight-o.clientHeight),Y=parseFloat(c.marginTop)+parseFloat(c.marginBottom),V=parseFloat(c.marginLeft)+parseFloat(c.marginRight),D=et(t)?t:o;if(u=sn(e),u){t.style.scrollbarGutter=v,D.style.overflowY="hidden",D.style.overflowX="hidden";return}Object.assign(t.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(S||m)&&(t.style.overflowY="scroll"),(b||N)&&(t.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:Y||A?`calc(100dvh - ${Y+A}px)`:"100dvh",width:V||P?`calc(100vw - ${V+P}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=i,o.scrollLeft=l,t.setAttribute("data-base-ui-scroll-locked",""),t.style.scrollBehavior="unset"}function R(){Object.assign(t.style,Ue),Object.assign(o.style,Xe),u||(t.scrollTop=i,t.scrollLeft=l,t.removeAttribute("data-base-ui-scroll-locked"),t.style.scrollBehavior=Ke)}function x(){R(),r.request(C)}return C(),s.addEventListener("resize",x),()=>{r.cancel(),R(),typeof s.removeEventListener=="function"&&s.removeEventListener("resize",x)}}class ln{lockCount=0;restore=null;timeoutLock=Ve.create();timeoutUnlock=Ve.create();acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),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(n){if(this.lockCount===0||this.restore!==null)return;const o=ie(n).documentElement,s=ge(o).getComputedStyle(o).overflowY;if(s==="hidden"||s==="clip"){this.restore=ht;return}const i=ot||!on(n);this.restore=i?rn(n):an(n)}}const cn=new ln;function un(e=!0,n=null){oe(()=>{if(e)return cn.acquire(n)},[e,n])}let ze=0;function Ee(e,n={}){const{preventScroll:t=!1,cancelPrevious:o=!0,sync:s=!1}=n;o&&cancelAnimationFrame(ze);const i=()=>e?.focus({preventScroll:t});s?i():ze=requestAnimationFrame(i)}const Z={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function _e(e){return e==="inert"?Z.inert:e==="aria-hidden"?Z["aria-hidden"]:Z.none}let de=new WeakSet,fe={},xe=0;const lt=e=>e&&(e.host||lt(e.parentNode)),dn=(e,n)=>n.map(t=>{if(e.contains(t))return t;const o=lt(t);return e.contains(o)?o:null}).filter(t=>t!=null);function fn(e,n,t,o){const s="data-base-ui-inert",i=o?"inert":t?"aria-hidden":null,l=dn(n,e),u=new Set,r=new Set(l),C=[];fe[s]||(fe[s]=new WeakMap);const R=fe[s];l.forEach(x),f(n),u.clear();function x(c){!c||u.has(c)||(u.add(c),c.parentNode&&x(c.parentNode))}function f(c){!c||r.has(c)||[].forEach.call(c.children,d=>{if(tt(d)!=="script")if(u.has(d))f(d);else{const T=i?d.getAttribute(i):null,v=T!==null&&T!=="false",S=_e(i),b=(S.get(d)||0)+1,m=(R.get(d)||0)+1;S.set(d,b),R.set(d,m),C.push(d),b===1&&v&&de.add(d),m===1&&d.setAttribute(s,""),!v&&i&&d.setAttribute(i,i==="inert"?"":"true")}})}return xe+=1,()=>{C.forEach(c=>{const d=_e(i),v=(d.get(c)||0)-1,S=(R.get(c)||0)-1;d.set(c,v),R.set(c,S),v||(!de.has(c)&&i&&c.removeAttribute(i),de.delete(c)),S||c.removeAttribute(s)}),xe-=1,xe||(Z.inert=new WeakMap,Z["aria-hidden"]=new WeakMap,Z.none=new WeakMap,de=new WeakSet,fe={})}}function pn(e,n=!1,t=!1){const o=U(e[0]).body;return fn(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,n,t)}function gn(e,n){const t=ge(e.target);return e instanceof t.KeyboardEvent?"keyboard":e instanceof t.FocusEvent?n||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof t.MouseEvent?n||(e.detail===0?"keyboard":"mouse"):""}const Je=20;let K=[];function Te(){K=K.filter(e=>e.isConnected)}function mn(e){Te(),e&&tt(e)!=="body"&&(K.push(e),K.length>Je&&(K=K.slice(-Je)))}function Ce(){return Te(),K[K.length-1]}function bn(e){if(!e)return null;const n=ke();return rt(e,n)?e:st(e,n)[0]||e}function hn(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():wt(e).display!=="none"}function Qe(e,n){if(!n.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const t=ke(),s=Gt(e,t).filter(l=>{const u=l.getAttribute("data-tabindex")||"";return rt(l,t)||l.hasAttribute("data-tabindex")&&!u.startsWith("-")}),i=e.getAttribute("tabindex");n.current.includes("floating")||s.length===0?i!=="0"&&e.setAttribute("tabindex","0"):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function yn(e){const{context:n,children:t,disabled:o=!1,order:s=["content"],initialFocus:i=!0,returnFocus:l=!0,restoreFocus:u=!1,modal:r=!0,closeOnFocusOut:C=!0,openInteractionType:R="",getInsideElements:x=()=>[],nextFocusableElement:f,previousFocusableElement:c,beforeContentFocusGuardRef:d,externalTree:T}=e,v="rootStore"in n?n.rootStore:n,S=v.useState("open"),b=v.useState("domReferenceElement"),m=v.useState("floatingElement"),{events:N,dataRef:P}=v.context,A=Q(()=>P.current.floatingContext?.nodeId),Y=Q(x),V=i===!1,D=je(b)&&V,O=ce(s),B=ce(i),q=ce(l),Ie=ce(R),W=At(T),w=Nt(),dt=a.useRef(null),ft=a.useRef(null),G=a.useRef(!1),ae=a.useRef(!1),me=a.useRef(!1),Fe=a.useRef(-1),Oe=a.useRef(""),be=a.useRef(""),he=a.useRef(null),ye=a.useRef(null),pt=Be(he,d,w?.beforeInsideRef),gt=Be(ye,w?.afterInsideRef),Pe=We(),Me=We(),De=Bt(),ve=w!=null,h=Re(m),z=Q((g=h)=>g?st(g,ke()):[]),ee=Q(g=>{const E=z(g);return O.current.map(()=>E).filter(Boolean).flat()});a.useEffect(()=>{if(o||!r)return;function g(I){I.key==="Tab"&&L(h,ne(U(h)))&&z().length===0&&!D&&Dt(I)}const E=U(h);return E.addEventListener("keydown",g),()=>{E.removeEventListener("keydown",g)}},[o,b,h,r,O,D,z,ee]),a.useEffect(()=>{if(o||!m)return;function g(E){const I=se(E),F=z().indexOf(I);F!==-1&&(Fe.current=F)}return m.addEventListener("focusin",g),()=>{m.removeEventListener("focusin",g)}},[o,m,z]),a.useEffect(()=>{if(o||!S)return;const g=U(h);function E(){me.current=!1}function I(F){const p=se(F),y=L(m,p)||L(b,p)||L(w?.portalNode,p);me.current=!y,be.current=F.pointerType||"keyboard"}function k(){be.current="keyboard"}return g.addEventListener("pointerdown",I,!0),g.addEventListener("pointerup",E,!0),g.addEventListener("pointercancel",E,!0),g.addEventListener("keydown",k,!0),()=>{g.removeEventListener("pointerdown",I,!0),g.removeEventListener("pointerup",E,!0),g.removeEventListener("pointercancel",E,!0),g.removeEventListener("keydown",k,!0)}},[o,m,b,h,S,w]),a.useEffect(()=>{if(o||!C)return;function g(){ae.current=!0,Me.start(0,()=>{ae.current=!1})}function E(p){const y=p.relatedTarget,J=p.currentTarget,j=se(p);queueMicrotask(()=>{const le=A(),Ae=v.context.triggerElements,mt=y?.hasAttribute(Ge("focus-guard"))&&[he.current,ye.current,w?.beforeInsideRef.current,w?.afterInsideRef.current,w?.beforeOutsideRef.current,w?.afterOutsideRef.current,X(c),X(f)].includes(y),bt=!(L(b,y)||L(m,y)||L(y,m)||L(w?.portalNode,y)||y!=null&&Ae.hasElement(y)||Ae.hasMatchingElement($=>L($,y))||mt||W&&(Ye(W.nodesRef.current,le).find($=>L($.context?.elements.floating,y)||L($.context?.elements.domReference,y))||$e(W.nodesRef.current,le).find($=>[$.context?.elements.floating,Re($.context?.elements.floating)].includes(y)||$.context?.elements.domReference===y)));if(J===b&&h&&Qe(h,O),u&&J!==b&&!hn(j)&&ne(U(h))===U(h).body){if(te(h)&&(h.focus(),u==="popup")){De.request(()=>{h.focus()});return}const $=Fe.current,Se=z(),Ne=Se[$]||Se[Se.length-1]||h;te(Ne)&&Ne.focus()}if(P.current.insideReactTree){P.current.insideReactTree=!1;return}(D||!r)&&y&&bt&&!ae.current&&(D||y!==Ce())&&(G.current=!0,v.setOpen(!1,we(Rt,p)))})}function I(){me.current||(P.current.insideReactTree=!0,Pe.start(0,()=>{P.current.insideReactTree=!1}))}const k=te(b)?b:null,F=[];if(!(!m&&!k))return k&&(k.addEventListener("focusout",E),k.addEventListener("pointerdown",g),F.push(()=>{k.removeEventListener("focusout",E),k.removeEventListener("pointerdown",g)})),m&&(m.addEventListener("focusout",E),w&&(m.addEventListener("focusout",I,!0),F.push(()=>{m.removeEventListener("focusout",I,!0)})),F.push(()=>{m.removeEventListener("focusout",E)})),()=>{F.forEach(p=>{p()})}},[o,b,m,h,r,W,w,v,C,u,z,D,A,O,P,Pe,Me,De,f,c]),a.useEffect(()=>{if(o||!m||!S)return;const g=Array.from(w?.portalNode?.querySelectorAll(`[${Ge("portal")}]`)||[]),I=(W?$e(W.nodesRef.current,A()):[]).find(p=>je(p.context?.elements.domReference||null))?.context?.elements.domReference,k=[m,I,...g,...Y(),dt.current,ft.current,he.current,ye.current,w?.beforeOutsideRef.current,w?.afterOutsideRef.current,X(c),X(f),D?b:null].filter(p=>p!=null),F=pn(k,r||D);return()=>{F()}},[S,o,b,m,r,O,w,D,W,A,Y,f,c]),oe(()=>{if(!S||o||!te(h))return;const g=U(h),E=ne(g);queueMicrotask(()=>{const I=ee(h),k=B.current,F=typeof k=="function"?k(Ie.current||""):k;if(F===void 0||F===!1)return;let p;F===!0||F===null?p=I[0]||h:p=X(F),p=p||I[0]||h,!L(h,E)&&Ee(p,{preventScroll:p===h})})},[o,S,h,V,ee,B,Ie]),oe(()=>{if(o||!h)return;const g=U(h),E=ne(g);mn(E);function I(p){if(p.open||(Oe.current=gn(p.nativeEvent,be.current)),p.reason===xt&&p.nativeEvent.type==="mouseleave"&&(G.current=!0),p.reason===Ct)if(p.nested)G.current=!1;else if(Pt(p.nativeEvent)||Mt(p.nativeEvent))G.current=!1;else{let y=!1;document.createElement("div").focus({get preventScroll(){return y=!0,!1}}),y?G.current=!1:G.current=!0}}N.on("openchange",I);const k=g.createElement("span");k.setAttribute("tabindex","-1"),k.setAttribute("aria-hidden","true"),Object.assign(k.style,tn),ve&&b&&b.insertAdjacentElement("afterend",k);function F(){const p=q.current;let y=typeof p=="function"?p(Oe.current):p;if(y===void 0||y===!1)return null;if(y===null&&(y=!0),typeof y=="boolean"){const j=b||Ce();return j&&j.isConnected?j:k}const J=b||Ce()||k;return X(y)||J}return()=>{N.off("openchange",I);const p=ne(g),y=L(m,p)||W&&Ye(W.nodesRef.current,A(),!1).some(j=>L(j.context?.elements.floating,p)),J=F();queueMicrotask(()=>{const j=bn(J),le=typeof q.current!="boolean";q.current&&!G.current&&te(j)&&(!(!le&&j!==p&&p!==g.body)||y)&&j.focus({preventScroll:!0}),k.remove()})}},[o,m,h,q,P,N,W,ve,b,A]),a.useEffect(()=>{queueMicrotask(()=>{G.current=!1})},[o]),a.useEffect(()=>{if(o||!S)return;function g(I){se(I)?.closest(`[${Wt}]`)&&(ae.current=!0)}const E=U(h);return E.addEventListener("pointerdown",g,!0),()=>{E.removeEventListener("pointerdown",g,!0)}},[o,S,h]),oe(()=>{if(!o&&w)return w.setFocusManagerState({modal:r,closeOnFocusOut:C,open:S,onOpenChange:v.setOpen,domReference:b}),()=>{w.setFocusManagerState(null)}},[o,w,r,S,v,C,b]),oe(()=>{if(!(o||!h))return Qe(h,O),()=>{queueMicrotask(Te)}},[o,h,O]);const Le=!o&&(r?!D:!0)&&(ve||r);return M.jsxs(a.Fragment,{children:[Le&&M.jsx(qe,{"data-type":"inside",ref:pt,onFocus:g=>{if(r){const E=ee();Ee(E[E.length-1])}else w?.portalNode&&(G.current=!1,He(g,w.portalNode)?jt(b)?.focus():X(c??w.beforeOutsideRef)?.focus())}}),t,Le&&M.jsx(qe,{"data-type":"inside",ref:gt,onFocus:g=>{r?Ee(ee()[0]):w?.portalNode&&(C&&(G.current=!0),He(g,w.portalNode)?Vt(b)?.focus():X(f??w.afterOutsideRef)?.focus())}})]})}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Sn(e,n={}){const t="rootStore"in e?e.rootStore:e,o=t.useState("open"),s=t.useState("floatingId"),i=t.useState("domReferenceElement"),l=t.useState("floatingElement"),{enabled:u=!0,role:r="dialog"}=n,C=kt(),R=i?.id||C,x=a.useMemo(()=>Re(l)?.id||s,[l,s]),f=vn.get(r)??r,d=$t()!=null,T=a.useMemo(()=>f==="tooltip"||r==="label"?yt:{"aria-haspopup":f==="alertdialog"?"dialog":f,"aria-expanded":"false",...f==="listbox"&&{role:"combobox"},...f==="menu"&&d&&{role:"menuitem"},...r==="select"&&{"aria-autocomplete":"none"},...r==="combobox"&&{"aria-autocomplete":"list"}},[f,d,r]),v=a.useMemo(()=>f==="tooltip"||r==="label"?{[`aria-${r==="label"?"labelledby":"describedby"}`]:o?x:void 0}:{...T,"aria-expanded":o?"true":"false","aria-controls":o?x:void 0,...f==="menu"&&{id:R}},[f,x,o,R,r,T]),S=a.useMemo(()=>{const m={id:x,...f&&{role:f}};return f==="tooltip"||r==="label"?m:{...m,...f==="menu"&&{"aria-labelledby":R}}},[f,x,R,r]),b=a.useCallback(({active:m,selected:N})=>{const P={role:"option",...m&&{id:`${x}-fui-option`}};switch(r){case"select":case"combobox":return{...P,"aria-selected":N}}return{}},[x,r]);return a.useMemo(()=>u?{reference:v,floating:S,item:b,trigger:T}:{},[u,v,S,T,b])}function En(e){const n=a.useRef(""),t=a.useCallback(s=>{s.defaultPrevented||(n.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:a.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s&&e(s,s.pointerType),e(s,n.current),n.current=""},[e]),onPointerDown:t}}function xn(e){const[n,t]=a.useState(null),o=Q((u,r)=>{e||t(r||(ot?"touch":""))}),s=a.useCallback(()=>{t(null)},[]),{onClick:i,onPointerDown:l}=En(o);return a.useMemo(()=>({openMethod:n,reset:s,triggerProps:{onClick:i,onPointerDown:l}}),[n,s,i,l])}function Cn(e){const{store:n,parentContext:t,actionsRef:o}=e,s=n.useState("open"),i=n.useState("disablePointerDismissal"),l=n.useState("modal"),u=n.useState("popupElement"),{openMethod:r,triggerProps:C,reset:R}=xn(s);Yt(n);const{forceUnmount:x}=qt(s,n,()=>{R()}),f=Q(O=>{const B=we(O);return B.preventUnmountOnClose=()=>{n.set("preventUnmountingOnClose",!0)},B}),c=a.useCallback(()=>{n.setOpen(!1,f(Tt))},[n,f]);a.useImperativeHandle(o,()=>({unmount:x,close:c}),[x,c]);const d=Ht({popupStore:n,onOpenChange:n.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[T,v]=a.useState(0),S=T===0,b=Sn(d),m=Ut(d,{outsidePressEvent(){return n.context.internalBackdropRef.current||n.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(O){if("button"in O&&O.button!==0||"touches"in O&&O.touches.length!==1)return!1;const B=se(O);if(S&&!i){const q=B;return l&&(n.context.internalBackdropRef.current||n.context.backdropRef.current)?n.context.internalBackdropRef.current===q||n.context.backdropRef.current===q||L(q,u)&&!q?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:S});un(s&&l===!0,u);const{getReferenceProps:N,getFloatingProps:P,getTriggerProps:A}=Xt([b,m]);n.useContextCallback("onNestedDialogOpen",O=>{v(O+1)}),n.useContextCallback("onNestedDialogClose",()=>{v(0)}),a.useEffect(()=>(t?.onNestedDialogOpen&&s&&t.onNestedDialogOpen(T),t?.onNestedDialogClose&&!s&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&s&&t.onNestedDialogClose()}),[s,t,T]);const Y=a.useMemo(()=>N(C),[N,C]),V=a.useMemo(()=>A(C),[A,C]),D=a.useMemo(()=>P(),[P]);n.useSyncedValues({openMethod:r,activeTriggerProps:Y,inactiveTriggerProps:V,popupProps:D,floatingRootContext:d,nestedOpenDialogCount:T})}const ct=a.createContext(void 0);function _(e){const n=a.useContext(ct);if(e===!1&&n===void 0)throw new Error(Ze(27));return n}const Rn={..._t,modal:H(e=>e.modal),nested:H(e=>e.nested),nestedOpenDialogCount:H(e=>e.nestedOpenDialogCount),disablePointerDismissal:H(e=>e.disablePointerDismissal),openMethod:H(e=>e.openMethod),descriptionElementId:H(e=>e.descriptionElementId),titleElementId:H(e=>e.titleElementId),viewportElement:H(e=>e.viewportElement),role:H(e=>e.role)};class wn extends Kt{constructor(n){super(kn(n),{popupRef:a.createRef(),backdropRef:a.createRef(),internalBackdropRef:a.createRef(),triggerElements:new zt,onOpenChange:void 0,onOpenChangeComplete:void 0},Rn)}setOpen=(n,t)=>{if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;const o={open:n,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const s={open:n},i=t.trigger?.id??null;(i||n)&&(s.activeTriggerId=i,s.activeTriggerElement=t.trigger??null),this.update(s)}}function kn(e={}){return{...Jt(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}const Tn={...it,...at},In=a.forwardRef(function(n,t){const{render:o,className:s,forceRender:i=!1,...l}=n,{store:u}=_(),r=u.useState("open"),C=u.useState("nested"),R=u.useState("mounted"),x=u.useState("transitionStatus"),f=a.useMemo(()=>({open:r,transitionStatus:x}),[r,x]);return re("div",n,{state:f,ref:[u.context.backdropRef,t],stateAttributesMapping:Tn,props:[{role:"presentation",hidden:!R,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:i||!C})}),Fn=a.forwardRef(function(n,t){const{render:o,className:s,disabled:i=!1,nativeButton:l=!0,...u}=n,{store:r}=_(),C=r.useState("open");function R(d){C&&r.setOpen(!1,we(Ft,d.nativeEvent))}const{getButtonProps:x,buttonRef:f}=It({disabled:i,native:l}),c=a.useMemo(()=>({disabled:i}),[i]);return re("button",n,{state:c,ref:[t,f],props:[{onClick:R},u,x]})}),On=a.forwardRef(function(n,t){const{render:o,className:s,id:i,...l}=n,{store:u}=_(),r=nt(i);return u.useSyncedValueWithCleanup("descriptionElementId",r),re("p",n,{ref:t,props:[{id:r},l]})});let Pn=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Mn=(function(e){return e[e.open=ue.open]="open",e[e.closed=ue.closed]="closed",e[e.startingStyle=ue.startingStyle]="startingStyle",e[e.endingStyle=ue.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const ut=a.createContext(void 0);function Dn(){const e=a.useContext(ut);if(e===void 0)throw new Error(Ze(26));return e}const Ln={...it,...at,nestedDialogOpen(e){return e?{[Mn.nestedDialogOpen]:""}:null}},An=a.forwardRef(function(n,t){const{className:o,finalFocus:s,initialFocus:i,render:l,...u}=n,{store:r}=_(),C=r.useState("descriptionElementId"),R=r.useState("disablePointerDismissal"),x=r.useState("floatingRootContext"),f=r.useState("popupProps"),c=r.useState("modal"),d=r.useState("mounted"),T=r.useState("nested"),v=r.useState("nestedOpenDialogCount"),S=r.useState("open"),b=r.useState("openMethod"),m=r.useState("titleElementId"),N=r.useState("transitionStatus"),P=r.useState("role");Dn(),Qt({open:S,ref:r.context.popupRef,onComplete(){S&&r.context.onOpenChangeComplete?.(!0)}});function A(B){return B==="touch"?r.context.popupRef.current:!0}const Y=i===void 0?A:i,V=v>0,D=a.useMemo(()=>({open:S,nested:T,transitionStatus:N,nestedDialogOpen:V}),[S,T,N,V]),O=re("div",n,{state:D,props:[f,{"aria-labelledby":m??void 0,"aria-describedby":C??void 0,role:P,tabIndex:-1,hidden:!d,onKeyDown(B){en.has(B.key)&&B.stopPropagation()},style:{[Pn.nestedDialogs]:v}},u],ref:[t,r.context.popupRef,r.useStateSetter("popupElement")],stateAttributesMapping:Ln});return M.jsx(yn,{context:x,openInteractionType:b,disabled:!d,closeOnFocusOut:!R,initialFocus:Y,returnFocus:s,modal:c!==!1,restoreFocus:"popup",children:O})});function Nn(e){return vt(19)?e:e?"true":void 0}const Bn=a.forwardRef(function(n,t){const{cutout:o,...s}=n;let i;if(o){const l=o?.getBoundingClientRect();i=`polygon(
1
+ import{r as a,j as M}from"./main-CQKtcNr3.js";import{af as ht,E as Be,ab as yt,ac as Ze,ag as re,ai as vt,C as St,c as pe,B as Et}from"./button-8ab4wOwy.js";import{u as oe,z as ge,A as et,B as tt,a as Q,i as te,m as xt,o as Ct,g as we,j as Rt,h as wt,p as kt,v as Tt,f as It,D as Ft,d as nt}from"./useBaseUiId-DiwX_3so.js";import{o as ie,p as ot,q as Ot,k as U,j as je,h as Re,d as ne,e as L,m as Pt,n as Mt,s as Dt,l as se}from"./event-DG3RKJz8.js";import{E as Ve,G as Lt,b as ce,d as At,H as Nt,a as We,u as Bt,I as st,J as ke,K as Ge,L as $e,M as X,N as Ye,B as qe,x as He,z as jt,O as Vt,Q as rt,S as Wt,U as Gt,c as $t,m as Yt,n as qt,o as Ht,q as Ut,r as Xt,R as Kt,g as zt,h as _t,k as Jt,i as H,p as it,t as at,V as ue,e as Qt,F as Zt}from"./popupStateMapping-DkI2OCkW.js";import{C as en}from"./composite-B2qsrzf3.js";import{a as tn}from"./visuallyHidden-COI6QeQH.js";import{c as nn}from"./react-WkSlhZJd.js";let Ue={},Xe={},Ke="";function on(e){if(typeof document>"u")return!1;const n=ie(e);return ge(n).innerWidth-n.documentElement.clientWidth>0}function sn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const o=ie(e).documentElement,s={scrollbarGutter:o.style.scrollbarGutter,overflowY:o.style.overflowY};o.style.scrollbarGutter="stable",o.style.overflowY="scroll";const i=o.offsetWidth;o.style.overflowY="hidden";const l=o.offsetWidth;return Object.assign(o.style,s),i===l}function rn(e){const n=ie(e),t=n.documentElement,o=n.body,s=et(t)?t:o,i=s.style.overflow;return s.style.overflow="hidden",()=>{s.style.overflow=i}}function an(e){const n=ie(e),t=n.documentElement,o=n.body,s=ge(t);let i=0,l=0,u=!1;const r=Lt.create();if(Ot&&(s.visualViewport?.scale??1)!==1)return()=>{};function C(){const f=s.getComputedStyle(t),c=s.getComputedStyle(o),v=(f.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";i=t.scrollTop,l=t.scrollLeft,Ue={scrollbarGutter:t.style.scrollbarGutter,overflowY:t.style.overflowY,overflowX:t.style.overflowX},Ke=t.style.scrollBehavior,Xe={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 S=t.scrollHeight>t.clientHeight,b=t.scrollWidth>t.clientWidth,m=f.overflowY==="scroll"||c.overflowY==="scroll",N=f.overflowX==="scroll"||c.overflowX==="scroll",P=Math.max(0,s.innerWidth-o.clientWidth),A=Math.max(0,s.innerHeight-o.clientHeight),Y=parseFloat(c.marginTop)+parseFloat(c.marginBottom),V=parseFloat(c.marginLeft)+parseFloat(c.marginRight),D=et(t)?t:o;if(u=sn(e),u){t.style.scrollbarGutter=v,D.style.overflowY="hidden",D.style.overflowX="hidden";return}Object.assign(t.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(S||m)&&(t.style.overflowY="scroll"),(b||N)&&(t.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:Y||A?`calc(100dvh - ${Y+A}px)`:"100dvh",width:V||P?`calc(100vw - ${V+P}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=i,o.scrollLeft=l,t.setAttribute("data-base-ui-scroll-locked",""),t.style.scrollBehavior="unset"}function R(){Object.assign(t.style,Ue),Object.assign(o.style,Xe),u||(t.scrollTop=i,t.scrollLeft=l,t.removeAttribute("data-base-ui-scroll-locked"),t.style.scrollBehavior=Ke)}function x(){R(),r.request(C)}return C(),s.addEventListener("resize",x),()=>{r.cancel(),R(),typeof s.removeEventListener=="function"&&s.removeEventListener("resize",x)}}class ln{lockCount=0;restore=null;timeoutLock=Ve.create();timeoutUnlock=Ve.create();acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),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(n){if(this.lockCount===0||this.restore!==null)return;const o=ie(n).documentElement,s=ge(o).getComputedStyle(o).overflowY;if(s==="hidden"||s==="clip"){this.restore=ht;return}const i=ot||!on(n);this.restore=i?rn(n):an(n)}}const cn=new ln;function un(e=!0,n=null){oe(()=>{if(e)return cn.acquire(n)},[e,n])}let ze=0;function Ee(e,n={}){const{preventScroll:t=!1,cancelPrevious:o=!0,sync:s=!1}=n;o&&cancelAnimationFrame(ze);const i=()=>e?.focus({preventScroll:t});s?i():ze=requestAnimationFrame(i)}const Z={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function _e(e){return e==="inert"?Z.inert:e==="aria-hidden"?Z["aria-hidden"]:Z.none}let de=new WeakSet,fe={},xe=0;const lt=e=>e&&(e.host||lt(e.parentNode)),dn=(e,n)=>n.map(t=>{if(e.contains(t))return t;const o=lt(t);return e.contains(o)?o:null}).filter(t=>t!=null);function fn(e,n,t,o){const s="data-base-ui-inert",i=o?"inert":t?"aria-hidden":null,l=dn(n,e),u=new Set,r=new Set(l),C=[];fe[s]||(fe[s]=new WeakMap);const R=fe[s];l.forEach(x),f(n),u.clear();function x(c){!c||u.has(c)||(u.add(c),c.parentNode&&x(c.parentNode))}function f(c){!c||r.has(c)||[].forEach.call(c.children,d=>{if(tt(d)!=="script")if(u.has(d))f(d);else{const T=i?d.getAttribute(i):null,v=T!==null&&T!=="false",S=_e(i),b=(S.get(d)||0)+1,m=(R.get(d)||0)+1;S.set(d,b),R.set(d,m),C.push(d),b===1&&v&&de.add(d),m===1&&d.setAttribute(s,""),!v&&i&&d.setAttribute(i,i==="inert"?"":"true")}})}return xe+=1,()=>{C.forEach(c=>{const d=_e(i),v=(d.get(c)||0)-1,S=(R.get(c)||0)-1;d.set(c,v),R.set(c,S),v||(!de.has(c)&&i&&c.removeAttribute(i),de.delete(c)),S||c.removeAttribute(s)}),xe-=1,xe||(Z.inert=new WeakMap,Z["aria-hidden"]=new WeakMap,Z.none=new WeakMap,de=new WeakSet,fe={})}}function pn(e,n=!1,t=!1){const o=U(e[0]).body;return fn(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,n,t)}function gn(e,n){const t=ge(e.target);return e instanceof t.KeyboardEvent?"keyboard":e instanceof t.FocusEvent?n||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof t.MouseEvent?n||(e.detail===0?"keyboard":"mouse"):""}const Je=20;let K=[];function Te(){K=K.filter(e=>e.isConnected)}function mn(e){Te(),e&&tt(e)!=="body"&&(K.push(e),K.length>Je&&(K=K.slice(-Je)))}function Ce(){return Te(),K[K.length-1]}function bn(e){if(!e)return null;const n=ke();return rt(e,n)?e:st(e,n)[0]||e}function hn(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():wt(e).display!=="none"}function Qe(e,n){if(!n.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const t=ke(),s=Gt(e,t).filter(l=>{const u=l.getAttribute("data-tabindex")||"";return rt(l,t)||l.hasAttribute("data-tabindex")&&!u.startsWith("-")}),i=e.getAttribute("tabindex");n.current.includes("floating")||s.length===0?i!=="0"&&e.setAttribute("tabindex","0"):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function yn(e){const{context:n,children:t,disabled:o=!1,order:s=["content"],initialFocus:i=!0,returnFocus:l=!0,restoreFocus:u=!1,modal:r=!0,closeOnFocusOut:C=!0,openInteractionType:R="",getInsideElements:x=()=>[],nextFocusableElement:f,previousFocusableElement:c,beforeContentFocusGuardRef:d,externalTree:T}=e,v="rootStore"in n?n.rootStore:n,S=v.useState("open"),b=v.useState("domReferenceElement"),m=v.useState("floatingElement"),{events:N,dataRef:P}=v.context,A=Q(()=>P.current.floatingContext?.nodeId),Y=Q(x),V=i===!1,D=je(b)&&V,O=ce(s),B=ce(i),q=ce(l),Ie=ce(R),W=At(T),w=Nt(),dt=a.useRef(null),ft=a.useRef(null),G=a.useRef(!1),ae=a.useRef(!1),me=a.useRef(!1),Fe=a.useRef(-1),Oe=a.useRef(""),be=a.useRef(""),he=a.useRef(null),ye=a.useRef(null),pt=Be(he,d,w?.beforeInsideRef),gt=Be(ye,w?.afterInsideRef),Pe=We(),Me=We(),De=Bt(),ve=w!=null,h=Re(m),z=Q((g=h)=>g?st(g,ke()):[]),ee=Q(g=>{const E=z(g);return O.current.map(()=>E).filter(Boolean).flat()});a.useEffect(()=>{if(o||!r)return;function g(I){I.key==="Tab"&&L(h,ne(U(h)))&&z().length===0&&!D&&Dt(I)}const E=U(h);return E.addEventListener("keydown",g),()=>{E.removeEventListener("keydown",g)}},[o,b,h,r,O,D,z,ee]),a.useEffect(()=>{if(o||!m)return;function g(E){const I=se(E),F=z().indexOf(I);F!==-1&&(Fe.current=F)}return m.addEventListener("focusin",g),()=>{m.removeEventListener("focusin",g)}},[o,m,z]),a.useEffect(()=>{if(o||!S)return;const g=U(h);function E(){me.current=!1}function I(F){const p=se(F),y=L(m,p)||L(b,p)||L(w?.portalNode,p);me.current=!y,be.current=F.pointerType||"keyboard"}function k(){be.current="keyboard"}return g.addEventListener("pointerdown",I,!0),g.addEventListener("pointerup",E,!0),g.addEventListener("pointercancel",E,!0),g.addEventListener("keydown",k,!0),()=>{g.removeEventListener("pointerdown",I,!0),g.removeEventListener("pointerup",E,!0),g.removeEventListener("pointercancel",E,!0),g.removeEventListener("keydown",k,!0)}},[o,m,b,h,S,w]),a.useEffect(()=>{if(o||!C)return;function g(){ae.current=!0,Me.start(0,()=>{ae.current=!1})}function E(p){const y=p.relatedTarget,J=p.currentTarget,j=se(p);queueMicrotask(()=>{const le=A(),Ae=v.context.triggerElements,mt=y?.hasAttribute(Ge("focus-guard"))&&[he.current,ye.current,w?.beforeInsideRef.current,w?.afterInsideRef.current,w?.beforeOutsideRef.current,w?.afterOutsideRef.current,X(c),X(f)].includes(y),bt=!(L(b,y)||L(m,y)||L(y,m)||L(w?.portalNode,y)||y!=null&&Ae.hasElement(y)||Ae.hasMatchingElement($=>L($,y))||mt||W&&(Ye(W.nodesRef.current,le).find($=>L($.context?.elements.floating,y)||L($.context?.elements.domReference,y))||$e(W.nodesRef.current,le).find($=>[$.context?.elements.floating,Re($.context?.elements.floating)].includes(y)||$.context?.elements.domReference===y)));if(J===b&&h&&Qe(h,O),u&&J!==b&&!hn(j)&&ne(U(h))===U(h).body){if(te(h)&&(h.focus(),u==="popup")){De.request(()=>{h.focus()});return}const $=Fe.current,Se=z(),Ne=Se[$]||Se[Se.length-1]||h;te(Ne)&&Ne.focus()}if(P.current.insideReactTree){P.current.insideReactTree=!1;return}(D||!r)&&y&&bt&&!ae.current&&(D||y!==Ce())&&(G.current=!0,v.setOpen(!1,we(Rt,p)))})}function I(){me.current||(P.current.insideReactTree=!0,Pe.start(0,()=>{P.current.insideReactTree=!1}))}const k=te(b)?b:null,F=[];if(!(!m&&!k))return k&&(k.addEventListener("focusout",E),k.addEventListener("pointerdown",g),F.push(()=>{k.removeEventListener("focusout",E),k.removeEventListener("pointerdown",g)})),m&&(m.addEventListener("focusout",E),w&&(m.addEventListener("focusout",I,!0),F.push(()=>{m.removeEventListener("focusout",I,!0)})),F.push(()=>{m.removeEventListener("focusout",E)})),()=>{F.forEach(p=>{p()})}},[o,b,m,h,r,W,w,v,C,u,z,D,A,O,P,Pe,Me,De,f,c]),a.useEffect(()=>{if(o||!m||!S)return;const g=Array.from(w?.portalNode?.querySelectorAll(`[${Ge("portal")}]`)||[]),I=(W?$e(W.nodesRef.current,A()):[]).find(p=>je(p.context?.elements.domReference||null))?.context?.elements.domReference,k=[m,I,...g,...Y(),dt.current,ft.current,he.current,ye.current,w?.beforeOutsideRef.current,w?.afterOutsideRef.current,X(c),X(f),D?b:null].filter(p=>p!=null),F=pn(k,r||D);return()=>{F()}},[S,o,b,m,r,O,w,D,W,A,Y,f,c]),oe(()=>{if(!S||o||!te(h))return;const g=U(h),E=ne(g);queueMicrotask(()=>{const I=ee(h),k=B.current,F=typeof k=="function"?k(Ie.current||""):k;if(F===void 0||F===!1)return;let p;F===!0||F===null?p=I[0]||h:p=X(F),p=p||I[0]||h,!L(h,E)&&Ee(p,{preventScroll:p===h})})},[o,S,h,V,ee,B,Ie]),oe(()=>{if(o||!h)return;const g=U(h),E=ne(g);mn(E);function I(p){if(p.open||(Oe.current=gn(p.nativeEvent,be.current)),p.reason===xt&&p.nativeEvent.type==="mouseleave"&&(G.current=!0),p.reason===Ct)if(p.nested)G.current=!1;else if(Pt(p.nativeEvent)||Mt(p.nativeEvent))G.current=!1;else{let y=!1;document.createElement("div").focus({get preventScroll(){return y=!0,!1}}),y?G.current=!1:G.current=!0}}N.on("openchange",I);const k=g.createElement("span");k.setAttribute("tabindex","-1"),k.setAttribute("aria-hidden","true"),Object.assign(k.style,tn),ve&&b&&b.insertAdjacentElement("afterend",k);function F(){const p=q.current;let y=typeof p=="function"?p(Oe.current):p;if(y===void 0||y===!1)return null;if(y===null&&(y=!0),typeof y=="boolean"){const j=b||Ce();return j&&j.isConnected?j:k}const J=b||Ce()||k;return X(y)||J}return()=>{N.off("openchange",I);const p=ne(g),y=L(m,p)||W&&Ye(W.nodesRef.current,A(),!1).some(j=>L(j.context?.elements.floating,p)),J=F();queueMicrotask(()=>{const j=bn(J),le=typeof q.current!="boolean";q.current&&!G.current&&te(j)&&(!(!le&&j!==p&&p!==g.body)||y)&&j.focus({preventScroll:!0}),k.remove()})}},[o,m,h,q,P,N,W,ve,b,A]),a.useEffect(()=>{queueMicrotask(()=>{G.current=!1})},[o]),a.useEffect(()=>{if(o||!S)return;function g(I){se(I)?.closest(`[${Wt}]`)&&(ae.current=!0)}const E=U(h);return E.addEventListener("pointerdown",g,!0),()=>{E.removeEventListener("pointerdown",g,!0)}},[o,S,h]),oe(()=>{if(!o&&w)return w.setFocusManagerState({modal:r,closeOnFocusOut:C,open:S,onOpenChange:v.setOpen,domReference:b}),()=>{w.setFocusManagerState(null)}},[o,w,r,S,v,C,b]),oe(()=>{if(!(o||!h))return Qe(h,O),()=>{queueMicrotask(Te)}},[o,h,O]);const Le=!o&&(r?!D:!0)&&(ve||r);return M.jsxs(a.Fragment,{children:[Le&&M.jsx(qe,{"data-type":"inside",ref:pt,onFocus:g=>{if(r){const E=ee();Ee(E[E.length-1])}else w?.portalNode&&(G.current=!1,He(g,w.portalNode)?jt(b)?.focus():X(c??w.beforeOutsideRef)?.focus())}}),t,Le&&M.jsx(qe,{"data-type":"inside",ref:gt,onFocus:g=>{r?Ee(ee()[0]):w?.portalNode&&(C&&(G.current=!0),He(g,w.portalNode)?Vt(b)?.focus():X(f??w.afterOutsideRef)?.focus())}})]})}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Sn(e,n={}){const t="rootStore"in e?e.rootStore:e,o=t.useState("open"),s=t.useState("floatingId"),i=t.useState("domReferenceElement"),l=t.useState("floatingElement"),{enabled:u=!0,role:r="dialog"}=n,C=kt(),R=i?.id||C,x=a.useMemo(()=>Re(l)?.id||s,[l,s]),f=vn.get(r)??r,d=$t()!=null,T=a.useMemo(()=>f==="tooltip"||r==="label"?yt:{"aria-haspopup":f==="alertdialog"?"dialog":f,"aria-expanded":"false",...f==="listbox"&&{role:"combobox"},...f==="menu"&&d&&{role:"menuitem"},...r==="select"&&{"aria-autocomplete":"none"},...r==="combobox"&&{"aria-autocomplete":"list"}},[f,d,r]),v=a.useMemo(()=>f==="tooltip"||r==="label"?{[`aria-${r==="label"?"labelledby":"describedby"}`]:o?x:void 0}:{...T,"aria-expanded":o?"true":"false","aria-controls":o?x:void 0,...f==="menu"&&{id:R}},[f,x,o,R,r,T]),S=a.useMemo(()=>{const m={id:x,...f&&{role:f}};return f==="tooltip"||r==="label"?m:{...m,...f==="menu"&&{"aria-labelledby":R}}},[f,x,R,r]),b=a.useCallback(({active:m,selected:N})=>{const P={role:"option",...m&&{id:`${x}-fui-option`}};switch(r){case"select":case"combobox":return{...P,"aria-selected":N}}return{}},[x,r]);return a.useMemo(()=>u?{reference:v,floating:S,item:b,trigger:T}:{},[u,v,S,T,b])}function En(e){const n=a.useRef(""),t=a.useCallback(s=>{s.defaultPrevented||(n.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:a.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s&&e(s,s.pointerType),e(s,n.current),n.current=""},[e]),onPointerDown:t}}function xn(e){const[n,t]=a.useState(null),o=Q((u,r)=>{e||t(r||(ot?"touch":""))}),s=a.useCallback(()=>{t(null)},[]),{onClick:i,onPointerDown:l}=En(o);return a.useMemo(()=>({openMethod:n,reset:s,triggerProps:{onClick:i,onPointerDown:l}}),[n,s,i,l])}function Cn(e){const{store:n,parentContext:t,actionsRef:o}=e,s=n.useState("open"),i=n.useState("disablePointerDismissal"),l=n.useState("modal"),u=n.useState("popupElement"),{openMethod:r,triggerProps:C,reset:R}=xn(s);Yt(n);const{forceUnmount:x}=qt(s,n,()=>{R()}),f=Q(O=>{const B=we(O);return B.preventUnmountOnClose=()=>{n.set("preventUnmountingOnClose",!0)},B}),c=a.useCallback(()=>{n.setOpen(!1,f(Tt))},[n,f]);a.useImperativeHandle(o,()=>({unmount:x,close:c}),[x,c]);const d=Ht({popupStore:n,onOpenChange:n.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[T,v]=a.useState(0),S=T===0,b=Sn(d),m=Ut(d,{outsidePressEvent(){return n.context.internalBackdropRef.current||n.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(O){if("button"in O&&O.button!==0||"touches"in O&&O.touches.length!==1)return!1;const B=se(O);if(S&&!i){const q=B;return l&&(n.context.internalBackdropRef.current||n.context.backdropRef.current)?n.context.internalBackdropRef.current===q||n.context.backdropRef.current===q||L(q,u)&&!q?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:S});un(s&&l===!0,u);const{getReferenceProps:N,getFloatingProps:P,getTriggerProps:A}=Xt([b,m]);n.useContextCallback("onNestedDialogOpen",O=>{v(O+1)}),n.useContextCallback("onNestedDialogClose",()=>{v(0)}),a.useEffect(()=>(t?.onNestedDialogOpen&&s&&t.onNestedDialogOpen(T),t?.onNestedDialogClose&&!s&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&s&&t.onNestedDialogClose()}),[s,t,T]);const Y=a.useMemo(()=>N(C),[N,C]),V=a.useMemo(()=>A(C),[A,C]),D=a.useMemo(()=>P(),[P]);n.useSyncedValues({openMethod:r,activeTriggerProps:Y,inactiveTriggerProps:V,popupProps:D,floatingRootContext:d,nestedOpenDialogCount:T})}const ct=a.createContext(void 0);function _(e){const n=a.useContext(ct);if(e===!1&&n===void 0)throw new Error(Ze(27));return n}const Rn={..._t,modal:H(e=>e.modal),nested:H(e=>e.nested),nestedOpenDialogCount:H(e=>e.nestedOpenDialogCount),disablePointerDismissal:H(e=>e.disablePointerDismissal),openMethod:H(e=>e.openMethod),descriptionElementId:H(e=>e.descriptionElementId),titleElementId:H(e=>e.titleElementId),viewportElement:H(e=>e.viewportElement),role:H(e=>e.role)};class wn extends Kt{constructor(n){super(kn(n),{popupRef:a.createRef(),backdropRef:a.createRef(),internalBackdropRef:a.createRef(),triggerElements:new zt,onOpenChange:void 0,onOpenChangeComplete:void 0},Rn)}setOpen=(n,t)=>{if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;const o={open:n,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const s={open:n},i=t.trigger?.id??null;(i||n)&&(s.activeTriggerId=i,s.activeTriggerElement=t.trigger??null),this.update(s)}}function kn(e={}){return{...Jt(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}const Tn={...it,...at},In=a.forwardRef(function(n,t){const{render:o,className:s,forceRender:i=!1,...l}=n,{store:u}=_(),r=u.useState("open"),C=u.useState("nested"),R=u.useState("mounted"),x=u.useState("transitionStatus"),f=a.useMemo(()=>({open:r,transitionStatus:x}),[r,x]);return re("div",n,{state:f,ref:[u.context.backdropRef,t],stateAttributesMapping:Tn,props:[{role:"presentation",hidden:!R,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:i||!C})}),Fn=a.forwardRef(function(n,t){const{render:o,className:s,disabled:i=!1,nativeButton:l=!0,...u}=n,{store:r}=_(),C=r.useState("open");function R(d){C&&r.setOpen(!1,we(Ft,d.nativeEvent))}const{getButtonProps:x,buttonRef:f}=It({disabled:i,native:l}),c=a.useMemo(()=>({disabled:i}),[i]);return re("button",n,{state:c,ref:[t,f],props:[{onClick:R},u,x]})}),On=a.forwardRef(function(n,t){const{render:o,className:s,id:i,...l}=n,{store:u}=_(),r=nt(i);return u.useSyncedValueWithCleanup("descriptionElementId",r),re("p",n,{ref:t,props:[{id:r},l]})});let Pn=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Mn=(function(e){return e[e.open=ue.open]="open",e[e.closed=ue.closed]="closed",e[e.startingStyle=ue.startingStyle]="startingStyle",e[e.endingStyle=ue.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const ut=a.createContext(void 0);function Dn(){const e=a.useContext(ut);if(e===void 0)throw new Error(Ze(26));return e}const Ln={...it,...at,nestedDialogOpen(e){return e?{[Mn.nestedDialogOpen]:""}:null}},An=a.forwardRef(function(n,t){const{className:o,finalFocus:s,initialFocus:i,render:l,...u}=n,{store:r}=_(),C=r.useState("descriptionElementId"),R=r.useState("disablePointerDismissal"),x=r.useState("floatingRootContext"),f=r.useState("popupProps"),c=r.useState("modal"),d=r.useState("mounted"),T=r.useState("nested"),v=r.useState("nestedOpenDialogCount"),S=r.useState("open"),b=r.useState("openMethod"),m=r.useState("titleElementId"),N=r.useState("transitionStatus"),P=r.useState("role");Dn(),Qt({open:S,ref:r.context.popupRef,onComplete(){S&&r.context.onOpenChangeComplete?.(!0)}});function A(B){return B==="touch"?r.context.popupRef.current:!0}const Y=i===void 0?A:i,V=v>0,D=a.useMemo(()=>({open:S,nested:T,transitionStatus:N,nestedDialogOpen:V}),[S,T,N,V]),O=re("div",n,{state:D,props:[f,{"aria-labelledby":m??void 0,"aria-describedby":C??void 0,role:P,tabIndex:-1,hidden:!d,onKeyDown(B){en.has(B.key)&&B.stopPropagation()},style:{[Pn.nestedDialogs]:v}},u],ref:[t,r.context.popupRef,r.useStateSetter("popupElement")],stateAttributesMapping:Ln});return M.jsx(yn,{context:x,openInteractionType:b,disabled:!d,closeOnFocusOut:!R,initialFocus:Y,returnFocus:s,modal:c!==!1,restoreFocus:"popup",children:O})});function Nn(e){return vt(19)?e:e?"true":void 0}const Bn=a.forwardRef(function(n,t){const{cutout:o,...s}=n;let i;if(o){const l=o?.getBoundingClientRect();i=`polygon(
2
2
  0% 0%,
3
3
  100% 0%,
4
4
  100% 100%,
@@ -1 +1 @@
1
- import{C as V,ab as _,ac as Y,ad as j,ae as D}from"./button-DdG8c-XQ.js";import{r as l,v as x}from"./main-DBmooBKx.js";const g=x[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],G=g&&g!==l.useLayoutEffect?g:e=>e();function k(e){const t=V(J).current;return t.next=e,G(t.effect),t.trampoline}function J(){const e={next:void 0,callback:X,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function X(){}function m(){return typeof window<"u"}function E(e){return I(e)?(e.nodeName||"").toLowerCase():"#document"}function d(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function q(e){var t;return(t=(I(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function I(e){return m()?e instanceof Node||e instanceof d(e).Node:!1}function T(e){return m()?e instanceof Element||e instanceof d(e).Element:!1}function h(e){return m()?e instanceof HTMLElement||e instanceof d(e).HTMLElement:!1}function N(e){return!m()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof d(e).ShadowRoot}const z=new Set(["inline","contents"]);function L(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=O(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!z.has(s)}const Q=new Set(["table","td","th"]);function he(e){return Q.has(E(e))}const Z=[":popover-open",":modal"];function ee(e){return Z.some(t=>{try{return e.matches(t)}catch{return!1}})}const te=["transform","translate","scale","rotate","perspective"],ne=["transform","translate","scale","rotate","perspective","filter"],oe=["paint","layout","strict","content"];function se(e){const t=re(),n=T(e)?O(e):e;return te.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ne.some(r=>(n.willChange||"").includes(r))||oe.some(r=>(n.contain||"").includes(r))}function Ce(e){let t=y(e);for(;h(t)&&!B(t);){if(se(t))return t;if(ee(t))return null;t=y(t)}return null}function re(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ae=new Set(["html","body","#document"]);function B(e){return ae.has(E(e))}function O(e){return d(e).getComputedStyle(e)}function De(e){return T(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function y(e){if(E(e)==="html")return e;const t=e.assignedSlot||e.parentNode||N(e)&&e.host||q(e);return N(t)?t.host:t}function R(e){const t=y(e);return B(t)?e.ownerDocument?e.ownerDocument.body:e.body:h(t)&&L(t)?t:R(t)}function S(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=R(e),a=s===((r=e.ownerDocument)==null?void 0:r.body),i=d(s);if(a){const u=ie(i);return t.concat(i,i.visualViewport||[],L(s)?s:[],u&&n?S(u):[])}return t.concat(s,S(s,[],n))}function ie(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const ce=()=>{},le=typeof document<"u"?l.useLayoutEffect:ce,ue={...x};let P=0;function fe(e,t="mui"){const[n,r]=l.useState(e),s=e||n;return l.useEffect(()=>{n==null&&(P+=1,r(`${t}-${P}`))},[n,t]),s}const v=ue.useId;function de(e,t){if(v!==void 0){const n=v();return e??(t?`${t}-${n}`:n)}return fe(e,t)}const ke="none",Ne="trigger-press",Se="trigger-hover",Pe="trigger-focus",ve="outside-press",xe="item-press",Ie="close-press",Te="focus-out",Le="escape-key",Be="list-navigation",Oe="cancel-open",Re="sibling-open",Ke="disabled",Me="imperative-action";function Fe(e,t,n,r){let s=!1,a=!1;const i=r??_;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){a=!0},get isCanceled(){return s},get isPropagationAllowed(){return a},trigger:n,...i}}const pe=l.createContext(void 0);function be(e=!1){const t=l.useContext(pe);if(t===void 0&&!e)throw new Error(Y(16));return t}function me(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:s=0,isNativeButton:a}=e,i=r&&t!==!1,u=r&&t===!1;return{props:l.useMemo(()=>{const f={onKeyDown(b){n&&t&&b.key!=="Tab"&&b.preventDefault()}};return r||(f.tabIndex=s,!a&&n&&(f.tabIndex=t?s:-1)),(a&&(t||i)||!a&&n)&&(f["aria-disabled"]=n),a&&(!t||u)&&(f.disabled=n),f},[r,n,t,i,u,a,s])}}function Ue(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:s=!0}=e,a=l.useRef(null),i=be(!0)!==void 0,u=k(()=>{const c=a.current;return!!(c?.tagName==="A"&&c?.href)}),{props:p}=me({focusableWhenDisabled:n,disabled:t,composite:i,tabIndex:r,isNativeButton:s}),f=l.useCallback(()=>{const c=a.current;we(c)&&i&&t&&p.disabled===void 0&&c.disabled&&(c.disabled=!1)},[t,p.disabled,i]);le(f,[f]);const b=l.useCallback((c={})=>{const{onClick:w,onMouseDown:M,onKeyUp:F,onKeyDown:U,onPointerDown:W,...A}=c;return j({type:s?"button":void 0,onClick(o){if(t){o.preventDefault();return}w?.(o)},onMouseDown(o){t||M?.(o)},onKeyDown(o){if(t||(D(o),U?.(o)),o.baseUIHandlerPrevented)return;const H=o.target===o.currentTarget&&!s&&!u()&&!t,C=o.key==="Enter",$=o.key===" ";H&&(($||C)&&o.preventDefault(),C&&w?.(o))},onKeyUp(o){t||(D(o),F?.(o)),!o.baseUIHandlerPrevented&&o.target===o.currentTarget&&!s&&!t&&o.key===" "&&w?.(o)},onPointerDown(o){if(t){o.preventDefault();return}W?.(o)}},s?void 0:{role:"button"},p,A)},[t,p,s,u]),K=k(c=>{a.current=c,f()});return{getButtonProps:b,buttonRef:K}}function we(e){return h(e)&&e.tagName==="BUTTON"}function We(e){return de(e,"base-ui")}export{L as A,E as B,pe as C,Ie as D,S as E,q as F,ie as G,re as H,ee as I,he as J,se as K,Ce as L,De as M,Ke as N,I as O,k as a,be as b,N as c,We as d,T as e,Ue as f,Fe as g,O as h,h as i,Te as j,xe as k,Be as l,Se as m,ke as n,ve as o,de as p,Pe as q,Le as r,Re as s,Ne as t,le as u,Me as v,B as w,y as x,Oe as y,d as z};
1
+ import{C as V,ab as _,ac as Y,ad as j,ae as D}from"./button-8ab4wOwy.js";import{r as l,v as x}from"./main-CQKtcNr3.js";const g=x[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],G=g&&g!==l.useLayoutEffect?g:e=>e();function k(e){const t=V(J).current;return t.next=e,G(t.effect),t.trampoline}function J(){const e={next:void 0,callback:X,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function X(){}function m(){return typeof window<"u"}function E(e){return I(e)?(e.nodeName||"").toLowerCase():"#document"}function d(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function q(e){var t;return(t=(I(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function I(e){return m()?e instanceof Node||e instanceof d(e).Node:!1}function T(e){return m()?e instanceof Element||e instanceof d(e).Element:!1}function h(e){return m()?e instanceof HTMLElement||e instanceof d(e).HTMLElement:!1}function N(e){return!m()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof d(e).ShadowRoot}const z=new Set(["inline","contents"]);function L(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=O(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!z.has(s)}const Q=new Set(["table","td","th"]);function he(e){return Q.has(E(e))}const Z=[":popover-open",":modal"];function ee(e){return Z.some(t=>{try{return e.matches(t)}catch{return!1}})}const te=["transform","translate","scale","rotate","perspective"],ne=["transform","translate","scale","rotate","perspective","filter"],oe=["paint","layout","strict","content"];function se(e){const t=re(),n=T(e)?O(e):e;return te.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ne.some(r=>(n.willChange||"").includes(r))||oe.some(r=>(n.contain||"").includes(r))}function Ce(e){let t=y(e);for(;h(t)&&!B(t);){if(se(t))return t;if(ee(t))return null;t=y(t)}return null}function re(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ae=new Set(["html","body","#document"]);function B(e){return ae.has(E(e))}function O(e){return d(e).getComputedStyle(e)}function De(e){return T(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function y(e){if(E(e)==="html")return e;const t=e.assignedSlot||e.parentNode||N(e)&&e.host||q(e);return N(t)?t.host:t}function R(e){const t=y(e);return B(t)?e.ownerDocument?e.ownerDocument.body:e.body:h(t)&&L(t)?t:R(t)}function S(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=R(e),a=s===((r=e.ownerDocument)==null?void 0:r.body),i=d(s);if(a){const u=ie(i);return t.concat(i,i.visualViewport||[],L(s)?s:[],u&&n?S(u):[])}return t.concat(s,S(s,[],n))}function ie(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const ce=()=>{},le=typeof document<"u"?l.useLayoutEffect:ce,ue={...x};let P=0;function fe(e,t="mui"){const[n,r]=l.useState(e),s=e||n;return l.useEffect(()=>{n==null&&(P+=1,r(`${t}-${P}`))},[n,t]),s}const v=ue.useId;function de(e,t){if(v!==void 0){const n=v();return e??(t?`${t}-${n}`:n)}return fe(e,t)}const ke="none",Ne="trigger-press",Se="trigger-hover",Pe="trigger-focus",ve="outside-press",xe="item-press",Ie="close-press",Te="focus-out",Le="escape-key",Be="list-navigation",Oe="cancel-open",Re="sibling-open",Ke="disabled",Me="imperative-action";function Fe(e,t,n,r){let s=!1,a=!1;const i=r??_;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){a=!0},get isCanceled(){return s},get isPropagationAllowed(){return a},trigger:n,...i}}const pe=l.createContext(void 0);function be(e=!1){const t=l.useContext(pe);if(t===void 0&&!e)throw new Error(Y(16));return t}function me(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:s=0,isNativeButton:a}=e,i=r&&t!==!1,u=r&&t===!1;return{props:l.useMemo(()=>{const f={onKeyDown(b){n&&t&&b.key!=="Tab"&&b.preventDefault()}};return r||(f.tabIndex=s,!a&&n&&(f.tabIndex=t?s:-1)),(a&&(t||i)||!a&&n)&&(f["aria-disabled"]=n),a&&(!t||u)&&(f.disabled=n),f},[r,n,t,i,u,a,s])}}function Ue(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:s=!0}=e,a=l.useRef(null),i=be(!0)!==void 0,u=k(()=>{const c=a.current;return!!(c?.tagName==="A"&&c?.href)}),{props:p}=me({focusableWhenDisabled:n,disabled:t,composite:i,tabIndex:r,isNativeButton:s}),f=l.useCallback(()=>{const c=a.current;we(c)&&i&&t&&p.disabled===void 0&&c.disabled&&(c.disabled=!1)},[t,p.disabled,i]);le(f,[f]);const b=l.useCallback((c={})=>{const{onClick:w,onMouseDown:M,onKeyUp:F,onKeyDown:U,onPointerDown:W,...A}=c;return j({type:s?"button":void 0,onClick(o){if(t){o.preventDefault();return}w?.(o)},onMouseDown(o){t||M?.(o)},onKeyDown(o){if(t||(D(o),U?.(o)),o.baseUIHandlerPrevented)return;const H=o.target===o.currentTarget&&!s&&!u()&&!t,C=o.key==="Enter",$=o.key===" ";H&&(($||C)&&o.preventDefault(),C&&w?.(o))},onKeyUp(o){t||(D(o),F?.(o)),!o.baseUIHandlerPrevented&&o.target===o.currentTarget&&!s&&!t&&o.key===" "&&w?.(o)},onPointerDown(o){if(t){o.preventDefault();return}W?.(o)}},s?void 0:{role:"button"},p,A)},[t,p,s,u]),K=k(c=>{a.current=c,f()});return{getButtonProps:b,buttonRef:K}}function we(e){return h(e)&&e.tagName==="BUTTON"}function We(e){return de(e,"base-ui")}export{L as A,E as B,pe as C,Ie as D,S as E,q as F,ie as G,re as H,ee as I,he as J,se as K,Ce as L,De as M,Ke as N,I as O,k as a,be as b,N as c,We as d,T as e,Ue as f,Fe as g,O as h,h as i,Te as j,xe as k,Be as l,Se as m,ke as n,ve as o,de as p,Pe as q,Le as r,Re as s,Ne as t,le as u,Me as v,B as w,y as x,Oe as y,d as z};
@@ -1 +1 @@
1
- import{f as S}from"./DirectionContext-B1cuzwIr.js";import{A as j,s as D,a as H,b as y,c as k}from"./event-Dwf9IDxK.js";import{r as R,j as B}from"./main-DBmooBKx.js";import{C as G,E as V}from"./button-DdG8c-XQ.js";import{u as L,a as T,b as I}from"./useBaseUiId-Ckx_aJky.js";function p(e,i,o){return Math.floor(e/i)!==o}function x(e,i){return i<0||i>=e.current.length}function et(e,i){return E(e,{disabledIndices:i})}function nt(e,i){return E(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:i})}function E(e,{startingIndex:i=-1,decrement:o=!1,disabledIndices:s,amount:m=1}={}){let t=i;do t+=o?-m:m;while(t>=0&&t<=e.current.length-1&&z(e,t,s));return t}function rt(e,{event:i,orientation:o,loopFocus:s,rtl:m,cols:t,disabledIndices:a,minIndex:O,maxIndex:g,prevIndex:u,stopEvent:c=!1}){let r=u;const d=[],w={};let C=!1;{let n=null,l=-1;e.current.forEach((h,f)=>{if(h==null)return;const M=h.closest('[role="row"]');M&&(C=!0),(M!==n||l===-1)&&(n=M,l+=1,d[l]=[]),d[l].push(f),w[f]=l})}const N=C&&d.length>0&&d.some(n=>n.length!==t);function b(n){if(!N||u===-1)return;const l=w[u];if(l==null)return;const h=d[l].indexOf(u);let f=n==="up"?l-1:l+1;s&&(f<0?f=d.length-1:f>=d.length&&(f=0));const M=new Set;for(;f>=0&&f<d.length&&!M.has(f);){M.add(f);const _=d[f];if(_.length===0){f=n==="up"?f-1:f+1;continue}const W=Math.min(h,_.length-1);for(let P=W;P>=0;P-=1){const A=_[P];if(!z(e,A,a))return A}f=n==="up"?f-1:f+1,s&&(f<0?f=d.length-1:f>=d.length&&(f=0))}}if(i.key===j){const n=b("up");if(n!==void 0)c&&D(i),r=n;else{if(c&&D(i),u===-1)r=g;else if(r=E(e,{startingIndex:r,amount:t,decrement:!0,disabledIndices:a}),s&&(u-t<O||r<0)){const l=u%t,h=g%t,f=g-(h-l);h===l?r=g:r=h>l?f:f-t}x(e,r)&&(r=u)}}if(i.key===H){const n=b("down");n!==void 0?(c&&D(i),r=n):(c&&D(i),u===-1?r=O:(r=E(e,{startingIndex:u,amount:t,disabledIndices:a}),s&&u+t>g&&(r=E(e,{startingIndex:u%t-t,amount:t,disabledIndices:a}))),x(e,r)&&(r=u))}if(o==="both"){const n=S(u/t);i.key===(m?y:k)&&(c&&D(i),u%t!==t-1?(r=E(e,{startingIndex:u,disabledIndices:a}),s&&p(r,t,n)&&(r=E(e,{startingIndex:u-u%t-1,disabledIndices:a}))):s&&(r=E(e,{startingIndex:u-u%t-1,disabledIndices:a})),p(r,t,n)&&(r=u)),i.key===(m?k:y)&&(c&&D(i),u%t!==0?(r=E(e,{startingIndex:u,decrement:!0,disabledIndices:a}),s&&p(r,t,n)&&(r=E(e,{startingIndex:u+(t-u%t),decrement:!0,disabledIndices:a}))):s&&(r=E(e,{startingIndex:u+(t-u%t),decrement:!0,disabledIndices:a})),p(r,t,n)&&(r=u));const l=S(g/t)===n;x(e,r)&&(s&&l?r=i.key===(m?k:y)?g:E(e,{startingIndex:u-u%t-1,disabledIndices:a}):r=u)}return r}function it(e,i,o){const s=[];let m=0;return e.forEach(({width:t,height:a},O)=>{let g=!1;for(o&&(m=0);!g;){const u=[];for(let c=0;c<t;c+=1)for(let r=0;r<a;r+=1)u.push(m+c+r*i);m%i+t<=i&&u.every(c=>s[c]==null)?(u.forEach(c=>{s[c]=O}),g=!0):m+=1}}),[...s]}function ut(e,i,o,s,m){if(e===-1)return-1;const t=o.indexOf(e),a=i[e];switch(m){case"tl":return t;case"tr":return a?t+a.width-1:t;case"bl":return a?t+(a.height-1)*s:t;case"br":return o.lastIndexOf(e);default:return-1}}function st(e,i){return i.flatMap((o,s)=>e.includes(o)?[s]:[])}function z(e,i,o){if(typeof o=="function")return o(i);if(o)return o.includes(i);const s=e.current[i];return s?s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true":!1}const U=R.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Y(){return R.useContext(U)}let q=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function J(e={}){const{label:i,metadata:o,textRef:s,indexGuessBehavior:m,index:t}=e,{register:a,unregister:O,subscribeMapChange:g,elementsRef:u,labelsRef:c,nextIndexRef:r}=Y(),d=R.useRef(-1),[w,C]=R.useState(t??(m===q.GuessFromOrder?()=>{if(d.current===-1){const n=r.current;r.current+=1,d.current=n}return d.current}:-1)),N=R.useRef(null),b=R.useCallback(n=>{if(N.current=n,w!==-1&&n!==null&&(u.current[w]=n,c)){const l=i!==void 0;c.current[w]=l?i:s?.current?.textContent??n.textContent}},[w,u,c,i,s]);return L(()=>{if(t!=null)return;const n=N.current;if(n)return a(n,o),()=>{O(n)}},[t,a,O,o]),L(()=>{if(t==null)return g(n=>{const l=N.current?n.get(N.current)?.index:null;l!=null&&C(l)})},[t,g,C]),R.useMemo(()=>({ref:b,index:w}),[w,b])}function ot(e){const{children:i,elementsRef:o,labelsRef:s,onMapChange:m}=e,t=T(m),a=R.useRef(0),O=G(Q).current,g=G(K).current,[u,c]=R.useState(0),r=R.useRef(u),d=T((n,l)=>{g.set(n,l??null),r.current+=1,c(r.current)}),w=T(n=>{g.delete(n),r.current+=1,c(r.current)}),C=R.useMemo(()=>{const n=new Map;return Array.from(g.keys()).filter(h=>h.isConnected).sort(X).forEach((h,f)=>{const M=g.get(h)??{};n.set(h,{...M,index:f})}),n},[g,u]);L(()=>{if(typeof MutationObserver!="function"||C.size===0)return;const n=new MutationObserver(l=>{const h=new Set,f=M=>h.has(M)?h.delete(M):h.add(M);l.forEach(M=>{M.removedNodes.forEach(f),M.addedNodes.forEach(f)}),h.size===0&&(r.current+=1,c(r.current))});return C.forEach((l,h)=>{h.parentElement&&n.observe(h.parentElement,{childList:!0})}),()=>{n.disconnect()}},[C]),L(()=>{r.current===u&&(o.current.length!==C.size&&(o.current.length=C.size),s&&s.current.length!==C.size&&(s.current.length=C.size),a.current=C.size),t(C)},[t,C,o,s,u]),L(()=>()=>{o.current=[]},[o]),L(()=>()=>{s&&(s.current=[])},[s]);const N=T(n=>(O.add(n),()=>{O.delete(n)}));L(()=>{O.forEach(n=>n(C))},[O,C]);const b=R.useMemo(()=>({register:d,unregister:w,subscribeMapChange:N,elementsRef:o,labelsRef:s,nextIndexRef:a}),[d,w,N,o,s,a]);return B.jsx(U.Provider,{value:b,children:i})}function K(){return new Map}function Q(){return new Set}function X(e,i){const o=e.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING||o&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:o&Node.DOCUMENT_POSITION_PRECEDING||o&Node.DOCUMENT_POSITION_CONTAINS?1:0}function ft(e={}){const{highlightItemOnHover:i,highlightedIndex:o,onHighlightedIndexChange:s}=I(),{ref:m,index:t}=J(e),a=o===t,O=R.useRef(null),g=V(m,O);return{compositeProps:R.useMemo(()=>({tabIndex:a?0:-1,onFocus(){s(t)},onMouseMove(){const c=O.current;if(!i||!c)return;const r=c.hasAttribute("disabled")||c.ariaDisabled==="true";!a&&!r&&c.focus()}}),[a,s,t,i]),compositeRef:g,index:t}}export{ot as C,nt as a,rt as b,it as c,ut as d,st as e,E as f,et as g,x as h,z as i,J as j,ft as u};
1
+ import{f as S}from"./DirectionContext-CrIsc5n9.js";import{A as j,s as D,a as H,b as y,c as k}from"./event-DG3RKJz8.js";import{r as R,j as B}from"./main-CQKtcNr3.js";import{C as G,E as V}from"./button-8ab4wOwy.js";import{u as L,a as T,b as I}from"./useBaseUiId-DiwX_3so.js";function p(e,i,o){return Math.floor(e/i)!==o}function x(e,i){return i<0||i>=e.current.length}function et(e,i){return E(e,{disabledIndices:i})}function nt(e,i){return E(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:i})}function E(e,{startingIndex:i=-1,decrement:o=!1,disabledIndices:s,amount:m=1}={}){let t=i;do t+=o?-m:m;while(t>=0&&t<=e.current.length-1&&z(e,t,s));return t}function rt(e,{event:i,orientation:o,loopFocus:s,rtl:m,cols:t,disabledIndices:a,minIndex:O,maxIndex:g,prevIndex:u,stopEvent:c=!1}){let r=u;const d=[],w={};let C=!1;{let n=null,l=-1;e.current.forEach((h,f)=>{if(h==null)return;const M=h.closest('[role="row"]');M&&(C=!0),(M!==n||l===-1)&&(n=M,l+=1,d[l]=[]),d[l].push(f),w[f]=l})}const N=C&&d.length>0&&d.some(n=>n.length!==t);function b(n){if(!N||u===-1)return;const l=w[u];if(l==null)return;const h=d[l].indexOf(u);let f=n==="up"?l-1:l+1;s&&(f<0?f=d.length-1:f>=d.length&&(f=0));const M=new Set;for(;f>=0&&f<d.length&&!M.has(f);){M.add(f);const _=d[f];if(_.length===0){f=n==="up"?f-1:f+1;continue}const W=Math.min(h,_.length-1);for(let P=W;P>=0;P-=1){const A=_[P];if(!z(e,A,a))return A}f=n==="up"?f-1:f+1,s&&(f<0?f=d.length-1:f>=d.length&&(f=0))}}if(i.key===j){const n=b("up");if(n!==void 0)c&&D(i),r=n;else{if(c&&D(i),u===-1)r=g;else if(r=E(e,{startingIndex:r,amount:t,decrement:!0,disabledIndices:a}),s&&(u-t<O||r<0)){const l=u%t,h=g%t,f=g-(h-l);h===l?r=g:r=h>l?f:f-t}x(e,r)&&(r=u)}}if(i.key===H){const n=b("down");n!==void 0?(c&&D(i),r=n):(c&&D(i),u===-1?r=O:(r=E(e,{startingIndex:u,amount:t,disabledIndices:a}),s&&u+t>g&&(r=E(e,{startingIndex:u%t-t,amount:t,disabledIndices:a}))),x(e,r)&&(r=u))}if(o==="both"){const n=S(u/t);i.key===(m?y:k)&&(c&&D(i),u%t!==t-1?(r=E(e,{startingIndex:u,disabledIndices:a}),s&&p(r,t,n)&&(r=E(e,{startingIndex:u-u%t-1,disabledIndices:a}))):s&&(r=E(e,{startingIndex:u-u%t-1,disabledIndices:a})),p(r,t,n)&&(r=u)),i.key===(m?k:y)&&(c&&D(i),u%t!==0?(r=E(e,{startingIndex:u,decrement:!0,disabledIndices:a}),s&&p(r,t,n)&&(r=E(e,{startingIndex:u+(t-u%t),decrement:!0,disabledIndices:a}))):s&&(r=E(e,{startingIndex:u+(t-u%t),decrement:!0,disabledIndices:a})),p(r,t,n)&&(r=u));const l=S(g/t)===n;x(e,r)&&(s&&l?r=i.key===(m?k:y)?g:E(e,{startingIndex:u-u%t-1,disabledIndices:a}):r=u)}return r}function it(e,i,o){const s=[];let m=0;return e.forEach(({width:t,height:a},O)=>{let g=!1;for(o&&(m=0);!g;){const u=[];for(let c=0;c<t;c+=1)for(let r=0;r<a;r+=1)u.push(m+c+r*i);m%i+t<=i&&u.every(c=>s[c]==null)?(u.forEach(c=>{s[c]=O}),g=!0):m+=1}}),[...s]}function ut(e,i,o,s,m){if(e===-1)return-1;const t=o.indexOf(e),a=i[e];switch(m){case"tl":return t;case"tr":return a?t+a.width-1:t;case"bl":return a?t+(a.height-1)*s:t;case"br":return o.lastIndexOf(e);default:return-1}}function st(e,i){return i.flatMap((o,s)=>e.includes(o)?[s]:[])}function z(e,i,o){if(typeof o=="function")return o(i);if(o)return o.includes(i);const s=e.current[i];return s?s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true":!1}const U=R.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Y(){return R.useContext(U)}let q=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function J(e={}){const{label:i,metadata:o,textRef:s,indexGuessBehavior:m,index:t}=e,{register:a,unregister:O,subscribeMapChange:g,elementsRef:u,labelsRef:c,nextIndexRef:r}=Y(),d=R.useRef(-1),[w,C]=R.useState(t??(m===q.GuessFromOrder?()=>{if(d.current===-1){const n=r.current;r.current+=1,d.current=n}return d.current}:-1)),N=R.useRef(null),b=R.useCallback(n=>{if(N.current=n,w!==-1&&n!==null&&(u.current[w]=n,c)){const l=i!==void 0;c.current[w]=l?i:s?.current?.textContent??n.textContent}},[w,u,c,i,s]);return L(()=>{if(t!=null)return;const n=N.current;if(n)return a(n,o),()=>{O(n)}},[t,a,O,o]),L(()=>{if(t==null)return g(n=>{const l=N.current?n.get(N.current)?.index:null;l!=null&&C(l)})},[t,g,C]),R.useMemo(()=>({ref:b,index:w}),[w,b])}function ot(e){const{children:i,elementsRef:o,labelsRef:s,onMapChange:m}=e,t=T(m),a=R.useRef(0),O=G(Q).current,g=G(K).current,[u,c]=R.useState(0),r=R.useRef(u),d=T((n,l)=>{g.set(n,l??null),r.current+=1,c(r.current)}),w=T(n=>{g.delete(n),r.current+=1,c(r.current)}),C=R.useMemo(()=>{const n=new Map;return Array.from(g.keys()).filter(h=>h.isConnected).sort(X).forEach((h,f)=>{const M=g.get(h)??{};n.set(h,{...M,index:f})}),n},[g,u]);L(()=>{if(typeof MutationObserver!="function"||C.size===0)return;const n=new MutationObserver(l=>{const h=new Set,f=M=>h.has(M)?h.delete(M):h.add(M);l.forEach(M=>{M.removedNodes.forEach(f),M.addedNodes.forEach(f)}),h.size===0&&(r.current+=1,c(r.current))});return C.forEach((l,h)=>{h.parentElement&&n.observe(h.parentElement,{childList:!0})}),()=>{n.disconnect()}},[C]),L(()=>{r.current===u&&(o.current.length!==C.size&&(o.current.length=C.size),s&&s.current.length!==C.size&&(s.current.length=C.size),a.current=C.size),t(C)},[t,C,o,s,u]),L(()=>()=>{o.current=[]},[o]),L(()=>()=>{s&&(s.current=[])},[s]);const N=T(n=>(O.add(n),()=>{O.delete(n)}));L(()=>{O.forEach(n=>n(C))},[O,C]);const b=R.useMemo(()=>({register:d,unregister:w,subscribeMapChange:N,elementsRef:o,labelsRef:s,nextIndexRef:a}),[d,w,N,o,s,a]);return B.jsx(U.Provider,{value:b,children:i})}function K(){return new Map}function Q(){return new Set}function X(e,i){const o=e.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING||o&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:o&Node.DOCUMENT_POSITION_PRECEDING||o&Node.DOCUMENT_POSITION_CONTAINS?1:0}function ft(e={}){const{highlightItemOnHover:i,highlightedIndex:o,onHighlightedIndexChange:s}=I(),{ref:m,index:t}=J(e),a=o===t,O=R.useRef(null),g=V(m,O);return{compositeProps:R.useMemo(()=>({tabIndex:a?0:-1,onFocus(){s(t)},onMouseMove(){const c=O.current;if(!i||!c)return;const r=c.hasAttribute("disabled")||c.ariaDisabled==="true";!a&&!r&&c.focus()}}),[a,s,t,i]),compositeRef:g,index:t}}export{ot as C,nt as a,rt as b,it as c,ut as d,st as e,E as f,et as g,x as h,z as i,J as j,ft as u};
@@ -1 +1 @@
1
- import{r as e}from"./main-DBmooBKx.js";function d({controlled:t,default:s,name:c,state:f="value"}){const{current:a}=e.useRef(t!==void 0),[o,u]=e.useState(s),l=a?t:o,n=e.useCallback(r=>{a||u(r)},[]);return[l,n]}export{d as u};
1
+ import{r as e}from"./main-CQKtcNr3.js";function d({controlled:t,default:s,name:c,state:f="value"}){const{current:a}=e.useRef(t!==void 0),[o,u]=e.useState(s),l=a?t:o,n=e.useCallback(r=>{a||u(r)},[]);return[l,n]}export{d as u};
@@ -1 +1 @@
1
- import{S as l,s as d,h as a,g as p,n as h,u as b,r as o,b as m,c as v}from"./main-DBmooBKx.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??p();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function O(t,s){const r=b(),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(m)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{O as u};
1
+ import{S as l,s as d,h as a,g as p,n as h,u as b,r as o,b as m,c as v}from"./main-CQKtcNr3.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??p();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function O(t,s){const r=b(),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(m)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{O as u};
@@ -1 +1 @@
1
- import{S as G,p as N,e as l,s as Q,f as g,b as M,i as x,k as B,t as J,l as C,m as X,o as Y,q as A,n as z,r as d,c as V,u as Z}from"./main-DBmooBKx.js";var $=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=N(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#a;#u;#r;#i;#b;#l;#d;#o;#h;#n;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),j(this.#t,this.options)?this.#c():this.updateResult(),this.#g())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!Q(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(e.staleTime,this.#t))&&this.#R();const i=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||i!==this.#n)&&this.#m(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return tt(this,s)&&(this.#e=s,this.#u=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#f.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(M)),e}#R(){this.#y();const t=g(this.options.staleTime,this.#t);if(x||this.#e.isStale||!B(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#m(t){this.#S(),this.#n=t,!(x||l(this.options.enabled,this.#t)===!1||!B(this.#n)||this.#n===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#n))}#g(){this.#R(),this.#m(this.#v())}#y(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#S(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,u=this.#a,a=this.#u,R=t!==s?t.state:this.#p,{state:h}=t;let n={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),m=!c&&j(t,e),S=c&&H(t,s,e,r);(m||S)&&(n={...n,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:y,errorUpdatedAt:U,status:b}=n;o=n.data;let D=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(c=i.data,D=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,c!==void 0&&(b="success",o=A(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!D)if(i&&o===u?.data&&e.select===this.#b)o=this.#l;else try{this.#b=e.select,o=e.select(o),o=A(i?.data,o,e),this.#l=o,this.#i=null}catch(c){this.#i=c}this.#i&&(y=this.#i,o=this.#l,U=Date.now(),b="error");const I=n.fetchStatus==="fetching",T=b==="pending",w=b==="error",F=T&&I,k=o!==void 0,p={status:b,fetchStatus:n.fetchStatus,isPending:T,isSuccess:b==="success",isError:w,isInitialLoading:F,isLoading:F,data:o,dataUpdatedAt:n.dataUpdatedAt,error:y,errorUpdatedAt:U,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:n.dataUpdateCount>0||n.errorUpdateCount>0,isFetchedAfterMount:n.dataUpdateCount>R.dataUpdateCount||n.errorUpdateCount>R.errorUpdateCount,isFetching:I,isRefetching:I&&!T,isLoadingError:w&&!k,isPaused:n.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:w&&k,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=p.data!==void 0,m=p.status==="error"&&!c,S=E=>{m?E.reject(p.error):c&&E.resolve(p.data)},L=()=>{const E=this.#r=p.promise=N();S(E)},O=this.#r;switch(O.status){case"pending":t.queryHash===s.queryHash&&S(O);break;case"fulfilled":(m||p.data!==O.value)&&L();break;case"rejected":(!m||p.error!==O.reason)&&L();break}}return p}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#u=this.options,this.#a.data!==void 0&&(this.#d=this.#t),Q(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#f.size)return!0;const u=new Set(i??this.#f);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(a=>{const f=a;return this.#e[f]!==t[f]&&u.has(f)})};this.#E({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#g()}#E(t){z.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function q(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function j(t,e){return q(t,e)||t.state.data!==void 0&&_(t,e,e.refetchOnMount)}function _(t,e,s){if(l(e.enabled,t)!==!1&&g(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(g(e.staleTime,t))}function tt(t,e){return!Q(t.getCurrentResult(),e)}var K=d.createContext(!1),et=()=>d.useContext(K);K.Provider;function st(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rt=d.createContext(st()),it=()=>d.useContext(rt),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?V(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},at=t=>{d.useEffect(()=>{t.clearReset()},[t])},ot=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||V(s,[t.error,r])),ht=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ct=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,W=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function lt(t,e,s){const r=et(),i=it(),u=Z(),a=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const f=u.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",ht(a),nt(a,i,f),at(i);const R=!u.getQueryCache().get(a.queryHash),[h]=d.useState(()=>new e(u,a)),n=h.getOptimisticResult(a),v=!r&&t.subscribed!==!1;if(d.useSyncExternalStore(d.useCallback(o=>{const y=v?h.subscribe(z.batchCalls(o)):M;return h.updateResult(),y},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),d.useEffect(()=>{h.setOptions(a)},[a,h]),ut(a,n))throw W(a,h,i);if(ot({result:n,errorResetBoundary:i,throwOnError:a.throwOnError,query:f,suspense:a.suspense}))throw n.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(a,n),a.experimental_prefetchInRender&&!x&&ct(n,r)&&(R?W(a,h,i):f?.promise)?.catch(M).finally(()=>{h.updateResult()}),a.notifyOnChangeProps?n:h.trackResult(n)}function pt(t,e){return lt(t,$)}export{pt as u};
1
+ import{S as G,p as N,e as l,s as Q,f as g,b as M,i as x,k as B,t as J,l as C,m as X,o as Y,q as A,n as z,r as d,c as V,u as Z}from"./main-CQKtcNr3.js";var $=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=N(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#a;#u;#r;#i;#b;#l;#d;#o;#h;#n;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),j(this.#t,this.options)?this.#c():this.updateResult(),this.#g())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!Q(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(e.staleTime,this.#t))&&this.#R();const i=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||i!==this.#n)&&this.#m(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return tt(this,s)&&(this.#e=s,this.#u=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#f.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(M)),e}#R(){this.#y();const t=g(this.options.staleTime,this.#t);if(x||this.#e.isStale||!B(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#m(t){this.#S(),this.#n=t,!(x||l(this.options.enabled,this.#t)===!1||!B(this.#n)||this.#n===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#n))}#g(){this.#R(),this.#m(this.#v())}#y(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#S(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,u=this.#a,a=this.#u,R=t!==s?t.state:this.#p,{state:h}=t;let n={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),m=!c&&j(t,e),S=c&&H(t,s,e,r);(m||S)&&(n={...n,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:y,errorUpdatedAt:U,status:b}=n;o=n.data;let D=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(c=i.data,D=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,c!==void 0&&(b="success",o=A(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!D)if(i&&o===u?.data&&e.select===this.#b)o=this.#l;else try{this.#b=e.select,o=e.select(o),o=A(i?.data,o,e),this.#l=o,this.#i=null}catch(c){this.#i=c}this.#i&&(y=this.#i,o=this.#l,U=Date.now(),b="error");const I=n.fetchStatus==="fetching",T=b==="pending",w=b==="error",F=T&&I,k=o!==void 0,p={status:b,fetchStatus:n.fetchStatus,isPending:T,isSuccess:b==="success",isError:w,isInitialLoading:F,isLoading:F,data:o,dataUpdatedAt:n.dataUpdatedAt,error:y,errorUpdatedAt:U,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:n.dataUpdateCount>0||n.errorUpdateCount>0,isFetchedAfterMount:n.dataUpdateCount>R.dataUpdateCount||n.errorUpdateCount>R.errorUpdateCount,isFetching:I,isRefetching:I&&!T,isLoadingError:w&&!k,isPaused:n.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:w&&k,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=p.data!==void 0,m=p.status==="error"&&!c,S=E=>{m?E.reject(p.error):c&&E.resolve(p.data)},L=()=>{const E=this.#r=p.promise=N();S(E)},O=this.#r;switch(O.status){case"pending":t.queryHash===s.queryHash&&S(O);break;case"fulfilled":(m||p.data!==O.value)&&L();break;case"rejected":(!m||p.error!==O.reason)&&L();break}}return p}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#u=this.options,this.#a.data!==void 0&&(this.#d=this.#t),Q(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#f.size)return!0;const u=new Set(i??this.#f);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(a=>{const f=a;return this.#e[f]!==t[f]&&u.has(f)})};this.#E({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#g()}#E(t){z.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function q(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function j(t,e){return q(t,e)||t.state.data!==void 0&&_(t,e,e.refetchOnMount)}function _(t,e,s){if(l(e.enabled,t)!==!1&&g(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(g(e.staleTime,t))}function tt(t,e){return!Q(t.getCurrentResult(),e)}var K=d.createContext(!1),et=()=>d.useContext(K);K.Provider;function st(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rt=d.createContext(st()),it=()=>d.useContext(rt),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?V(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},at=t=>{d.useEffect(()=>{t.clearReset()},[t])},ot=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||V(s,[t.error,r])),ht=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ct=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,W=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function lt(t,e,s){const r=et(),i=it(),u=Z(),a=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const f=u.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",ht(a),nt(a,i,f),at(i);const R=!u.getQueryCache().get(a.queryHash),[h]=d.useState(()=>new e(u,a)),n=h.getOptimisticResult(a),v=!r&&t.subscribed!==!1;if(d.useSyncExternalStore(d.useCallback(o=>{const y=v?h.subscribe(z.batchCalls(o)):M;return h.updateResult(),y},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),d.useEffect(()=>{h.setOptions(a)},[a,h]),ut(a,n))throw W(a,h,i);if(ot({result:n,errorResetBoundary:i,throwOnError:a.throwOnError,query:f,suspense:a.suspense}))throw n.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(a,n),a.experimental_prefetchInRender&&!x&&ct(n,r)&&(R?W(a,h,i):f?.promise)?.catch(M).finally(()=>{h.updateResult()}),a.notifyOnChangeProps?n:h.trackResult(n)}function pt(t,e){return lt(t,$)}export{pt as u};