@astralbeam/sdk 0.9.0 → 0.11.0

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.
@@ -0,0 +1,21 @@
1
+ import{$n as e,$t as t,A as n,An as r,At as i,B as a,Bn as o,Bt as s,C as c,Cn as l,Ct as u,D as d,Dn as f,Dt as p,En as m,Et as h,F as g,Fn as _,Ft as v,G as y,Gn as b,Gt as x,Hn as S,Ht as C,I as w,In as T,It as E,J as D,Jn as O,Jt as k,K as A,Kn as j,Kt as M,L as N,Ln as P,Lt as F,Mn as I,Mt as L,N as ee,Nn as R,Nt as z,O as te,Ot as B,P as V,Pn as H,Pt as U,Q as W,Qn as ne,R as re,Rn as G,Rt as ie,S as ae,Sn as K,St as oe,T as se,Tn as ce,Tt as le,U as ue,Un as de,Ut as fe,V as pe,Vn as me,Vt as he,W as ge,Wn as _e,Wt as ve,X as ye,Xn as be,Xt as xe,Yn as Se,Yt as Ce,Z as we,Zn as Te,Zt as Ee,_ as q,_n as De,_t as Oe,a as ke,an as Ae,ar as je,at as Me,bt as Ne,c as Pe,cn as Fe,cr as Ie,ct as Le,d as Re,dn as ze,dt as Be,en as Ve,er as He,et as Ue,f as We,fn as Ge,ft as Ke,g as qe,gn as Je,gt as Ye,h as Xe,ht as Ze,i as Qe,in as $e,ir as J,it as et,j as tt,jn as nt,jt as rt,k as it,kt as at,l as ot,ln as st,lt as ct,m as lt,mn as ut,mt as dt,n as ft,nn as pt,nr as mt,nt as ht,o as gt,on as _t,or as Y,ot as vt,p as yt,pn as bt,pt as xt,q as St,qn as Ct,qt as wt,r as Tt,rn as Et,rr as Dt,rt as Ot,sn as kt,sr as At,t as jt,tn as Mt,tr as Nt,tt as Pt,u as Ft,un as It,ut as Lt,vn as Rt,vt as zt,wn as Bt,wt as Vt,x as Ht,xn as Ut,xt as Wt,yn as Gt,yt as Kt,zn as qt,zt as Jt}from"./styles.generated-Cf-ab39H.js";var X=Ie(Y(),1);const Yt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),Xt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,204H228V96a20,20,0,0,0-20-20H172V32a20,20,0,0,0-28.45-18.12l-104,48.54A20.06,20.06,0,0,0,28,80.55V204H16a12,12,0,0,0,0,24H240a12,12,0,0,0,0-24ZM204,100V204H172V100ZM52,83.09,148,38.3V204H52ZM132,112v12a12,12,0,0,1-24,0V112a12,12,0,0,1,24,0Zm-40,0v12a12,12,0,0,1-24,0V112a12,12,0,0,1,24,0Zm0,52v12a12,12,0,0,1-24,0V164a12,12,0,0,1,24,0Zm40,0v12a12,12,0,0,1-24,0V164a12,12,0,0,1,24,0Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M136,32V216H40V85.35a8,8,0,0,1,3.56-6.66l80-53.33A8,8,0,0,1,136,32Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M240,208H224V96a16,16,0,0,0-16-16H144V32a16,16,0,0,0-24.88-13.32L39.12,72A16,16,0,0,0,32,85.34V208H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM208,96V208H144V96ZM48,85.34,128,32V208H48ZM112,112v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm-32,0v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm0,56v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Zm32,0v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M239.73,208H224V96a16,16,0,0,0-16-16H164a4,4,0,0,0-4,4V208H144V32.41a16.43,16.43,0,0,0-6.16-13,16,16,0,0,0-18.72-.69L39.12,72A16,16,0,0,0,32,85.34V208H16.27A8.18,8.18,0,0,0,8,215.47,8,8,0,0,0,16,224H240a8,8,0,0,0,8-8.53A8.18,8.18,0,0,0,239.73,208ZM76,184a8,8,0,0,1-8.53,8A8.18,8.18,0,0,1,60,183.72V168.27A8.19,8.19,0,0,1,67.47,160,8,8,0,0,1,76,168Zm0-56a8,8,0,0,1-8.53,8A8.19,8.19,0,0,1,60,127.72V112.27A8.19,8.19,0,0,1,67.47,104,8,8,0,0,1,76,112Zm40,56a8,8,0,0,1-8.53,8,8.18,8.18,0,0,1-7.47-8.26V168.27a8.19,8.19,0,0,1,7.47-8.26,8,8,0,0,1,8.53,8Zm0-56a8,8,0,0,1-8.53,8,8.19,8.19,0,0,1-7.47-8.26V112.27a8.19,8.19,0,0,1,7.47-8.26,8,8,0,0,1,8.53,8Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,210H222V96a14,14,0,0,0-14-14H142V32a14,14,0,0,0-21.77-11.64l-80,53.33A14,14,0,0,0,34,85.34V210H16a6,6,0,0,0,0,12H240a6,6,0,0,0,0-12ZM208,94a2,2,0,0,1,2,2V210H142V94ZM46,85.34a2,2,0,0,1,.89-1.66l80-53.34A2,2,0,0,1,130,32V210H46ZM110,112v16a6,6,0,0,1-12,0V112a6,6,0,0,1,12,0Zm-32,0v16a6,6,0,0,1-12,0V112a6,6,0,0,1,12,0Zm0,56v16a6,6,0,0,1-12,0V168a6,6,0,0,1,12,0Zm32,0v16a6,6,0,0,1-12,0V168a6,6,0,0,1,12,0Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,208H224V96a16,16,0,0,0-16-16H144V32a16,16,0,0,0-24.88-13.32L39.12,72A16,16,0,0,0,32,85.34V208H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM208,96V208H144V96ZM48,85.34,128,32V208H48ZM112,112v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm-32,0v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm0,56v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Zm32,0v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,212H220V96a12,12,0,0,0-12-12H140V32a12,12,0,0,0-18.66-10l-80,53.33a12,12,0,0,0-5.34,10V212H16a4,4,0,0,0,0,8H240a4,4,0,0,0,0-8ZM208,92a4,4,0,0,1,4,4V212H140V92ZM44,85.34A4,4,0,0,1,45.78,82l80-53.33A4,4,0,0,1,132,32V212H44ZM108,112v16a4,4,0,0,1-8,0V112a4,4,0,0,1,8,0Zm-32,0v16a4,4,0,0,1-8,0V112a4,4,0,0,1,8,0Zm0,56v16a4,4,0,0,1-8,0V168a4,4,0,0,1,8,0Zm32,0v16a4,4,0,0,1-8,0V168a4,4,0,0,1,8,0Z`}))]]),Zt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Qt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M125.18,156.94a64,64,0,1,0-82.36,0,100.23,100.23,0,0,0-39.49,32,12,12,0,0,0,19.35,14.2,76,76,0,0,1,122.64,0,12,12,0,0,0,19.36-14.2A100.33,100.33,0,0,0,125.18,156.94ZM44,108a40,40,0,1,1,40,40A40,40,0,0,1,44,108Zm206.1,97.67a12,12,0,0,1-16.78-2.57A76.31,76.31,0,0,0,172,172a12,12,0,0,1,0-24,40,40,0,1,0-10.3-78.67,12,12,0,1,1-6.16-23.19,64,64,0,0,1,57.64,110.8,100.23,100.23,0,0,1,39.49,32A12,12,0,0,1,250.1,205.67Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M136,108A52,52,0,1,1,84,56,52,52,0,0,1,136,108Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M164.47,195.63a8,8,0,0,1-6.7,12.37H10.23a8,8,0,0,1-6.7-12.37,95.83,95.83,0,0,1,47.22-37.71,60,60,0,1,1,66.5,0A95.83,95.83,0,0,1,164.47,195.63Zm87.91-.15a95.87,95.87,0,0,0-47.13-37.56A60,60,0,0,0,144.7,54.59a4,4,0,0,0-1.33,6A75.83,75.83,0,0,1,147,150.53a4,4,0,0,0,1.07,5.53,112.32,112.32,0,0,1,29.85,30.83,23.92,23.92,0,0,1,3.65,16.47,4,4,0,0,0,3.95,4.64h60.3a8,8,0,0,0,7.73-5.93A8.22,8.22,0,0,0,252.38,195.48Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M112.6,158.43a58,58,0,1,0-57.2,0A93.83,93.83,0,0,0,5.21,196.72a6,6,0,0,0,10.05,6.56,82,82,0,0,1,137.48,0,6,6,0,0,0,10-6.56A93.83,93.83,0,0,0,112.6,158.43ZM38,108a46,46,0,1,1,46,46A46.06,46.06,0,0,1,38,108Zm211,97a6,6,0,0,1-8.3-1.74A81.8,81.8,0,0,0,172,166a6,6,0,0,1,0-12,46,46,0,1,0-17.08-88.73,6,6,0,1,1-4.46-11.14,58,58,0,0,1,50.14,104.3,93.83,93.83,0,0,1,50.19,38.29A6,6,0,0,1,249,205Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M107.19,159a56,56,0,1,0-46.38,0A91.83,91.83,0,0,0,6.88,197.81a4,4,0,1,0,6.7,4.37,84,84,0,0,1,140.84,0,4,4,0,1,0,6.7-4.37A91.83,91.83,0,0,0,107.19,159ZM36,108a48,48,0,1,1,48,48A48.05,48.05,0,0,1,36,108Zm212,95.35a4,4,0,0,1-5.53-1.17A83.81,83.81,0,0,0,172,164a4,4,0,0,1,0-8,48,48,0,1,0-17.82-92.58,4,4,0,1,1-3-7.43,56,56,0,0,1,44,103,91.83,91.83,0,0,1,53.93,38.86A4,4,0,0,1,248,203.35Z`}))]]),$t=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Yt}));$t.displayName=`ArrowClockwiseIcon`;const en=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Xt}));en.displayName=`BuildingsIcon`;const tn=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Zt}));tn.displayName=`CaretDownIcon`;const nn=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Qt}));nn.displayName=`UsersIcon`;const rn=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),an=!rn&&Et.includes(`firefox`);!rn&&Et.includes(`chrom`);const on=Mt;function sn(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function cn(e){return e.matches(`html,body`)}function ln(e){return j(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function un(e){return e?e.getAttribute(`role`)===`combobox`&&ln(e):!1}function dn(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function fn(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...fn(e,t.id,n)])}function pn(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function mn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return be(n)?n.host:null}function hn(e){for(let t of Array.from(e.children))if(qt(t)===`summary`)return t;return null}function gn(e,t){let n=hn(t);return!!n&&(e===n||x(n,e))}function _n(e){let t=e?qt(e):``;return e!=null&&e.matches(`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`)&&(t!==`summary`||e.parentElement!=null&&qt(e.parentElement)===`details`&&hn(e.parentElement)===e)&&(t!==`details`||hn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function vn(e){if(!_n(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=mn(t)){let n=t!==e,r=qt(t)===`slot`;if(t.hasAttribute(`inert`)||n&&qt(t)===`details`&&!t.open&&!gn(e,t)||t.hasAttribute(`hidden`)||!r&&!yn(t,n))return!1}return!0}function yn(e,t){let n=_(e);return t?n.display!==`none`:Ye(e,n)}function bn(e){let t=e.tabIndex;if(t<0){let t=qt(e);if(t===`details`||t===`audio`||t===`video`||j(e)&&e.isContentEditable)return 0}return t}function xn(e){if(qt(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Sn(e,t){let n=xn(e);if(!n)return!0;let r=t.find(e=>{let t=xn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=xn(e);return t?.name===n.name&&t.form===n.form})===n}function Cn(e){if(j(e)&&qt(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return j(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function wn(e,t){Cn(e).forEach(e=>{_n(e)&&t.push(e),wn(e,t)})}function Tn(e,t,n){Cn(e).forEach(e=>{j(e)&&e.matches(t)&&n.push(e),Tn(e,t,n)})}function En(e){return vn(e)&&bn(e)>=0}function Dn(e){let t=[];return wn(e,t),t.filter(vn)}function On(e){let t=Dn(e);return t.filter(e=>bn(e)>=0&&Sn(e,t))}function kn(e,t){let n=On(e),r=n.length;if(r===0)return;let i=ve(f(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function An(e){return kn(f(e).body,1)||e}function jn(e){return kn(f(e).body,-1)||e}function Mn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!x(n,r)}function Nn(e){On(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Pn(e){let t=[];Tn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Fn=class e{static create(){return new e}currentId=0;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=0,t()},e)}isStarted(){return this.currentId!==0}clear=()=>{this.currentId!==0&&(clearTimeout(this.currentId),this.currentId=0)};disposeEffect=()=>this.clear};function In(){let e=H(Fn.create).current;return Be(e.disposeEffect),e}
2
+ /**
3
+ * @license React
4
+ * use-sync-external-store-shim.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+ var Ln=At((e=>{var t=Y();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Rn=At(((e,t)=>{t.exports=Ln()})),Z=Je();const zn=X.createContext(void 0),Bn=e=>{let t=X.useContext(zn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Vn=({client:e,children:t})=>(X.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Z.jsx)(zn.Provider,{value:e,children:t})),Hn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Un=new class{#e=Hn;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Wn(e){setTimeout(e,0)}const Gn=typeof window>`u`||`Deno`in globalThis;function Kn(){}function qn(e,t){return typeof e==`function`?e(t):e}function Jn(e){return typeof e==`number`&&e>=0&&e!==1/0}function Yn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xn(e,t){return typeof e==`function`?e(t):e}function Zn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==$n(o,t.options))return!1}else if(!tr(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Qn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(er(t.options.mutationKey)!==er(a))return!1}else if(!tr(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function $n(e,t){return(t?.queryKeyHashFn||er)(e)}function er(e){return JSON.stringify(e,(e,t)=>or(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function tr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!tr(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!tr(e[r],t[r]))return!1;return!0}return!1}const nr=Object.prototype.hasOwnProperty;function rr(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ar(e)&&ar(t);if(!r&&!(or(e)&&or(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:nr.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=rr(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ir(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ar(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function or(e){if(!sr(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!sr(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function sr(e){return Object.prototype.toString.call(e)===`[object Object]`}function cr(e){return new Promise(t=>{Un.setTimeout(t,e)})}function lr(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:rr(e,t)}function ur(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function dr(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}const fr=Symbol();function pr(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===fr?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function mr(e,t){return typeof e==`function`?e(...t):!!e}function hr(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}let gr=()=>Gn;const _r=()=>gr();var vr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};const yr=new class extends vr{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},br=Wn;function xr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=br,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}const Sr=xr(),Cr=new class extends vr{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function wr(e){return Math.min(1e3*2**e,3e4)}function Tr(e){return(e??`online`)!==`online`||Cr.isOnline()}var Er=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Dr(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Kn);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Er(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>yr.isFocused()&&(e.networkMode===`always`||Cr.isOnline())&&e.canRun(),p=()=>Tr(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(_r()?0:3),a=e.retryDelay??wr,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),cr(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Or=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jn(this.gcTime)&&(this.#e=Un.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_r()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Un.clearTimeout(this.#e),this.#e=void 0)}};function kr(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{hr(e,()=>t.signal,()=>n=!0)},u=pr(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?dr:ur;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?jr:Ar,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ar(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ar(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function jr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Mr(e,t){return t?Ar(e,t)!=null:!1}function Nr(e,t){return!t||!e.getPreviousPageParam?!1:jr(e,t)!=null}var Pr=class extends Or{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Lr(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Lr(this.options);e.data!==void 0&&(this.setState(Ir(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=lr(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Kn).catch(Kn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Xn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Xn(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Yn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=pr(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?kr(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Dr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Er&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Er){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Fr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ir(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Sr.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Fr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ir(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Lr(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Rr=class extends vr{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Br(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vr(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Xn(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ir(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Hr(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Xn(this.options.enabled,this.#t)!==Xn(t.enabled,this.#t)||Xn(this.options.staleTime,this.#t)!==Xn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Xn(this.options.enabled,this.#t)!==Xn(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ir(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Kn)),t}#h(e){return!_r()&&Xn(this.options.enabled,this.#t)!==!1&&Jn(e)}#g(){this.#b();let e=Xn(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Yn(this.#r.dataUpdatedAt,e)+1;this.#u=Un.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=Un.setInterval(()=>{(this.options.refetchIntervalInBackground||yr.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Un.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Un.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Br(e,t),o=i&&Hr(e,n,t,r);(a||o)&&(l={...l,...Fr(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=lr(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=lr(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ur(e,t),refetch:this.refetch,isEnabled:Xn(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ir(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Sr.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function zr(e,t){return Xn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Xn(t.retryOnMount,e)===!1)}function Br(e,t){return zr(e,t)||e.state.data!==void 0&&Vr(e,t,t.refetchOnMount)}function Vr(e,t,n){if(Xn(t.enabled,e)!==!1&&Xn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ur(e,t)}return!1}function Hr(e,t,n,r){return(e!==t||Xn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ur(e,n)}function Ur(e,t){return Xn(t.enabled,e)!==!1&&e.isStaleByTime(Xn(t.staleTime,e))}var Wr=class extends Rr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Mr(t,n.data),hasPreviousPage:Nr(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Gr=class extends Or{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Kr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Dr({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Sr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Kr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var qr=class extends vr{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Gr({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Jr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sr.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Qn(t,e))}findAll(e={}){return this.getAll().filter(t=>Qn(e,t))}notify(e){Sr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sr.batch(()=>Promise.all(e.map(e=>e.continue().catch(Kn))))}};function Jr(e){return e.options.scope?.id}var Yr=class extends vr{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??$n(r,t),a=this.get(i);return a||(a=new Pr({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Zn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Zn(e,t)):t}notify(e){Sr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Yr,this.#t=e.mutationCache||new qr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Cr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Xn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=qn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sr.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Sr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sr.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Sr.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Kn).catch(Kn)}invalidateQueries(e,t={}){return Sr.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Sr.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Kn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Kn)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Xn(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Xn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Kn).catch(Kn)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kn).catch(Kn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Cr.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(er(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{tr(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(er(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{tr(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=$n(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===fr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const Zr=X.createContext(!1),Qr=()=>X.useContext(Zr);Zr.Provider;function $r(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const ei=X.createContext($r()),ti=()=>X.useContext(ei),ni=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?mr(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},ri=e=>{X.useEffect(()=>{e.clearReset()},[e])},ii=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||mr(n,[e.error,r])),ai=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},oi=(e,t)=>e?.suspense&&t.isPending,si=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ci(e,t,n){let r=Qr(),i=ti(),a=Bn(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ai(o),ni(o,i,s),ri(i);let[l]=X.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(X.useSyncExternalStore(X.useCallback(e=>{let t=d?l.subscribe(Sr.batchCalls(e)):Kn;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),X.useEffect(()=>{l.setOptions(o)},[o,l]),oi(o,u))throw si(o,l,i);if(ii({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function li(e,t){return ci(e,Rr,t)}function ui(e,t){let n=Bn(t),r=n.getQueryCache();return X.useSyncExternalStore(X.useCallback(e=>r.subscribe(Sr.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function di(e,t){return ci(e,Wr,t)}var fi=J();function pi(e,t){let n={options:e,onIdentityChange:t,abortController:new AbortController,auth:ke({apiUrl:e.apiUrl,fetchAstralBeamToken:e.fetchAstralBeamToken})};return Ft(n.auth,()=>{let e=Qe(n.auth);e.status===`error`&&mi(n,e.error)}),n}function mi(e,t){try{e.options.onError?.(t instanceof Error?t:Error(String(t)))}catch{}}function hi(e){e.abortController.abort(),gt(e.auth)}function gi(e,t){return yi(e,t,async t=>{let{tenantId:n,tenantExternalId:r}=e.options;return n===void 0?(await ae({page_size:1,...r===void 0?{}:{"filter[external_id]":r}},t)).items[0]??null:Ht(n,t)})}function _i(e,t,n){return yi(e,n,e=>ae(t,e))}function vi(e,t,n){return yi(e,n,async e=>{let{kind:n,tenantId:r,q:i,admin:a,size:o,cursor:s}=t,l={q:i,page_size:o,...s};if(n===`users`){if(!r)throw Error(`Select a tenant before listing its users.`);return c(r,{...l,...a===`all`?{}:{"filter[admin]":a}},e)}if(r){let t=await Ht(r,e);return{items:!i||[t.name??``,t.external_id].some(e=>e.toLocaleLowerCase().includes(i.toLocaleLowerCase()))?[t]:[],page_after:null,page_before:null}}return ae(l,e)})}function yi(e,t,n){let r=bi(e,t,n);return r.catch(n=>{let r=Qe(e.auth);!(r.status===`error`&&r.error===n)&&!e.abortController.signal.aborted&&!t.aborted&&!e.auth.session.abortController.signal.aborted&&!(n instanceof Error&&n.name===`AbortError`)&&mi(e,n)}),r}async function bi(e,t,n){let r=AbortSignal.any([t,e.abortController.signal,e.auth.session.abortController.signal]);for(let t=0;t<2;t++){r.throwIfAborted(),Re(e.auth,{apiUrl:e.options.apiUrl,fetchAstralBeamToken:e.options.fetchAstralBeamToken});let i=await Pe({...e.auth,retryUnauthorized:t===0});r.throwIfAborted();let a=Qe(e.auth);if(a.status!==`ready`)throw Error(`Authentication is not ready`);let o=a.currentUser.scope===`organization`,s=Tt(a.currentUser,e.auth.session.cached.tenantAdmin);if(e.identity!==void 0&&e.identity!==s)throw e.onIdentityChange(),new DOMException(`Identity changed`,`AbortError`);if(e.identity=s,e.options.scope===`organization`&&!o)throw Error(`Organization mode requires an organization-management token.`);if((e.options.scope??`tenant`)===`tenant`&&o&&!e.options.tenantId&&e.options.tenantExternalId===void 0)throw Error(`tenantId or tenantExternalId is required for a tenant view using an organization token.`);try{let t=await n({apiUrl:e.auth.apiUrl,astralBeamToken:i,signal:r});return r.throwIfAborted(),t}catch(n){if(t||!se(n)||n.status!==401)throw n;await ot(e.auth,i)}}throw Error(`Authentication failed`)}const xi=(0,X.createContext)(null);function Si(){return(0,X.useContext)(xi)?.defaultOptions??{}}function Ci(e){return typeof e==`function`}function wi(e,...t){return Ci(e)?e(...t):e}function Ti({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Ei(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}const Di=[];let Oi=0;const{link:ki,unlink:Ai,propagate:ji,checkDirty:Mi,shallowPropagate:Ni}=Ti({update(e){return e._update()},notify(e){Di[Fi++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,zi(e))}});let Pi=0,Fi=0,Ii,Li=0;function Ri(e){try{++Li,e()}finally{--Li||Bi()}}function zi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ai(n,e)}function Bi(){if(!(Li>0)){for(;Pi<Fi;){let e=Di[Pi];Di[Pi++]=void 0,e.notify()}Pi=0,Fi=0}}function Vi(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Ii!==void 0&&ki(i,Ii,Oi),i._snapshot},subscribe(e){let t=Ei(e),n={current:!1},r=Hi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ii,o=t?.compare??Object.is;if(n)Ii=i,++Oi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ii=a,n&&(i.flags&=-5),zi(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Mi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Ni(e)}}else e&32&&(i.flags=e&-33);return Ii!==void 0&&ki(i,Ii,Oi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ji(e),Ni(e),Bi())}},i}function Hi(e){let t=()=>{let t=Ii;Ii=n,++Oi,n.depsTail=void 0,n.flags=6;try{return e()}finally{Ii=t,n.flags&=-5,zi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Mi(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,zi(this)}};return t(),n}var Ui=class{constructor(e,t){this.atom=Vi(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Ei(e))}};function Wi(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Gi(e);if(n.length!==Gi(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Gi(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Ki=class{#e;constructor({pluginId:e}){this.#e=e}getPluginId(){return this.#e}createEventPayload(e,t){return{type:`${this.#e}:${e}`,payload:t,pluginId:this.#e}}emit(e,t){}on(e,t,n){return()=>{}}onAll(e){return()=>{}}onAllPluginEvents(e){return()=>{}}};const qi=new Map;function Ji(e,t){qi.set(e,t)}function Yi(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function Xi(e){return typeof e.get==`function`?e.get():e.state}function Zi(e){return{key:e.key,store:{state:Yi(Xi(e.store))},options:Yi(e.options)}}var Qi=class extends Ki{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}};const $i=(e,t)=>{let n=t.key;n&&(Ji(n,t),ea.emit(e,Zi({...t,key:n})))},ea=new Qi;
12
+ /**
13
+ * @license React
14
+ * use-sync-external-store-shim/with-selector.production.js
15
+ *
16
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ */
21
+ var ta=At((e=>{var t=Y(),n=Rn();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),na=At(((e,t)=>{t.exports=ta()}))();function ra(e,t){return e===t}function ia(e,t=e=>e,n){let r=n?.compare??ra,i=(0,X.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,X.useCallback)(()=>e.get(),[e]);return(0,na.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function aa(){return{canLeadingExecute:!0,executionCount:0,isPending:!1,lastArgs:void 0,status:`idle`,maybeExecuteCount:0}}const oa={enabled:!0,leading:!1,trailing:!0,wait:0};var sa=class{#e;constructor(e,t){this.fn=e,this.store=new Ui(aa()),this.setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),$i(`Debouncer`,this)},this.#n=()=>!!wi(this.options.enabled,this),this.#r=()=>wi(this.options.wait,this),this.maybeExecute=(...e)=>{if(!this.#n())return;this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=!1;this.options.leading&&this.store.state.canLeadingExecute&&(this.#t({canLeadingExecute:!1}),t=!0,this.#i(...e)),this.options.trailing&&this.#t({isPending:!0,lastArgs:e}),this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#t({canLeadingExecute:!0}),this.options.trailing&&!t&&this.#i(...e)},this.#r())},this.#i=(...e)=>{this.#n()&&(this.fn(...e),this.#t({executionCount:this.store.state.executionCount+1,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this))},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&(this.#a(),this.#i(...this.store.state.lastArgs))},this.#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)},this.cancel=()=>{this.#a(),this.#t({canLeadingExecute:!0,isPending:!1})},this.reset=()=>{this.#t(aa())},this.key=t.key,this.options={...oa,...t},this.#t(this.options.initialState??{}),this.key&&ea.on(`d-Debouncer`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a};function ca(e,t,n=()=>({})){let r={...Si().debouncer,...t},[i]=(0,X.useState)(()=>{let t=new sa(e,r);return t.Subscribe=function(e){let n=ia(t.store,e.selector,{compare:Wi});return typeof e.children==`function`?e.children(n):e.children},t});i.fn=e,i.setOptions(r),(0,X.useEffect)(()=>()=>{r.onUnmount?r.onUnmount(i):i.cancel()},[]);let a=ia(i.store,n,{compare:Wi});return(0,X.useMemo)(()=>({...i,state:a}),[i,a])}function la(e,t,n){let[r,i]=(0,X.useState)(e),a=ca(i,t,n);return[r,a.maybeExecute,a]}function ua(e,t,n){let[r,i,a]=la(e,t,n);return(0,X.useEffect)(()=>{i(e)},[e,i]),[r,a]}let da={},fa={},pa=``;function ma(e,t){return Se(e)?e:t}function ha(e,t,n){return/hidden|clip/.test(e.getComputedStyle(ma(t,n)).overflowY)}function ga(e){if(typeof document>`u`)return!1;let t=f(e);return de(t).innerWidth-t.documentElement.clientWidth>0}function _a(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=f(e),n=t.documentElement,r=t.body,i=ma(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function va(e){let t=f(e),n=t.documentElement,r=t.body,i=ma(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function ya(e){let t=f(e),n=t.documentElement,r=t.body,i=de(n),a=0,o=0,s=!1,c=ct.create();if(rn&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,da={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},pa=n.style.scrollBehavior,fa={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=ma(n,r);if(s=_a(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,da),Object.assign(r.style,fa),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=pa)}function d(){u(),c.request(l)}l();let p=q(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&p()}}const ba=new class{lockCount=0;restore=null;timeoutLock=Fn.create();timeoutUnlock=Fn.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=f(e),n=t.documentElement,r=t.body,i=de(n);if(ha(i,n,r)){let t=new i.MutationObserver(()=>{ha(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=pt||!ga(e);this.restore=a?va(e):ya(e)}};function xa(e=!0,t=null){I(()=>{if(e)return ba.acquire(t)},[e,t])}function Sa(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}const Ca={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},wa={...Ca,position:`fixed`,top:0,left:0},Ta={...Ca,position:`absolute`},Ea=X.forwardRef(function(e,t){let[n,r]=X.useState();I(()=>{on&&rn&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Z.jsx)(`span`,{...e,ref:t,style:wa,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function Da(e){return`data-base-ui-${e}`}let Oa=0;function ka(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Oa);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),l;let o=requestAnimationFrame(a);return Oa=o,()=>{Oa===o&&(cancelAnimationFrame(o),Oa=0)}}const Aa={inert:new WeakMap,"aria-hidden":new WeakMap},ja=`data-base-ui-inert`,Ma={inert:new WeakSet,"aria-hidden":new WeakSet};let Na=new WeakMap,Pa=0;function Fa(e){return Ma[e]}function Ia(e){return e?be(e)?e.host:Ia(e.parentNode):null}const La=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ia(t);return e.contains(n)?n:null}).filter(e=>e!=null),Ra=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},za=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{qt(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Ba(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=La(t,e),l=i?za(t,Ra(c),new Set(c)):[],u=[],d=[];if(a){let e=Aa[a],n=Fa(a);s=n,o=e;let r=La(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);za(t,Ra(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(Na.get(e)||0)+1;Na.set(e,t),d.push(e),t===1&&e.setAttribute(ja,``)}),Pa+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(Na.get(e)||0)-1;Na.set(e,t),t||e.removeAttribute(ja)}),--Pa,Pa||(Aa.inert=new WeakMap,Aa[`aria-hidden`]=new WeakMap,Ma.inert=new WeakSet,Ma[`aria-hidden`]=new WeakSet,Na=new WeakMap)}}function Va(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=f(e[0]).body;return Ba(e,a,n,r,{mark:i})}const Ha={style:{transition:`none`}},Ua={fallbackAxisSide:`none`},Wa={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};var Ga=Ie(je(),1);const Ka=X.createContext(null),qa=()=>X.useContext(Ka),Ja=Da(`portal`);function Ya(e={}){let{ref:t,container:n,componentProps:r=K,elementProps:i}=e,a=kt(),o=qa()?.portalNode,[s,c]=X.useState(null),[l,u]=X.useState(null),d=R(e=>{e!==null&&u(e)}),f=X.useRef(null);I(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(O(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=Gt(`div`,r,{ref:[t,d],props:[{id:a,[Ja]:``},i]}),m=s&&p?Ga.createPortal(p,s):null;return{node:l,nodeId:X.isValidElement(p)?p.props.id:void 0,subtree:m}}const Xa=X.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,...s}=e,{node:c,nodeId:l,subtree:u}=Ya({container:o,ref:t,componentProps:e,elementProps:s}),d=X.useRef(null),f=X.useRef(null),p=X.useRef(null),m=X.useRef(null),[h,g]=X.useState(null),_=X.useRef(!1),v=h?.modal,y=h?.open,b=!!h&&!h.modal&&h.open&&!!c;X.useEffect(()=>{if(!c||v)return;function e(e){c&&e.relatedTarget&&Mn(e)&&(e.type===`focusin`?_.current&&=(Pn(c),!1):(Nn(c),_.current=!0))}return Sa(q(c,`focusin`,e,!0),q(c,`focusout`,e,!0))},[c,v]),I(()=>{!c||y!==!0||!_.current||(Pn(c),_.current=!1)},[y,c]);let x=X.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:g}),[c]);return(0,Z.jsxs)(X.Fragment,{children:[u,(0,Z.jsxs)(Ka.Provider,{value:x,children:[b&&c&&(0,Z.jsx)(Ea,{"data-type":`outside`,ref:d,onFocus:e=>{Mn(e,c)?p.current?.focus():jn(h?h.domReference:null)?.focus()}}),b&&c&&(0,Z.jsx)(`span`,{"aria-owns":l,style:Wa}),c&&Ga.createPortal(a,c),b&&c&&(0,Z.jsx)(Ea,{"data-type":`outside`,ref:f,onFocus:e=>{Mn(e,c)?m.current?.focus():(An(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,V(`focus-out`,e.nativeEvent)))}})]})]})});function Za(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}const Qa=X.createContext(null),$a=X.createContext(null),eo=()=>X.useContext(Qa)?.id||null,to=e=>{let t=X.useContext($a);return e??t};function no(e,t){let n=de(M(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}let ro=[];function io(){ro=ro.filter(e=>e.deref()?.isConnected)}function ao(e){io(),e&&qt(e)!==`body`&&(ro.push(new WeakRef(e)),ro.length>20&&(ro=ro.slice(-20)))}function oo(){return io(),ro[ro.length-1]?.deref()}function so(e){return e?En(e)?e:On(e)[0]||e:null}function co(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Dn(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return En(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function lo(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=`rootStore`in t?t.rootStore:t,_=g.useState(`open`),v=g.useState(`domReferenceElement`),y=g.useState(`floatingElement`),{events:b,dataRef:S}=g.context,w=R(()=>S.current.floatingContext?.nodeId),T=i===!1,E=un(v)&&T,D=qe(i),O=qe(a),k=qe(l),A=qe(_),N=to(m),P=qa(),F=X.useRef(!1),L=X.useRef(!1),ee=X.useRef(!1),z=X.useRef(null),te=X.useRef(``),B=X.useRef(``),H=X.useRef(null),U=X.useRef(null),W=ce(H,p,P?.beforeInsideRef),ne=ce(U,P?.afterInsideRef),re=In(),G=In(),ie=Lt(),ae=P!=null,K=dn(y),oe=R((e=K)=>e?On(e):[]),se=R(()=>h?.().filter(e=>e!=null)??[]);X.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&x(K,ve(f(K)))&&oe().length===0&&!E&&fe(e)}return q(f(K),`keydown`,e)},[r,K,s,E,oe]),X.useEffect(()=>{if(r||!_)return;let e=f(K);function t(){ee.current=!1}function n(e){let t=M(e),n=se(),r=x(y,t)||x(v,t)||x(P?.portalNode,t)||n.some(e=>e===t||x(e,t));ee.current=!r,B.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(L.current=!0,G.start(0,()=>{L.current=!1}))}function i(){B.current=`keyboard`}return Sa(q(e,`pointerdown`,n,!0),q(e,`pointerup`,t,!0),q(e,`pointercancel`,t,!0),q(e,`keydown`,i,!0),t)},[r,y,v,K,_,P,G,se]),X.useEffect(()=>{if(r||!c)return;let e=f(K);function t(){L.current=!0,G.start(0,()=>{L.current=!1})}function n(e){let t=M(e);En(t)&&(z.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=M(t);s&&n==null&&i!=null&&x(y,i)&&ao(i),queueMicrotask(()=>{let a=w(),c=g.context.triggerElements,l=se(),f=n?.hasAttribute(Da(`focus-guard`))&&[H.current,U.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Le(d),Le(u)].includes(n),p=!(x(v,n)||x(y,n)||x(n,y)||x(P?.portalNode,n)||l.some(e=>e===n||x(e,n))||c.hasMatchingElement(e=>x(e,n))||f||N&&(fn(N.nodesRef.current,a).find(e=>x(e.context?.elements.floating,n)||x(e.context?.elements.domReference,n))||pn(N.nodesRef.current,a).find(e=>[e.context?.elements.floating,dn(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===v&&K&&co(K),o&&r!==v&&!Ye(i)&&ve(e)===e.body){if(j(K)&&(K.focus(),o===`popup`)){ie.request(()=>{K.focus()});return}let e=oe(),t=z.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||K;j(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(E||!s)&&n&&p&&!L.current&&(E||n!==oo())&&(F.current=!0,g.setOpen(!1,V(pe,t)))})}function a(){ee.current||(S.current.insideReactTree=!0,re.start(0,()=>{S.current.insideReactTree=!1}))}let l=j(v)?v:null;if(!(!y&&!l))return Sa(l&&q(l,`focusout`,i),l&&q(l,`pointerdown`,t),y&&q(y,`focusin`,n),y&&q(y,`focusout`,i),y&&P&&q(y,`focusout`,a,!0))},[r,v,y,K,s,N,P,g,c,o,oe,E,w,S,re,G,ie,u,d,se]),X.useEffect(()=>{if(r||!y||!_)return;let e=Array.from(P?.portalNode?.querySelectorAll(`[${Da(`portal`)}]`)||[]),t=(N?pn(N.nodesRef.current,w()):[]).find(e=>un(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Va([y,...e,H.current,U.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,...se(),t,Le(d),Le(u),E?v:null].filter(e=>e!=null),{ariaHidden:s||E,mark:!1}),i=Va([y,...e].filter(e=>e!=null));return()=>{i(),n()}},[_,r,v,y,s,P,E,N,w,u,d,se]),I(()=>{if(!_||r||!j(K))return;te.current=``,B.current=``;let e=f(K),t=ve(e);queueMicrotask(()=>{let n=D.current,r=typeof n==`function`?n(k.current||``):n;if(r===void 0||r===!1||x(K,t))return;let i=null,a=()=>(i??=oe(K),i[0]||K),o;o=r===!0||r===null?a():Le(r),o||=a();let s=x(K,ve(e));ka(o,{preventScroll:o===K,shouldFocus(){if(!A.current)return!1;if(s)return!0;let t=ve(e);return!(t!==o&&x(K,t))}})})},[r,_,K,oe,D,k,A]),I(()=>{if(r||!K)return;let e=f(K),t=ve(e),n=k.current==null;ao(t);function i(e){if(e.open||(te.current=no(e.nativeEvent,B.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(F.current=!0),e.reason===`outside-press`)if(e.nested)F.current=!1;else if(he(e.nativeEvent)||C(e.nativeEvent))F.current=!1;else{let e=!1;f(K).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?F.current=!1:F.current=!0}}b.on(`openchange`,i);function a(e){let r=O.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=v?.isConnected?v:null,o=t?.isConnected&&qt(t)!==`body`?t:null,s=n?o||a:a||o;return s||=oo()||null,typeof i==`boolean`?s:Le(i)||s||null}return()=>{b.off(`openchange`,i);let t=ve(e),n=se(),r=x(y,t)||n.some(e=>e===t||x(e,t))||N&&fn(N.nodesRef.current,w(),!1).some(e=>x(e.context?.elements.floating,t)),o=O.current,s=te.current,c=a(s);queueMicrotask(()=>{let n=so(c),i=typeof o!=`boolean`;if(o&&!F.current&&j(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}F.current=!1})}},[r,y,K,O,k,b,N,v,w,se]),I(()=>{if(!rn||_||!y)return;let e=ve(f(y));!j(e)||!ln(e)||x(y,e)&&e.blur()},[_,y]),I(()=>{if(!(r||!P))return P.setFocusManagerState({modal:s,closeOnFocusOut:c,open:_,onOpenChange:g.setOpen,domReference:v}),()=>{P.setFocusManagerState(null)}},[r,P,s,_,g,c,v]),I(()=>{if(!(r||!K))return co(K),()=>{queueMicrotask(io)}},[r,K]);let le=!r&&(!s||!E)&&(ae||s);return(0,Z.jsxs)(X.Fragment,{children:[le&&(0,Z.jsx)(Ea,{"data-type":`inside`,ref:W,onFocus:e=>{if(s){let e=oe();ka(e[e.length-1])}else P?.portalNode&&(F.current=!1,Mn(e,P.portalNode)?An(v)?.focus():Le(d??P.beforeOutsideRef)?.focus())}}),n,le&&(0,Z.jsx)(Ea,{"data-type":`inside`,ref:ne,onFocus:e=>{s?ka(oe()[0]):P?.portalNode&&(c&&(F.current=!0),Mn(e,P.portalNode)?jn(v)?.focus():Le(u??P.afterOutsideRef)?.focus())}})]})}function uo(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Ue}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=X.useRef(void 0),f=Lt(),p=In(),m=X.useMemo(()=>{function e(e,t,n,r){let i=V(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=Jt(e.pointerType,!0)&&C(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||Jt(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=M(o);if(ln(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}Jt(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return X.useMemo(()=>n?{reference:m}:K,[n,m])}function fo(){return!1}function po(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function mo(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:o=`sloppy`,referencePress:c=fo,bubbles:l,externalTree:u}=t,d=`rootStore`in e?e.rootStore:e,p=d.useState(`open`),m=d.useState(`floatingElement`),{dataRef:h}=d.context,g=to(u),v=R(typeof i==`function`?i:()=>!1),y=typeof i==`function`?v:i,C=y!==!1,w=R(()=>o),{escapeKey:T,outsidePress:E}=po(l),D=X.useRef(!1),O=X.useRef(!1),k=X.useRef(!1),A=X.useRef(!1),N=X.useRef(``),P=X.useRef(null),F=In(),I=In(),L=R(()=>{I.clear(),h.current.insideReactTree=!1}),ee=R(e=>{let t=h.current.floatingContext?.nodeId;return(g?fn(g.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),z=R(e=>sn(e,d.select(`floatingElement`))||sn(e,d.select(`domReferenceElement`))),te=R(e=>{c()&&d.setOpen(!1,V(Ue,e.nativeEvent))}),B=R(e=>{if(!p||!n||!r||e.key!==`Escape`||A.current||!T&&ee(`__escapeKeyBubbles`))return;let t=V(a,s(e)?e.nativeEvent:e);d.setOpen(!1,t),t.isCanceled||e.preventDefault(),!T&&!t.isPropagationAllowed&&e.stopPropagation()}),H=R(()=>{h.current.insideReactTree=!0,I.start(0,L)}),U=R(e=>{if(!p||!n||e.button!==0)return;let t=M(e.nativeEvent);x(d.select(`floatingElement`),t)&&(D.current||(D.current=!0,O.current=!1))}),W=R(e=>{!p||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&D.current&&(O.current=!0)});X.useEffect(()=>{if(!p||!n)return L;h.current.__escapeKeyBubbles=T,h.current.__outsidePressBubbles=E;let e=new Fn,t=new Fn;function i(){e.clear(),A.current=!0}function a(){e.start(rn?5:0,()=>{A.current=!1})}function o(){k.current=!0,t.start(0,()=>{k.current=!1})}function s(){D.current=!1,O.current=!1}function c(){let e=N.current,t=e===`pen`||!e?`mouse`:e,n=w(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function l(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function u(e){let t=h.current.floatingContext?.nodeId,n=g&&fn(g.nodesRef.current,t).some(t=>sn(e,t.context?.elements.floating));return z(e)||n}function v(e){if(l(e)){e.type!==`click`&&!z(e)&&(t.clear(),k.current=!1),L();return}if(h.current.insideReactTree){L();return}let n=M(e),r=`[${Da(`inert`)}]`,i=b(n)?n.getRootNode():null,a=Array.from((be(i)?i:f(d.select(`floatingElement`))).querySelectorAll(r)),o=d.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>x(e,n))))return;let s=b(n)?n:null;for(;s&&!Ct(s);){let e=S(s);if(Ct(e)||!b(e))break;s=e}if(!(a.length&&b(n)&&!cn(n)&&!x(n,d.select(`floatingElement`))&&a.every(e=>!x(s,e)))){if(j(n)&&!(`touches`in e)){let t=Ct(n),r=_(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!u(e)){if(c()===`intentional`&&k.current){t.clear(),k.current=!1;return}typeof y==`function`&&!y(e)||ee(`__outsidePressBubbles`)||(d.setOpen(!1,V(we,e)),L())}}}function I(e){c()!==`sloppy`||e.pointerType===`touch`||!d.select(`open`)||!n||z(e)||v(e)}function R(e){if(c()!==`sloppy`||!d.select(`open`)||!n||z(e))return;let t=e.touches[0];t&&(P.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},F.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function te(e,t){let n=M(e);if(!n)return;let r=q(n,e.type,()=>{t(e),r()})}function H(e){N.current=`touch`,te(e,R)}function U(e){F.clear(),e.type===`pointerdown`&&(N.current=e.pointerType),!(e.type===`mousedown`&&P.current&&!P.current.dismissOnMouseDown)&&te(e,e=>{e.type===`pointerdown`?I(e):v(e)})}function W(e){if(!D.current)return;let n=O.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!u(e)){if(n){o();return}typeof y==`function`&&!y(e)||(t.clear(),k.current=!0,L())}}}function ne(e){if(c()!==`sloppy`||!P.current||z(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-P.current.startX),r=Math.abs(t.clientY-P.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(P.current.dismissOnTouchEnd=!0),i>10&&(v(e),F.clear(),P.current=null)}function re(e){te(e,ne)}function G(e){c()!==`sloppy`||!P.current||z(e)||(P.current.dismissOnTouchEnd&&v(e),F.clear(),P.current=null)}function ie(e){te(e,G)}let ae=f(m),K=Sa(r&&Sa(q(ae,`keydown`,B),q(ae,`compositionstart`,i),q(ae,`compositionend`,a)),C&&Sa(q(ae,`click`,U,!0),q(ae,`pointerdown`,U,!0),q(ae,`pointerup`,W,!0),q(ae,`pointercancel`,W,!0),q(ae,`mousedown`,U,!0),q(ae,`mouseup`,W,!0),q(ae,`touchstart`,H,!0),q(ae,`touchmove`,re,!0),q(ae,`touchend`,ie,!0)));return()=>{K(),e.clear(),t.clear(),s(),k.current=!1,L()}},[h,m,r,C,y,p,n,T,E,B,L,w,ee,z,g,d,F]);let ne=X.useMemo(()=>({onKeyDown:B,onPointerDown:te,onClick:te}),[B,te]),re=X.useMemo(()=>({onKeyDown:B,onPointerDown:W,onMouseDown:W,onClickCapture:H,onMouseDownCapture(e){H(),U(e)},onPointerDownCapture(e){H(),U(e)},onMouseUpCapture:H,onTouchEndCapture:H,onTouchMoveCapture:H}),[B,H,U,W]);return X.useMemo(()=>n?{reference:ne,floating:re,trigger:ne}:{},[n,ne,re])}function ho(e,t,n){let{reference:r,floating:i}=e,a=z(t),o=Vt(t),s=h(o),c=L(t),l=a===`y`,d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,m;switch(c){case`top`:m={x:d,y:r.y-i.height};break;case`bottom`:m={x:d,y:r.y+r.height};break;case`right`:m={x:r.x+r.width,y:f};break;case`left`:m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}let g=u(t);return g&&(m[o]+=p*(g===`end`?1:-1)*(n&&l?-1:1)),m}async function go(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Wt(t,e),p=rt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=E(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=E(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}const _o=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:go},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ho(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<50&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ho(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},vo=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0,..._}=Wt(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=L(r),y=z(s),b=L(s)===s,x=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=f||(b||!g?[i(s)]:p(s)),C=h!==`none`;!f&&C&&S.push(...at(s,g,h,x));let w=[s,...S],T=await c.detectOverflow(t,_),E=[],D=a.flip?.overflows||[];if(u&&E.push(T[v]),d){let e=le(r,o,x);E.push(T[e[0]],T[e[1]])}if(D=[...D,{placement:r,overflows:E}],!E.every(e=>e<=0)){let e=(a.flip?.index||0)+1,t=w[e];if(t&&(!(d===`alignment`&&y!==z(t))||D.every(e=>z(e.placement)!==y||e.overflows[0]>0)))return{data:{index:e,overflows:D},reset:{placement:t}};let n=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(m){case`bestFit`:{let e=D.filter(e=>{if(C){let t=z(e.placement);return t===y||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(r!==n)return{reset:{placement:n}}}return{}}}},yo=new Set([`left`,`top`]);async function bo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=L(n),s=u(n),c=z(n)===`y`,l=yo.has(o)?-1:1,d=a&&c?-1:1,f=Wt(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof f==`number`?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof h==`number`&&(m=s===`end`?h*-1:h),c?{x:m*d,y:p*l}:{x:p*l,y:m*d}}const xo=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await bo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},So=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Wt(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=z(i),p=B(f),m=u[p],h=u[f],g=(e,t)=>Kt(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Co=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Wt(e,t),u={x:n,y:r},d=z(i),f=B(d),p=u[f],m=u[d],h=Wt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=yo.has(L(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},wo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Wt(e,t),c=await i.detectOverflow(t,s),l=L(n),d=u(n),f=z(n)===`y`,{width:p,height:m}=r.floating,h,g;l===`top`||l===`bottom`?(h=l,g=d===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(g=l,h=d===`end`?`top`:`bottom`);let _=m-c.top-c.bottom,y=p-c.left-c.right,b=v(m-c[h],_),x=v(p-c[g],y),S=t.middlewareData.shift,C=!S,w=b,T=x;S!=null&&S.enabled.x&&(T=y),S!=null&&S.enabled.y&&(w=_),C&&!d&&(f?T=p-2*U(c.left,c.right):w=m-2*U(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let E=await i.getDimensions(a.floating);return p!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function To(e){let t=_(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=j(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=F(n)!==a||F(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Eo(e){return b(e)?e:e.contextElement}function Do(e){let t=Eo(e);if(!j(t))return Ne(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=To(t),o=(a?F(n.width):n.width)/r,s=(a?F(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const Oo=Ne(0);function ko(t){let n=de(t);return!e()||!n.visualViewport?Oo:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Ao(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===de(e)}function jo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Eo(e),o=Ne(1);t&&(r?b(r)&&(o=Do(r)):o=Do(e));let s=Ao(a,n,r)?ko(a):Ne(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=de(a),t=b(r)?de(r):r,n=e,i=G(n);for(;i&&t!==n;){let e=Do(i),t=i.getBoundingClientRect(),r=_(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=de(i),i=G(n)}}return E({width:u,height:d,x:c,y:l})}function Mo(e,t){let n=o(e).scrollLeft;return t?t.left+n:jo(P(e)).left+n}function No(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Mo(e,n),y:n.top+t.scrollTop}}function Po(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,s=P(r),c=t?ne(t.floating):!1;if(r===s||c&&a)return n;let l={scrollLeft:0,scrollTop:0},u=Ne(1),d=Ne(0),f=j(r);if((f||!a)&&((qt(r)!==`body`||Se(s))&&(l=o(r)),f)){let e=jo(r);u=Do(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let p=s&&!f&&!a?No(s,l):Ne(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function Fo(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Io(e){let t=o(e),n=e.ownerDocument.body,r=U(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=U(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Mo(e),s=-t.scrollTop;return _(n).direction===`rtl`&&(a+=U(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:s}}function Lo(t,n,r){r===void 0&&(r=`viewport`);let i=r===`layoutViewport`,a=de(t),o=P(t),s=a.visualViewport,c=o.clientWidth,l=o.clientHeight,u=0,d=0;if(s){let t=!e()||n===`fixed`;i?t||(u=-s.offsetLeft,d=-s.offsetTop):(c=s.width,l=s.height,t&&(u=s.offsetLeft,d=s.offsetTop))}if(Mo(o)<=0){let e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(o.clientWidth-t.clientWidth-r),a=getComputedStyle(o).scrollbarGutter===`stable both-edges`?i/2:i;a<=25&&(c-=a)}return{width:c,height:l,x:u,y:d}}function Ro(e,t){let n=jo(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Do(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function zo(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Lo(e,n,t);else if(t===`document`)r=Io(P(e));else if(b(t))r=Ro(t,n);else{let n=ko(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return E(r)}function Bo(e,t){let n=t.get(e);if(n)return n;let r=me(e,[],!1).filter(e=>b(e)&&qt(e)!==`body`),i=null,a=_(e).position===`fixed`,o=a?S(e):e;for(;b(o)&&!Ct(o);){let e=_(o),t=_e(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=S(o)}return t.set(e,r),r}function Vo(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ne(t)?[]:Bo(t,this._c):[].concat(n),r],o=zo(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=zo(t,a[e],i);s=U(n.top,s),c=v(n.right,c),l=v(n.bottom,l),u=U(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ho(e){let{width:t,height:n}=To(e);return{width:t,height:n}}function Uo(e,t,n){let r=j(t),i=P(t),a=n===`fixed`,s=jo(e,!0,a,t),c={scrollLeft:0,scrollTop:0},l=Ne(0);if((r||!a)&&((qt(t)!==`body`||Se(i))&&(c=o(t)),r)){let e=jo(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!r&&i&&(l.x=Mo(i));let u=i&&!r&&!a?No(i,c):Ne(0);return{x:s.left+c.scrollLeft-l.x-u.x,y:s.top+c.scrollTop-l.y-u.y,width:s.width,height:s.height}}function Wo(e){return _(e).position===`static`}function Go(e,t){if(!j(e)||_(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function Ko(e,t){let n=de(e);if(ne(e))return n;if(!j(e)){let t=S(e);for(;t&&!Ct(t);){if(b(t)&&!Wo(t))return t;t=S(t)}return n}let r=Go(e,t);for(;r&&Te(r)&&Wo(r);)r=Go(r,t);return r&&Ct(r)&&Wo(r)&&!_e(r)?n:r||T(e)||n}const qo=async function(e){let t=this.getOffsetParent||Ko,n=this.getDimensions,r=await n(e.floating);return{reference:Uo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jo(e){return _(e).direction===`rtl`}const Yo={convertOffsetParentRelativeRectToViewportRelativeRect:Po,getDocumentElement:P,getClippingRect:Vo,getOffsetParent:Ko,getElementRects:qo,getClientRects:Fo,getDimensions:Ho,getScale:Do,isElement:b,isRTL:Jo};function Xo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zo(e,t,n){let r=null,i,a=P(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=oe(d),h=oe(a.clientWidth-(u+f)),g=oe(a.clientHeight-(d+p)),_=oe(u),y={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:U(0,v(1,c))||1},b=!0;function x(t){let n=t[0].intersectionRatio;if(!Xo(l,e.getBoundingClientRect()))return s();if(n!==c){if(!b)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(x,{...y,root:a.ownerDocument})}catch{r=new IntersectionObserver(x,y)}r.observe(e)}let c=de(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Qo(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Eo(e),u=i||a?[...l?me(l):[],...t?me(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Zo(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?jo(e):null;c&&g();function g(){let t=jo(e);h&&!Xo(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}const $o=xo,es=So,ts=vo,ns=wo,rs=Co,is=(e,t,n)=>{let r=new Map,i=n??{},a={...Yo,...i.platform,_c:r};return _o(e,t,{...i,platform:a})};var as=typeof document<`u`?X.useLayoutEffect:function(){};function os(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!os(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!os(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ss(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function cs(e,t){let n=ss(e);return Math.round(t*n)/n}function ls(e){let t=X.useRef(e);return as(()=>{t.current=e}),t}function us(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=X.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=X.useState(r);os(f,r)||p(r);let[m,h]=X.useState(null),[g,_]=X.useState(null),v=X.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=X.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=X.useRef(null),C=X.useRef(null),w=X.useRef(u),T=c!=null,E=ls(c),D=ls(i),O=ls(l),k=X.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),is(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!os(w.current,t)&&(w.current=t,Ga.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);as(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=X.useRef(!1);as(()=>(A.current=!0,()=>{A.current=!1}),[]),as(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=X.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=X.useMemo(()=>({reference:b,floating:x}),[b,x]),N=X.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=cs(M.floating,u.x),r=cs(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ss(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return X.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}const ds=(e,t)=>{let n=$o(e);return{name:n.name,fn:n.fn,options:[e,t]}},fs=(e,t)=>{let n=es(e);return{name:n.name,fn:n.fn,options:[e,t]}},ps=(e,t)=>({fn:rs(e).fn,options:[e,t]}),ms=(e,t)=>{let n=ts(e);return{name:n.name,fn:n.fn,options:[e,t]}},hs=(e,t)=>{let n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},gs=[];function _s(e){gs.push(e)}var vs=Rn();const ys=Bt(19)?xs:Ss;function Q(e,t,n,r,i){return ys(e,t,n,r,i)}function bs(e,t,n,r,i){let a=X.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,vs.useSyncExternalStore)(e.subscribe,a,a)}_s({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,vs.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function xs(e,t,n,r,i){return bs(e,t,n,r,i)}function Ss(e,t,n,r,i){return(0,na.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Cs=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Q(this,e,t,n,r)}},ws=class extends Cs{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){X.useDebugValue(e);let n=this;I(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;I(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;I(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){X.useDebugValue(e);let n=this,r=t!==void 0;I(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return X.useDebugValue(e),Q(this,this.selectors[e],t,n,r)}useContextCallback(e,t){X.useDebugValue(e);let n=R(t??l);this.context[e]=n}useStateSetter(e){let t=X.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};const Ts={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};var Es=class extends ws{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Za(),nested:n,triggerElements:i},Ts),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&ie(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};const Ds={tabIndex:-1,[Ee]:``};var Os=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function ks(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=kt(),a=eo()!=null,o=H(()=>new Es({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Os,floatingId:i,syncOnly:!1,nested:a})).current;return I(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=b(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function As(e){return js(e,e.rootContext)}function js(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=X.useState(null),[d,f]=X.useState(void 0),[p,m]=X.useState(void 0),h=X.useRef(null),g=to(r),_=X.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=us({...e,elements:{..._,...l&&{reference:l}}}),y=b(d)?d:null,x=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,x);let S=X.useCallback(e=>{let t=b(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),C=X.useCallback(e=>{(b(e)||e===null)&&(h.current=e,f(e)),(b(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!b(e))&&v.refs.setReference(e)},[v.refs,f]),w=X.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),T=X.useMemo(()=>({...v.refs,setReference:C,setFloating:w,setPositionReference:S,domReference:h}),[v.refs,C,w,S]),E=X.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),D=X.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:T,elements:E,nodeId:n,rootStore:t}),[v,T,E,n,t,s,c]);return I(()=>{o&&(h.current=o)},[o]),I(()=>{t.context.dataRef.current.floatingContext=D;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=D)}),X.useMemo(()=>({...v,context:D,refs:T,elements:E,rootStore:t}),[v,T,E,D,t])}function Ms(e){return rn&&e.movementX===0&&e.movementY===0}function Ns(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Ps(e,t){return Ns(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Fs(e,t,n){return Ns(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Is(e,t,n){return Ns(t,n?e===k:e===Ce,e===wt)}function Ls(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:Ns(t,n?e===Ce:e===k,e===xe)}function Rs(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:p=`auto`,focusItemOnHover:m=!0,openOnArrowKeyDown:h=!0,disabledIndices:g=void 0,orientation:_=`vertical`,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:S,grid:w}=t,T=w!=null,E=`rootStore`in e?e.rootStore:e,O=E.useState(`open`),k=E.useState(`floatingElement`),A=E.useState(`domReferenceElement`),N=E.context.dataRef,P=dn(k),F=un(A),L=qe(P),ee=eo(),z=to(S),te=X.useRef(p),B=X.useRef(o??-1),H=X.useRef(null),U=X.useRef(!0),W=R(e=>{i(B.current===-1?null:B.current,e)}),ne=X.useRef(!!k),re=X.useRef(O),G=X.useRef(!1),ie=X.useRef(!1),ae=X.useRef(null),K=qe(g),oe=qe(O),se=qe(o),ce=qe(b),le=Lt(),ue=Lt(),de=R(()=>{function e(e){d?z?.events.emit(`virtualfocus`,e):ae.current=ka(e,{sync:G.current,preventScroll:!0})}let t=n.current[B.current],r=ie.current;t&&e(t),(G.current?e=>e():e=>le.request(e))(()=>{let i=n.current[B.current]||t;i&&(t||e(i),xe&&(r||!U.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});I(()=>{N.current.orientation=_},[N,_]),I(()=>{a&&(O&&k?(B.current=o??-1,te.current&&o!=null&&(ie.current=!0,W())):ne.current&&(B.current=-1,W()))},[a,O,k,o,W]),I(()=>{if(a){if(!O){G.current=!1;return}if(k)if(r==null){if(G.current=!1,se.current!=null)return;if(ne.current&&(B.current=-1,de()),(!re.current||!ne.current)&&te.current&&(H.current!=null||te.current===!0&&H.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ue.request(e):queueMicrotask)(t),e+=1):(B.current=H.current==null||Fs(H.current,_,u)||l?Ze(n):dt(n),H.current=null,W())};t()}}else Oe(n.current,r)||(B.current=r,de(),ie.current=!1)}},[a,O,k,r,se,l,n,_,u,W,de,ue]),I(()=>{if(!a||k||!z||d||!ne.current)return;let e=z.nodesRef.current,t=e.find(e=>e.id===ee)?.context?.elements.floating,n=ve(f(A??t??null)),r=e.some(e=>e.context&&x(e.context.elements.floating,n));t&&!r&&U.current&&t.focus({preventScroll:!0})},[a,k,A,z,ee,d]),I(()=>{re.current=O,ne.current=!!k}),I(()=>{O||(H.current=null,te.current=p)},[O,p]);let me=r!=null,ge=R(e=>{if(!oe.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(B.current!==t||r!==t)&&(B.current=t,W(e))}),_e=R(()=>v??z?.nodesRef.current.find(e=>e.id===ee)?.context?.dataRef?.current.orientation),ye=R(()=>Ze(n,K.current)),be=R(e=>{if(U.current=!1,G.current=!0,e.which===229||!oe.current&&e.currentTarget===L.current)return;if(l&&Ls(e.key,_,u,T)){Ps(e.key,_e())||fe(e),E.setOpen(!1,V(D,e.nativeEvent)),j(A)&&(d?z?.events.emit(`virtualfocus`,A):A.focus());return}let t=B.current,r=Ze(n,g),i=dt(n,g);if(F||(e.key===`Home`&&(fe(e),B.current=r,W(e)),e.key===`End`&&(fe(e),B.current=i,W(e))),w!=null){let t=w(e,B.current,n,_,c,u,g,r,i);if(t!=null&&(B.current=t,W(e)),_===`both`)return}if(Ps(e.key,_)){if(fe(e),O&&!d&&ve(e.currentTarget.ownerDocument)===e.currentTarget){B.current=Fs(e.key,_,u)?r:i,W(e);return}Fs(e.key,_,u)?c?t>=i?s&&t!==n.current.length?B.current=-1:(G.current=!1,B.current=r):B.current=Ke(n.current,{startingIndex:t,disabledIndices:g}):B.current=Math.min(i,Ke(n.current,{startingIndex:t,disabledIndices:g})):c?t<=r?s&&t!==-1?B.current=n.current.length:(G.current=!1,B.current=i):B.current=Ke(n.current,{startingIndex:t,decrement:!0,disabledIndices:g}):B.current=Math.max(r,Ke(n.current,{startingIndex:t,decrement:!0,disabledIndices:g})),Oe(n.current,B.current)&&(B.current=-1),W(e)}}),xe=X.useMemo(()=>({onFocus(e){G.current=!0,ge(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Ms(e)||(G.current=!0,ie.current=!1,m&&ge(e))},onPointerLeave(e){if(!oe.current||!U.current||e.pointerType===`touch`)return;G.current=!0;let t=e.relatedTarget;if(!(!m||n.current.includes(t))&&ce.current&&(ae.current?.(),ae.current=null,B.current=-1,W(e),!d)){let e=L.current,t=ve(f(e));e&&x(e,t)&&e.focus({preventScroll:!0})}}}),[ge,oe,L,m,n,W,ce,d]),Se=X.useMemo(()=>d&&O&&me&&{"aria-activedescendant":`${y}-${r}`},[d,O,me,y,r]),Ce=X.useMemo(()=>({"aria-orientation":_===`both`?void 0:_,...F?{}:Se,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&O&&!d){let t=M(e.nativeEvent);if(t&&!x(L.current,t))return;fe(e),E.setOpen(!1,V(pe,e.nativeEvent)),j(A)&&A.focus();return}be(e)},onPointerMove(e){Ms(e)||(U.current=!0)}}),[Se,be,L,_,F,E,O,d,A]),we=X.useMemo(()=>{function e(e){E.setOpen(!0,V(D,e.nativeEvent,e.currentTarget))}function t(e){p===`auto`&&he(e.nativeEvent)&&(te.current=!d)}function n(e){te.current=p,p===`auto`&&C(e.nativeEvent)&&(te.current=!0)}return{onKeyDown(t){let n=E.select(`open`);U.current=!1;let r=t.key.startsWith(`Arrow`),i=Is(t.key,_e(),u),a=Ps(t.key,_),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return be(t);if(!(!n&&!h&&r)){if(o){let e=Ps(t.key,_e());H.current=l&&e?null:t.key}if(l){i&&(fe(t),n?(B.current=ye(),W(t)):e(t));return}a&&(se.current!=null&&(B.current=se.current),fe(t),!n&&h?e(t):be(t),n&&W(t))}},onFocus(e){E.select(`open`)&&!d&&(B.current=-1,W(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[be,p,ye,l,W,E,h,_,_e,u,se,d]),Te=X.useMemo(()=>({...Se,...we}),[Se,we]);return X.useMemo(()=>a?{reference:Te,floating:Ce,item:xe,trigger:we}:{},[a,Te,Ce,we,xe])}function zs(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=In(),m=X.useRef(``),h=X.useRef(u??i??-1),g=X.useRef(null),_=R(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!Ye(n)||n?.matches(`:disabled`)?!1:o==null||!zt(Ut,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!c(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(fe(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(fe(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=R(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);x(n,t)||x(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});I(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=X.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return X.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}(function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=et.startingStyle]=`startingStyle`,e[e.endingStyle=et.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e})({});const Bs={"data-popup-open":``},Vs={"data-popup-open":``,"data-pressed":``},Hs={"data-open":``},Us={"data-closed":``},Ws={"data-anchor-hidden":``},Gs={open(e){return e?Bs:null}},Ks={open(e){return e?Vs:null}},qs={open(e){return e?Hs:Us},anchorHidden(e){return e?Ws:null}};({...qs,...Me});const Js=X.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Z.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function Ys(e){let t=X.useRef(``),n=X.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:X.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Xs(e,t){let n=X.useRef(e),r=R(t);I(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Zs(e,t){let{onClick:n,onPointerDown:r}=Ys(R((n,r)=>{(typeof e==`function`?e():e)||t(r||(pt?`touch`:``))}));return X.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Qs(e){let[t,n]=X.useState(null),r=Zs(e,n);return Xs(e,t=>{t&&!e&&n(null)}),X.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function $s(e){let t=X.useRef(!0);t.current&&(t.current=!1,e())}function ec(e,t,n,r,i,a,o,s,c,l=2){let u=xt(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return Oe(n.current,u)?void 0:u}const tc=X.createContext(void 0),nc=X.createContext(void 0),rc=X.createContext(void 0),ic=X.createContext(!1),ac=X.createContext(``);function oc(){let e=X.useContext(tc);if(!e)throw Error(r(22));return e}function sc(){let e=X.useContext(nc);if(!e)throw Error(r(23));return e}function cc(){let e=X.useContext(rc);if(!e)throw Error(r(24));return e}function lc(){return X.useContext(ac)}function uc(){return X.useContext(ic)}const dc=(e,t)=>Object.is(e,t);function fc(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function pc(e,t,n){return!e||e.length===0?!1:e.some(e=>e!==void 0&&fc(t,e,n))}function mc(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&fc(e,t,n))}function hc(e,t,n,r){let i=mc(e,r&&Array.isArray(t)?t[t.length-1]:t,n);return i===-1?null:i}function gc(e,t,n){return e.filter(e=>!fc(t,e,n))}function _c(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function vc(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function yc(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(vc(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function bc(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return _c(e)}function xc(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?_c(e.value):_c(e)}const $={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?yc(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>fc(t,e,n)):fc(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function Sc(e){return e==null?void 0:`${e}-popup`}function Cc(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function wc(e){return Array.isArray(e)?e.map(e=>wc(e)).join(`,`):e==null?``:String(e)}const Tc=new Map;function Ec(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${wc(e.locale)}|${JSON.stringify(t)}`,r=Tc.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=bc(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=bc(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=bc(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return Tc.set(n,a),a}const Dc=Ec;function Oc(e,t=!1){let{overflowY:n}=_(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}function kc(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}const Ac=Symbol(`none`),jc={value:Ac,index:-1};function Mc(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:u=!1,selectionMode:d,onItemHighlighted:f,name:p,form:m,disabled:h=!1,readOnly:_=!1,required:v=!1,inputRef:b,grid:S=!1,items:C,filteredItems:w,filter:T,openOnInputClick:E=!0,autoHighlight:D=!1,keepHighlight:O=!1,highlightItemOnHover:k=!0,loopFocus:N=!0,itemToStringLabel:P,itemToStringValue:F,isItemEqualToValue:L=dc,virtualized:ee=!1,inline:z=!1,fillInputOnItemPress:te=!0,modal:B=!1,limit:U=-1,autoComplete:ne=`list`,formAutoComplete:re,locale:G,submitOnItemClick:ie=!1}=e,{clearErrors:ae}=Fe(),{setDirty:oe,validityData:se,setFilled:le,name:ue,disabled:de,setTouched:fe,setFocused:pe,validationMode:he,validation:_e}=ze(),ve=We(),be=$e({id:t}),xe=Dc({locale:G}),[Se,Ce]=X.useState(!1),[we,Te]=X.useState(null),Ee=X.useRef([]),q=X.useRef([]),De=X.useRef(null),Oe=X.useRef(null),ke=X.useRef(null),Ae=X.useRef(null),je=X.useRef(null),Me=X.useRef(!0),Ne=X.useRef(!1),Pe=X.useRef(null),Ie=X.useRef(null),Le=X.useRef(null),Re=X.useRef(jc),Be=X.useRef(null),Ve=X.useRef([]),He=X.useRef(null),Ue=de||h,Ge=ue??p,Ke=d===`multiple`,Je=d===`single`,Ye=s!==void 0||o!==void 0,Xe=C!==void 0,Ze=w!==void 0,Qe;Qe=D===`always`?`always`:D?`input-change`:!1;let[J,et]=ht({controlled:i,default:Ke?r??Ut:r,name:`Combobox`,state:`selectedValue`}),tt=X.useMemo(()=>T===null?()=>!0:T===void 0?Cc(xe,P):T,[T,xe,P]),rt=H(()=>Ye?o??``:Je?bc(J,P):``).current,[it,at]=ht({controlled:s,default:rt,name:`Combobox`,state:`inputValue`}),[ot,st]=ht({controlled:c,default:u,name:`Combobox`,state:`open`}),ct=vc(C),lt=we??String(it).trim(),ut=Je?bc(J,P):``,dt=Je&&!Se&&lt!==``&&ut.length===lt.length&&xe.contains(ut,lt),ft=dt?``:lt,pt=Xe&&Ze&&dt,mt=X.useMemo(()=>C?ct?C.flatMap(e=>e.items):C:Ut,[C,ct]),gt=X.useMemo(()=>{if(w&&!pt)return w;if(!C)return Ut;if(ct){let e=C,t=[],n=0;for(let r of e){if(U>-1&&n>=U)break;let e=U>-1?U-n:1/0,i=ft===``?r.items.slice(0,e):[];if(ft!==``)for(let t of r.items){if(i.length>=e)break;tt(t,ft,P)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(ft===``)return U>-1?mt.slice(0,U):mt;let e=[];for(let t of mt){if(U>-1&&e.length>=U)break;tt(t,ft,P)&&e.push(t)}return e},[w,pt,C,ct,ft,U,tt,P,mt]),_t=X.useMemo(()=>ct?gt.flatMap(e=>e.items):gt,[gt,ct]),Y=H(()=>{let e=null;return z&&ot&&Xe&&d!==`none`&&(e=hc(_t,J,L,Ke)),new Cs({id:be,labelId:void 0,selectedValue:J,open:ot,items:C,selectionMode:d,listRef:Ee,labelsRef:q,popupRef:De,emptyRef:je,inputRef:Oe,startDismissRef:ke,endDismissRef:Ae,keyboardActiveRef:Me,chipsContainerRef:Pe,clearRef:Ie,valuesRef:Ve,pointerDownItemRef:He,selectionEventRef:Le,name:Ge,form:m,disabled:Ue,readOnly:_,required:v,grid:S,virtualized:ee,openOnInputClick:E,itemToStringLabel:P,isItemEqualToValue:L,modal:B,autoHighlight:Qe,submitOnItemClick:ie,hasInputValue:Ye,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:z,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:K,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:d===`none`,onOpenChangeComplete:l,setOpen:l,setInputValue:l,setSelectedValue:l,setIndices:l,handleSelection:l,forceMount:l,requestSubmit:l})}).current,yt=d===`none`?it:J,bt=X.useMemo(()=>d===`none`?yt:Array.isArray(J)?J.map(e=>xc(e,F)):xc(J,F),[yt,F,d,J]),xt=R(f),Ct=R(n),wt=Q(Y,$.activeIndex),Tt=Q(Y,$.selectedIndex),Et=Q(Y,$.positionerElement),Dt=Q(Y,$.listElement),kt=Q(Y,$.triggerElement),At=Q(Y,$.inputElement),jt=Q(Y,$.inputGroupElement),Mt=Q(Y,$.inline),Nt=Q(Y,$.inputInsidePopup),Ft=Q(Y,$.inputOwnsFormValue),It=qe(kt),{mounted:Lt,setMounted:Rt,transitionStatus:zt}=Ot(ot),{openMethod:Bt,triggerProps:Vt}=Qs(ot),Ht=R(()=>bt);Pt(Nt?It:Oe,be,yt,Ht,!Ue,p);let Wt=R(()=>{C?q.current=_t.map(e=>bc(e,P)):Y.set(`forceMounted`,!0)}),Gt=R((e,t,n)=>{if(t===-1){if(Re.current===jc)return;Re.current=jc}else Re.current={value:e,index:t};xt(e,g(n,void 0,{index:t}))}),Kt=R(e=>{Y.update(e);let t=e.activeIndex;if(t===void 0)return;let n=e.type||`none`;t===null?Gt(void 0,-1,n):Gt(Ve.current[t],t,n)}),qt=R((t,n)=>{if(Ne.current=n.reason===ge,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){ot&&we!==null&&Te(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&Ce(!0),Be.current={hasQuery:e};let n=Y.state.listElement;if(!Y.state.virtualized&&n){let e=De.current;for(let t of me(n.firstElementChild??n)){if(!j(t)||(e?!x(e,t):t.getAttribute(`role`)===`dialog`))break;if(Oc(t)){t.scrollTop=0;break}}}e&&Qe&&Y.state.activeIndex==null&&(ot||Mt)&&Y.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&Y.state.inputInsidePopup&&(Be.current={hasQuery:!1,selection:!0});at(t)}}),Jt=R((t,n)=>{if(ot!==t&&(n.reason===`escape-key`&&Xe&&_t.length===0&&!je.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&Nt&&!Mt&&we!==null&&(Ce(!1),Te(null),it!==``&&n.reason!==`input-change`&&qt(``,V(ge,n.event))),!t&&Se&&(Je?(Mt||Te(lt),lt===``&&Ce(!1)):Ke&&(Mt||Te(lt),Nt&&Kt({activeIndex:null}),(!Nt||Mt)&&qt(``,V(ge,n.event)))),st(t),!t&&Nt&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(fe(!0),pe(!1),he===`onBlur`)))){let e=d===`none`?it:J;_e.commit(e)}}),Yt=R((e,t)=>{a?.(e,t),!t.isCanceled&&(et(e),(d===`none`&&De.current&&te||Je&&!Y.state.inputInsidePopup)&&qt(bc(e,P),V(t.reason,t.event)))}),Xt=R((e,t)=>{let n=M(e),r=Le.current??e;Le.current=null;let i=V(A,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a){a.startsWith(`#`)&&Jt(!1,i);return}if(Ke){let e=Array.isArray(J)?J:[],n=pc(e,t,L)?gc(e,t,L):[...e,t];if(Yt(n,i),i.isCanceled||!(Oe.current&&Oe.current.value.trim()!==``))return;Y.state.inputInsidePopup?qt(``,V(ge,i.event)):Jt(!1,i)}else{if(Yt(t,i),i.isCanceled)return;Jt(!1,i)}}),Zt=R(()=>{let e=_e.inputRef.current?.form??Y.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),Qt=R(()=>{if(Rt(!1),Ct?.(!1),Ce(!1),Te(null),Kt(d===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ke&&Oe.current&&Oe.current.value!==``&&!Ne.current&&qt(``,V(ge)),Je)if(Y.state.inputInsidePopup)Oe.current&&Oe.current.value!==``&&qt(``,V(ge));else{let e=bc(J,P);Oe.current&&Oe.current.value!==e&&qt(e,V(e===``?ge:ye))}}),$t=X.useMemo(()=>Mt&&Et?{current:Et.closest(`[role="dialog"]`)}:De,[Mt,Et]);vt({enabled:!e.actionsRef,open:ot,ref:$t,onComplete(){ot||Qt()}}),X.useImperativeHandle(e.actionsRef,()=>({unmount:Qt}),[Qt]),I(function(){if(ot||(He.current=null,d===`none`))return;let e=Xe?mt:Ve.current;Kt({selectedIndex:hc(e,J,L,Ke)})},[ot,J,d,Ke,Xe,mt,L,Kt]),I(()=>{C&&(Ve.current=_t,Ee.current.length=_t.length)},[C,_t]),I(()=>{let e=Be.current;if(e){let t=ot||Mt||Y.state.positionerElement?.hidden===!1;if(e.hasQuery)Qe&&t&&Y.set(`activeIndex`,0),Be.current=null;else if(String(it).trim()===``&&(Be.current=null,t)){let t=e.selection;Qe===`always`&&!t&&Y.state.selectionMode===`none`&&Y.set(`activeIndex`,0),queueMicrotask(()=>{if(!Y.state.open&&!Y.state.inline||Oe.current&&Oe.current.value.trim()!==``)return;let e=Y.state.selectedValue,n=Y.state.selectionMode===`multiple`,r=n&&Array.isArray(e)?e[e.length-1]:e,i=Y.state.selectionMode!==`none`&&r!=null;if(i||t){let t=Xe||Ze?_t:Ve.current;Y.set(`activeIndex`,i?hc(t,e,Y.state.isItemEqualToValue,n):null)}else Qe===`always`&&Y.set(`activeIndex`,0)})}}if(!ot&&!Mt)return;let t=Xe||Ze?_t:Ve.current,n=Y.state.activeIndex;if(n==null){if(Qe===`always`&&t.length>0){Y.set(`activeIndex`,0);return}Gt(void 0,-1,ye);return}if(n>=t.length){Gt(void 0,-1,ye),Y.set(`activeIndex`,null);return}let r=t[n],i=Re.current.value,a=i!==Ac&&fc(r,i,Y.state.isItemEqualToValue);(Re.current.index!==n||!a)&&Gt(r,n,ye)},[wt,Qe,Gt,Ze,Xe,_t,Mt,ot,Y,it]),I(()=>{if(d===`none`){le(String(it)!==``);return}le(Ke?Array.isArray(J)&&J.length>0:J!=null)},[le,d,it,J,Ke]),X.useEffect(()=>{Xe&&Qe&&_t.length===0&&Kt({activeIndex:null})},[Xe,Qe,_t.length,Kt]);function en(e){let t=se.initialValue;return Array.isArray(e)&&Array.isArray(t)?!kc(e,t,(e,t)=>fc(e,t,L)):e!==t}Xs(lt,()=>{!ot||lt===``||lt===String(rt)||Ce(!0)});function tn(){let e=bc(J,P);it!==e&&qt(e,V(ye))}Xs(J,()=>{d!==`none`&&(ae(Ge),oe(en(J)),_e.change(J),Je&&!Ye&&!Nt&&tn())}),Xs(it,()=>{d===`none`&&(ae(Ge),oe(it!==se.initialValue),_e.change(it))}),Xs(C,()=>{!Je||Ye||Nt||Se||tn()});let nn=ks({open:Mt?!0:ot,onOpenChange:Jt,elements:{reference:Nt?kt:At,floating:Et}}),rn=S?`grid`:`listbox`,an=ot||Mt,on=an?`true`:`false`,sn=X.useMemo(()=>{let e=At?.tagName===`INPUT`,t=At==null||e,n=t||an,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=on,r[`aria-haspopup`]=rn,r[`aria-controls`]=an?Dt?.id:void 0,r[`aria-autocomplete`]=ne),{reference:r,floating:{role:`presentation`}}},[At,an,on,rn,Dt?.id,ne]),cn=uo(nn,{enabled:!_&&!Ue&&E,event:`mousedown-only`,toggle:!1,touchOpenDelay:Nt?0:100,reason:y}),ln=mo(nn,{enabled:!_&&!Ue&&!Mt,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:Mt?!0:void 0,outsidePress(e){let t=M(e);return!x(kt,t)&&!x(Ie.current,t)&&!x(Pe.current,t)&&!x(jt,t)}}),un=Rs(nn,{enabled:!_&&!Ue,id:be,listRef:Ee,activeIndex:wt,selectedIndex:Tt,virtual:!0,loopFocus:N,allowEscape:N&&!Qe,focusItemOnOpen:Se||d===`none`&&!Qe?!1:`auto`,focusItemOnHover:k,resetOnPointerLeave:!O,orientation:S?`horizontal`:void 0,rtl:ve===`rtl`,disabledIndices:Ut,grid:S?ec:void 0,onNavigate(e,t){!t&&!ot||zt===`ending`||Kt(t?{activeIndex:e,type:Me.current?St:W}:{activeIndex:e})}}),dn=X.useMemo(()=>nt(un.reference,{onKeyDown(e){S&&Y.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},ln.reference,cn.reference,sn.reference),[un.reference,ln.reference,cn.reference,sn.reference,S,Y]),fn=X.useMemo(()=>nt(Ds,ln.floating),[ln.floating]),pn=X.useMemo(()=>nt(un.floating,sn.floating),[un.floating,sn.floating]),mn=X.useMemo(()=>{let e=un.item;return e?{...e,onFocus:void 0}:K},[un.item]);$s(()=>{Y.update({inline:z,popupProps:fn,listProps:pn,inputProps:dn,triggerProps:Vt,itemProps:mn,setOpen:Jt,setInputValue:qt,setSelectedValue:Yt,setIndices:Kt,handleSelection:Xt,forceMount:Wt,requestSubmit:Zt,onOpenChangeComplete:Ct})}),I(()=>{Y.update({id:be,selectedValue:J,open:ot,mounted:Lt,transitionStatus:zt,items:C,inline:z,popupProps:fn,listProps:pn,inputProps:dn,triggerProps:Vt,openMethod:Bt,itemProps:mn,selectionMode:d,name:Ge,form:m,disabled:Ue,readOnly:_,required:v,grid:S,virtualized:ee,openOnInputClick:E,itemToStringLabel:P,modal:B,autoHighlight:Qe,isItemEqualToValue:L,submitOnItemClick:ie,hasInputValue:Ye,inputOwnsFormValue:d===`none`&&(z||!Y.state.inputInsidePopup)})},[Y,be,J,ot,Lt,zt,C,fn,pn,dn,mn,Bt,Vt,d,Ge,Ue,_,v,S,ee,E,P,B,L,ie,Ye,z,Qe,m]);let hn=ce(b,_e.inputRef),gn=X.useMemo(()=>({query:lt,hasItems:Xe,filteredItems:gt,flatFilteredItems:_t}),[lt,Xe,gt,_t]),_n=X.useMemo(()=>Array.isArray(yt)?``:xc(yt,F),[yt,F]),vn=Ke&&Array.isArray(J)&&J.length>0,yn=Ke||d===`none`&&Ft?void 0:Ge,bn=X.useMemo(()=>!Ke||!Array.isArray(J)||!Ge?null:J.map(e=>{let t=xc(e,F);return(0,Z.jsx)(`input`,{type:`hidden`,form:m,name:Ge,value:t,disabled:Ue},t)}),[Ke,J,m,Ge,F,Ue]),xn=(0,Z.jsxs)(X.Fragment,{children:[e.children,(0,Z.jsx)(`input`,{..._e.getValidationProps(Ue,{onFocus(){if(Nt){kt?.focus();return}(Oe.current||kt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ue||_)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=V(ye,e.nativeEvent),i=()=>Ve.current.findIndex(e=>xc(e,F).toLowerCase()===n||bc(e,P).toLowerCase()===n);function a(){if(Ke)return;if(d===`none`){qt(t,r);return}let e=i();e===-1&&(e=Ve.current.findIndex((e,t)=>{let r=q.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:Ve.current[e];a!=null&&Yt?.(a,r)}Je&&(Wt(),C&&i()===-1&&Y.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:be&&yn==null?`${be}-hidden-input`:void 0,form:m,name:yn,autoComplete:re,disabled:Ue,required:v&&!vn,readOnly:_,value:_n,ref:hn,style:yn?Ta:wa,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),bn]});return(0,Z.jsx)(tc.Provider,{value:Y,children:(0,Z.jsx)(nc.Provider,{value:nn,children:(0,Z.jsx)(ic.Provider,{value:Xe,children:(0,Z.jsx)(rc.Provider,{value:gn,children:(0,Z.jsx)(ac.Provider,{value:it,children:xn})})})})})}const Nc={...Ks,...bt,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null};function Pc(e,t){let n=Fc(t);return e.clientX>=n.left-5&&e.clientX<=n.right+5&&e.clientY>=n.top-5&&e.clientY<=n.bottom+5}function Fc(e){let n=e.getBoundingClientRect(),r=de(e);if(t)return n;let i=r.getComputedStyle(e,`::before`),a=r.getComputedStyle(e,`::after`);if(!(i.content!==`none`||a.content!==`none`))return n;let o=parseFloat(i.width)||0,s=parseFloat(i.height)||0,c=parseFloat(a.width)||0,l=parseFloat(a.height)||0,u=Math.max(n.width,o,c),d=Math.max(n.height,s,l),f=u-n.width,p=d-n.height;return{left:n.left-f/2,right:n.right+f/2,top:n.top-p/2,bottom:n.bottom+p/2}}function Ic(e,t){return e??t}function Lc(e){let t=Q(e,$.mounted),n=Q(e,$.popupSide),r=Q(e,$.positionerElement);return t&&r?n:null}function Rc(){return cc().filteredItems.length===0}function zc(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function Bc(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function Vc(e,t,n){let r=e.state.listRef.current[t];r&&(e.state.selectionEventRef.current=n,r.click(),e.state.selectionEventRef.current=null)}const Hc=X.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:p,validationMode:h,validation:g}=ze(),{labelId:_}=Ae(),v=oc(),y=Q(v,$.selectionMode),b=Q(v,$.disabled),S=Q(v,$.readOnly),C=Q(v,$.required),T=Q(v,$.positionerElement),E=Q(v,$.listElement),O=Q(v,$.popupId),k=Q(v,$.triggerProps),A=Q(v,$.inputInsidePopup),j=Q(v,$.id),N=Q(v,$.labelId),P=Q(v,$.open),F=Q(v,$.selectedValue),I=Q(v,$.activeIndex),L=Q(v,$.selectedIndex),ee=Q(v,$.hasSelectedValue),z=sc(),te=lc(),B=In(),H=u||b||a,U=Rc(),W=Lc(v);$e({id:A?o:void 0});let ne=A?o??j:o,re=Ic(_,N),G;P&&A?G=O??Sc(j):P&&(G=E?.id);let ie=X.useRef(``);function ae(e){ie.current=e.pointerType}let{reference:K}=zs(z,{enabled:!P&&!S&&!b&&y===`single`,listRef:v.state.labelsRef,activeIndex:I,selectedIndex:L,onMatch(e){let t=v.state.valuesRef.current[e];t!==void 0&&v.state.setSelectedValue(t,V(ye))}}),{reference:oe}=uo(z,{enabled:!S&&!b,event:`mousedown`}),{buttonRef:se,getButtonProps:ce}=m({native:i,disabled:H}),le={...l,open:P,disabled:H,popupSide:W,listEmpty:U,placeholder:y!==`none`&&!ee};return Gt(`button`,e,{ref:[t,se,R(e=>{v.set(`triggerElement`,e)})],state:le,props:[k,oe,K,{id:ne,tabIndex:A?0:-1,role:A?`combobox`:void 0,"aria-expanded":P,"aria-haspopup":A?`dialog`:`listbox`,"aria-controls":G,"aria-required":A&&C||void 0,"aria-labelledby":re,onPointerDown:ae,onPointerEnter:ae,onFocus(){p(!0),!(H||S)&&B.start(0,v.state.forceMount)},onBlur(e){if(!x(T,e.relatedTarget)&&(d(!0),p(!1),h===`onBlur`)){let e=y===`none`?te:F;g.commit(e)}},onMouseDown(e){if(H||S||(A||z.set(`domReferenceElement`,e.currentTarget),v.state.forceMount(),ie.current!==`touch`&&(v.state.inputRef.current?.focus(),A||e.preventDefault()),P))return;let t=f(e.currentTarget);function n(e){let t=v.state.triggerElement;if(!t)return;let n=M(e),r=v.state.positionerElement,i=v.state.listElement;x(t,n)||x(r,n)||x(i,n)||Pc(e,t)||v.state.setOpen(!1,V(w,e))}A&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){S||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(fe(e),v.state.setOpen(!0,V(D,e.nativeEvent)),v.state.inputRef.current?.focus())}},g.getValidationProps(H,c),ce],stateAttributesMapping:Nc})}),Uc=X.createContext(void 0);function Wc(){return X.useContext(Uc)}const Gc=X.createContext(void 0);function Kc(e){let t=X.useContext(Gc);if(t===void 0&&!e)throw Error(r(21));return t}const qc=X.forwardRef(function(e,t){let n=oc(),{buttonRef:r,getButtonProps:i}=m({native:!1}),a=ce(t,r);function o(e){n.state.setOpen(!1,V(re,e.nativeEvent,e.currentTarget))}return(0,Z.jsx)(`span`,{ref:a,...i({onClick:o}),"aria-label":`Dismiss`,tabIndex:void 0,style:Ta})}),Jc=X.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:f,validationMode:p,validation:m}=ze(),{labelId:h}=Ae(),g=Wc(),_=!!Kc(!0),v=oc(),y=lc(),b=We(),x=Q(v,$.required),S=Q(v,$.disabled),C=Q(v,$.readOnly),w=Q(v,$.name),T=Q(v,$.form),E=Q(v,$.selectionMode),D=Q(v,$.autoHighlight),O=Q(v,$.inputProps),k=Q(v,$.triggerProps),A=Q(v,$.open),j=Q(v,$.mounted),M=Q(v,$.selectedValue),N=Q(v,$.id),P=Q(v,$.inline),F=Q(v,$.modal),I=!!D,L=Lc(v),ee=u||S||i,z=Rc(),te=_||P,B=!te||F,H=_t(o??(te?void 0:N)),U=_?Ge:l,[ne,re]=X.useState(null),G=X.useRef(!1),ie=X.useRef(null),ae=X.useRef(!1),K=E===`none`&&!_,oe=R(e=>{let t=_||v.state.inline;t&&!v.state.hasInputValue&&v.state.setInputValue(``,V(ye)),v.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:K})}),se=_?c:m.getValidationProps(ee,c);function ce(){v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?St:W})}function le(){v.state.keyboardActiveRef.current=!1}let de={...U,open:A,disabled:ee,readOnly:C,popupSide:L,listEmpty:z};function pe(e){if(!g)return;let t,{highlightedChipIndex:n}=g,r=g.chipsRef.current.length,[i,a]=zc(b);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&M.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=Bc(n,M.length),ce()),t)}let me=Gt(`input`,e,{state:de,ref:[t,v.state.inputRef,oe],props:[O,k,{value:ne??y,"aria-readonly":C||void 0,"aria-required":x||void 0,"aria-labelledby":h,disabled:ee,readOnly:C,required:E===`none`?x:void 0,form:T,...K&&w&&{name:w},id:H,onFocus(){if(f(!0),!P||!ae.current)return;ae.current=!1;let e=ie.current;e==null||!Object.hasOwn(v.state.valuesRef.current,e)||v.state.setIndices({activeIndex:e})},onBlur(){d(!0),f(!1);let e=v.state.activeIndex;if(P&&e!==null&&D!==`always`&&(ie.current=e,ae.current=!0,v.state.setIndices({activeIndex:null})),p===`onBlur`){let e=E===`none`?y:M;m.commit(e)}},onCompositionStart(e){Ve||(G.current=!0,re(e.currentTarget.value))},onCompositionEnd(e){G.current=!1;let t=e.currentTarget.value;re(null),v.state.setInputValue(t,V(ue,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=G.current||!r;function a(e){C||ee||!e||!i||(v.state.setOpen(!0,V(ue,t)),I||ce())}if(G.current){let n=e.currentTarget.value;re(n),n===``&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.state.setOpen(!1,V(ge,t));let r=n.trim(),i=I&&r!==``;a(r),A&&v.state.activeIndex!==null&&!i&&ce();return}let o=V(ue,t);if(v.state.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=V(ge,t);s&&!v.state.inputInsidePopup&&(E===`single`&&v.state.setSelectedValue(null,c),v.state.openOnInputClick||v.state.setOpen(!1,c)),a(e.currentTarget.value.trim()),A&&v.state.activeIndex!==null&&!I&&ce()},onKeyDown(e){if(ee||C||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;v.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=b===`rtl`;if(e.key===`Home`){fe(e);let n=an&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){fe(e);let i=an&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!j&&e.key===`Escape`){let t=E===`multiple`&&Array.isArray(M)?M.length===0:M===null,n=V(a,e.nativeEvent),r=E===`multiple`?[]:null;v.state.setInputValue(``,n),v.state.setSelectedValue(r,n),!t&&!v.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(g&&e.key===`Backspace`&&t.value===``&&g.highlightedChipIndex===void 0&&Array.isArray(M)&&M.length>0){let t=g.chipsRef.current.length,n=t>0?t-1:M.length-1,r=M.filter((e,t)=>t!==n);ce(),v.state.setSelectedValue(r,V(ye,e.nativeEvent));return}let i=g?.highlightedChipIndex!==void 0,o=pe(e);if(g?.setHighlightedChipIndex(o),o===void 0?i&&v.state.inputRef.current?.focus():g?.chipsRef.current[o]?.focus(),e.which!==229&&e.key===`Enter`&&A){let t=v.state.activeIndex,n=e.nativeEvent;if(t===null){if(P)return;v.state.setOpen(!1,V(ye,n));return}fe(e),Vc(v,t,n)}},onPointerMove:le,onPointerDown:le},se],stateAttributesMapping:Nc}),he=_?(0,Z.jsx)(It.Provider,{value:st,children:me}):me;return(0,Z.jsxs)(X.Fragment,{children:[A&&B&&(0,Z.jsx)(qc,{ref:v.state.startDismissRef}),he]})}),Yc={...Me,...Gs},Xc=X.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:o=!1,style:s,...c}=e,{disabled:l}=ze(),u=oc(),d=Q(u,$.selectionMode),f=Q(u,$.disabled),p=Q(u,$.readOnly),h=Q(u,$.open),g=Q(u,$.selectedValue),_=Q(u,$.hasSelectionChips),v=lc(),y=!1;y=d===`none`?v!==``:d===`single`?g!=null:_;let b=l||f||i,{buttonRef:x,getButtonProps:S}=m({native:a,disabled:b}),{mounted:C,transitionStatus:w,setMounted:T}=Ot(y),E={disabled:b,visible:y,open:h,transitionStatus:w};vt({open:y,ref:u.state.clearRef,onComplete(){y||T(!1)}});let D=Gt(`button`,e,{state:E,ref:[t,x,u.state.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(b||p)return;let t=u.state.keyboardActiveRef.current?St:W;u.state.setInputValue(``,V(N,e.nativeEvent)),d===`none`?u.state.setIndices({activeIndex:null,type:t}):(u.state.setSelectedValue(Array.isArray(g)?[]:null,V(N,e.nativeEvent)),u.state.setIndices({activeIndex:null,selectedIndex:null,type:t})),u.state.inputRef.current?.focus()}},c,S],stateAttributesMapping:Yc});return o||C?D:null}),Zc=X.createContext(null);function Qc(){return X.useContext(Zc)}function $c(e){let{children:t}=e,{filteredItems:n}=cc(),r=Qc(),i=r?r.items:n;return(0,Z.jsx)(X.Fragment,{children:i.map(t)})}const el=X.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=oc(),l=sc(),u=!!Kc(!0),{filteredItems:d,hasItems:f}=cc(),p=Q(c,$.selectionMode),m=Q(c,$.grid),h=Q(c,$.listProps),g=Q(c,$.virtualized),_=Q(c,$.forceMounted),v=p===`multiple`,y=d.length===0,b=R(e=>{c.set(`positionerElement`,e)}),x=R(e=>{c.set(`listElement`,e)}),S=X.useMemo(()=>typeof o==`function`?n||=(0,Z.jsx)($c,{children:o}):o,[o]),C={empty:y},w=l.useState(`floatingId`),T=Gt(`div`,e,{state:C,ref:[t,x,u?null:b],props:[h,{children:S,tabIndex:-1,id:w,role:m?`grid`:`listbox`,"aria-multiselectable":v?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;fe(e),Vc(c,t,e.nativeEvent)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});if(g)return T;let E=f&&!_?void 0:c.state.labelsRef;return(0,Z.jsx)(Xe,{elementsRef:c.state.listRef,labelsRef:E,children:T})});function tl(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function nl(){let e=In(),t=X.useRef(null);return X.useEffect(()=>{if(pt)return;let n=t.current;if(n==null)return;let r=tl(n);if(r==null)return;let i=r.data,a=`${i}⁠`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}const rl=X.createContext(void 0);function il(){let e=X.useContext(rl);if(e===void 0)throw Error(r(20));return e}const al=X.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=oc(),a=Q(i,$.mounted),o=Q(i,$.forceMounted);return a||n||o?(0,Z.jsx)(rl.Provider,{value:n,children:(0,Z.jsx)(Xa,{ref:t,...r})}):null}),ol=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:d=0,offsetParent:f=`real`}=Wt(e,t)||{};if(l==null)return{};let p=rt(d),m={x:n,y:r},g=Vt(i),_=h(g),v=await o.getDimensions(l),y=g===`y`,b=y?`top`:`left`,x=y?`bottom`:`right`,S=y?`clientHeight`:`clientWidth`,C=a.reference[_]+a.reference[g]-m[g]-a.floating[_],w=m[g]-a.reference[g],T=f===`real`?await o.getOffsetParent?.(l):s.floating,E=s.floating[S]||a.floating[_];(!E||!await o.isElement?.(T))&&(E=s.floating[S]||a.floating[_]);let D=C/2-w/2,O=E/2-v[_]/2-1,k=Math.min(p[b],O),A=Math.min(p[x],O),j=k,M=E-v[_]-A,N=E/2-v[_]/2+D,P=Kt(j,N,M),F=!c.arrow&&u(i)!=null&&N!==P&&a.reference[_]/2-(N<j?k:A)-v[_]/2<0,I=F?N<j?N-j:N-M:0;return{[g]:m[g]+I,data:{[g]:P,centerOffset:N-P-I,...F&&{alignmentOffset:I}},reset:F}}}),sl=(e,t)=>({...ol(e),options:[e,t]}),cl={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},ll={sideX:`left`,sideY:`top`},ul=`--available-width`,dl=`--available-height`;function fl(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function pl(e,t,n){let{rects:r,placement:i}=e;return{side:fl(t,L(i),n),align:u(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function ml(e){return hl(e,As)}function hl(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:d=!1,arrowPadding:p=5,disableAnchorTracking:m=!1,inline:h,keepMounted:g=!1,floatingRootContext:_,mounted:v,collisionAvoidance:y,shift:b,nodeId:x,adaptiveOrigin:S,lazyFlip:C=!1,externalTree:w}=e,[T,E]=X.useState(null);!v&&T!==null&&E(null);let D=y.side||`flip`,O=y.align||`flip`,k=y.fallbackAxisSide||`end`,A=b?.crossAxis??!1,j=b?.rootBoundary,M=typeof n==`function`?n:void 0,N=R(M),P=M?N:n,F=qe(n),ee=qe(v),te=We()===`rtl`,B=T||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":te?`left`:`right`,"inline-start":te?`right`:`left`}[i],V=o===`center`?B:`${B}-${o}`,H=l;typeof H==`number`?H={top:H,right:H,bottom:H,left:H}:H&&={top:H.top||0,right:H.right||0,bottom:H.bottom||0,left:H.left||0};let U=+(i===`bottom`),W=+(i===`top`),ne=+(i===`right`),re=+(i===`left`),G={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:H},ie=X.useRef(null),ae=qe(a),K=qe(s),oe=typeof a==`function`?0:a,se=typeof s==`function`?0:s,ce=[];h&&ce.push(h),ce.push(ds(e=>{let t=pl(e,i,te),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof K.current==`function`?K.current(t):K.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[oe,se,te,i]));let le=O===`none`&&D!==`shift`,ue=!le&&(d||A||D===`shift`),fe=D===`none`?null:ms({...G,padding:{top:H.top+1+U,right:H.right+1+re,bottom:H.bottom+1+W,left:H.left+1+ne},mainAxis:!A&&D===`flip`,crossAxis:O===`flip`&&`alignment`,fallbackAxisSideDirection:k}),pe=le?null:fs({...G,rootBoundary:j,mainAxis:O!==`none`,crossAxis:ue,limiter:d||A?void 0:ps(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=z(L(e.placement)),i=r===`y`?t:n,a=r===`y`?H.left+H.right:H.top+H.bottom;return{offset:i/2+a/2}})},[G,d,A,j,H,O]);D===`shift`||O===`shift`||o===`center`?ce.push(pe,fe):ce.push(fe,pe),ce.push(hs({...G,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!ee.current)return;let i=e.style;i.setProperty(ul,`${t}px`),i.setProperty(dl,`${n}px`);let a=de(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),sl(e=>({element:ie.current||f(e.elements.floating).createElement(`div`),padding:p,offsetParent:`floating`}),[p]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=L(r),l=z(c),u=ie.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(pl(e,i,te)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ue&&l===`y`&&b?S:x),{}}},cl,S),I(()=>{!v&&_&&_.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[v,_]);let me=X.useMemo(()=>({elementResize:!m&&typeof ResizeObserver<`u`,layoutShift:!m&&typeof IntersectionObserver<`u`}),[m]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:Se,isPositioned:Ce,floatingStyles:we}=t({rootContext:_,open:g?v:void 0,placement:V,middleware:ce,strategy:r,whileElementsMounted:g?void 0:(...e)=>Qo(...e,me),nodeId:x,externalTree:w}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||ll,q=Ce?r:`fixed`,De=X.useMemo(()=>{let e;return e=Ce?S?{position:q,[Te]:_e,[Ee]:ve}:{...we,position:q}:{position:q,top:0,left:0},e[ul]=`100vw`,e[dl]=`100vh`,Ce||(e.opacity=0),e},[S,q,Te,_e,Ee,ve,we,Ce]),Oe=X.useRef(null);I(()=>{if(!v)return;let e=F.current,t=typeof e==`function`?e():e,n=(gl(t)?t.current:t)||null;n!==Oe.current&&(he.setPositionReference(n),Oe.current=n)},[v,he,P,F]),X.useEffect(()=>{if(!v)return;let e=F.current;typeof e!=`function`&&gl(e)&&e.current!==Oe.current&&(he.setPositionReference(e.current),Oe.current=e.current)},[v,he,P,F]),X.useEffect(()=>{if(g&&v&&ge.reference&&ge.floating)return Qo(ge.reference,ge.floating,be,me)},[g,v,ge,be,me]);let ke=L(xe),Ae=fl(i,ke,te),je=u(xe)||`center`,Me=!!ye.hide?.referenceHidden;I(()=>{C&&v&&Ce&&ke!==B&&E(ke)},[C,v,Ce,ke,B]);let Ne=X.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Pe=ye.arrow?.centerOffset!==0;return X.useMemo(()=>({positionerStyles:De,arrowStyles:Ne,arrowRef:ie,arrowUncentered:Pe,side:Ae,align:je,physicalSide:ke,anchorHidden:Me,refs:he,context:Se,isPositioned:Ce,update:be}),[De,Ne,ie,Pe,Ae,je,ke,Me,he,Se,Ce,be])}function gl(e){return e!=null&&`current`in e}function _l(e){return e===`starting`?Ha:K}function vl(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Gt(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},_l(r),i],stateAttributesMapping:qs})}function yl(e,t,n,r){let[i,a]=X.useState(!1);I(()=>{if(!e||!t||n==null){a(!1);return}let r=f(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-20)},[e,t,n]),xa(e&&(!t||i),r)}const bl=X.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=Ua,style:g,..._}=e,v=oc(),y=sc(),b=il(),x=Q(v,$.modal),S=Q(v,$.open),C=Q(v,$.mounted),w=Q(v,$.openMethod),T=Q(v,$.positionerElement),E=Q(v,$.triggerElement),D=Q(v,$.inputElement),O=Q(v,$.inputGroupElement),k=Q(v,$.inputInsidePopup),A=Q(v,$.transitionStatus),j=Rc(),M=ml({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});yl(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};I(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=R(e=>{v.set(`positionerElement`,e)}),F=vl(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return(0,Z.jsxs)(Gc.Provider,{value:M,children:[C&&x&&(0,Z.jsx)(Js,{inert:yt(!S),cutout:O??D??E}),F]})}),xl={...qs,...Me},Sl=X.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=oc(),l=Kc(),u=sc(),d=Q(c,$.mounted),f=Q(c,$.open),p=Q(c,$.openMethod),m=Q(c,$.popupProps),h=Q(c,$.transitionStatus),g=Q(c,$.inputInsidePopup),_=Q(c,$.inputElement),v=Q(c,$.modal),y=Q(c,$.id),b=Rc(),S=s.id??(g?Sc(y):void 0);I(()=>(c.set(`popupId`,c.state.popupRef.current?.id||S),()=>{c.set(`popupId`,void 0)}),[c,S]),vt({open:f,ref:c.state.popupRef,onComplete(){f&&c.state.onOpenChangeComplete(!0)}});let C=Gt(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},ref:[t,c.state.popupRef],props:[m,{id:S,role:g?`dialog`:`presentation`,onFocus(e){let t=M(e.nativeEvent);p!==`touch`&&(x(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},_l(h),s],stateAttributesMapping:xl}),w=a===void 0?g?e=>e===`touch`?c.state.popupRef.current:_:!1:a,T;T=o??(g?void 0:!1);let E=!g||v;return(0,Z.jsx)(lo,{context:u,disabled:!d,modal:E,openInteractionType:p,initialFocus:w,returnFocus:T,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,Z.jsxs)(X.Fragment,{children:[C,E&&(0,Z.jsx)(qc,{ref:c.state.endDismissRef})]})})}),Cl=X.createContext(void 0);function wl(){let e=X.useContext(Cl);if(!e)throw Error(r(19));return e}const Tl=X.createContext(!1);function El(){return X.useContext(Tl)}function Dl(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=X.useRef(null),h=lt({guess:!0,index:l,textRef:p}),g=oc(),_=El(),v=uc(),y=Q(g,$.selectionMode),b=Q(g,$.disabled),x=Q(g,$.readOnly),S=Q(g,$.isItemEqualToValue),C=b||u,w=y!==`none`,T=l??i??h.index,E=T!==-1,D=Q(g,$.id),O=Q(g,$.isActive,T),k=Q(g,$.isSelected,c),A=Q(g,$.itemProps),j=X.useRef(null),M=D!=null&&E?`${D}-${T}`:void 0,N=k&&w;I(()=>{if(!(E&&(r||l!=null)))return;let e=g.state.listRef.current;return e[T]=j.current,()=>{delete e[T]}},[E,r,T,l,g]),I(()=>{if(!E||v)return;let e=g.state.valuesRef.current;return e[T]=c,()=>{delete e[T]}},[E,v,T,c,g]),I(()=>{if(!E||v)return;let e=g.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;fc(c,t,S)&&g.set(`selectedIndex`,T)},[E,v,g,T,c,S]);let{getButtonProps:P,buttonRef:F}=m({disabled:C,focusableWhenDisabled:!0,native:d,composite:!0}),L={disabled:C,selected:N,highlighted:O};function ee(e){function t(){g.state.handleSelection(e,c)}g.state.submitOnItemClick?(Ga.flushSync(t),g.state.requestSubmit()):t()}let R={id:M,role:_?`gridcell`:`option`,"aria-selected":w?N:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(g.state.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){C||x||ee(e.nativeEvent)},onMouseUp(e){let t=g.state.pointerDownItemRef.current===e.currentTarget;g.state.pointerDownItemRef.current=null,!(C||x||e.button!==0||t||!O)&&ee(e.nativeEvent)}},z=Gt(`div`,t,{ref:[F,n,h.ref,j],state:L,props:[A,R,f,P]}),te=X.useMemo(()=>({selected:N,textRef:p}),[N,p]);return(0,Z.jsx)(Cl.Provider,{value:te,children:z})}function Ol(e){let{componentProps:t,forwardedRef:n}=e,r=Q(oc(),$.isItemEqualToValue),{flatFilteredItems:i}=cc();return(0,Z.jsx)(Dl,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:mc(i,t.value??null,r)})}const kl=X.memo(X.forwardRef(function(e,t){let n=Q(oc(),$.virtualized);return n&&e.index==null?(0,Z.jsx)(Ol,{componentProps:e,forwardedRef:t}):(0,Z.jsx)(Dl,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),Al=X.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=cc(),c=oc(),l=nl(),u=s.length===0?a:null;return Gt(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function jl(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,Z.jsx)(Mc,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}const Ml=X.forwardRef(function(e,t){let{selected:n}=wl();return e.keepMounted||n?(0,Z.jsx)(Nl,{...e,ref:t}):null}),Nl=X.memo(X.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=wl(),c=X.useRef(null),{transitionStatus:l,setMounted:u}=Ot(s),d=Gt(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:Me});return vt({open:s,ref:c,onComplete(){s||u(!1)}}),d})),Pl=jl;function Fl({className:e,children:t,...n}){return(0,Z.jsxs)(Hc,{"data-slot":`combobox-trigger`,className:De(`[&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,Z.jsx)(tn,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function Il({className:e,...t}){return(0,Z.jsx)(Xc,{"aria-label":`Clear tenant`,"data-slot":`combobox-clear`,render:(0,Z.jsx)(n,{variant:`ghost`,size:`icon-xs`}),className:De(e),...t,children:(0,Z.jsx)(He,{className:`pointer-events-none`})})}function Ll({className:e,children:t,disabled:r=!1,showTrigger:i=!0,showClear:a=!1,...o}){return(0,Z.jsxs)(te,{className:De(`w-auto`,e),children:[(0,Z.jsx)(Jc,{render:(0,Z.jsx)(tt,{disabled:r}),...o}),(0,Z.jsxs)(it,{align:`inline-end`,children:[i&&(0,Z.jsx)(n,{size:`icon-xs`,variant:`ghost`,render:(0,Z.jsx)(Fl,{}),"aria-label":`Show tenants`,"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:r}),a&&(0,Z.jsx)(Il,{disabled:r})]}),t]})}function Rl({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,container:o,...s}){return(0,Z.jsx)(al,{container:o,children:(0,Z.jsx)(bl,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:`isolate z-50`,children:(0,Z.jsx)(Sl,{"data-slot":`combobox-content`,"data-chips":!!a,className:De(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s})})})}function zl({className:e,...t}){return(0,Z.jsx)(el,{"data-slot":`combobox-list`,className:De(`no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})}function Bl({className:e,children:t,...n}){return(0,Z.jsxs)(kl,{"data-slot":`combobox-item`,className:De(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,Z.jsx)(Ml,{render:(0,Z.jsx)(`span`,{className:`pointer-events-none absolute end-2 flex size-4 items-center justify-center`}),children:(0,Z.jsx)(Nt,{className:`pointer-events-none`})})]})}function Vl({className:e,...t}){return(0,Z.jsx)(Al,{"data-slot":`combobox-empty`,className:De(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,e),...t})}function Hl({className:e,size:t=`default`,...n}){return(0,Z.jsxs)(`div`,{className:De(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,e),"data-slot":`native-select-wrapper`,"data-size":t,children:[(0,Z.jsx)(`select`,{"data-slot":`native-select`,"data-size":t,className:`h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pe-8 ps-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,...n}),(0,Z.jsx)(tn,{className:`pointer-events-none absolute top-1/2 end-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function Ul({className:e,...t}){return(0,Z.jsx)(`option`,{"data-slot":`native-select-option`,className:De(`bg-[Canvas] text-[CanvasText]`,e),...t})}function Wl({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`skeleton`,className:De(`animate-pulse rounded-md bg-muted`,e),...t})}const Gl=Rt(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function Kl({className:e,variant:t,...n}){return(0,Z.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:De(Gl({variant:t}),e),...n})}function ql({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`alert-title`,className:De(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function Jl({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`alert-description`,className:De(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function Yl(e){return Xl(e)||typeof e==`function`||Zl(e)}function Xl(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Zl(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function Ql(e,t){return e==null?null:Yl(e)?X.createElement(e,t):e}function $l(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?Ql(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:Ql(n.cell,t.getContext())}return`header`in e&&e.header?Ql(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?Ql(e.footer.column.columnDef.footer,e.footer.getContext()):null}function eu(e){let t=ia(e.source,e.selector,{compare:Wi});return typeof e.children==`function`?e.children(t):e.children}function tu(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function nu(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return(!a||!i(o,t))&&(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function ru(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{(!n||!t(r,e))&&i(e)})}}function iu(){return nu({createAtom:Vi,batch:Ri})}function au(e,t){return typeof e==`function`?e(t):e}function ou(e){if(Array.isArray(e))return e.map(ou);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?su():{},r=Object.keys(e);for(let t=0;t<r.length;t++){let i=r[t];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:ou(e[i]),writable:!0})}return n}return e}function su(){return Object.create(null)}function cu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function lu(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>au(n,e))}}function uu(e){if(typeof e!=`object`||!e)return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function du(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function fu(e,t){return pu(e,t,3)}function pu(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!uu(e)||!uu(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=du(e),i=du(t);if(r.length!==i.length)return!1;let a=e,o=t;for(let e=0;e<r.length;e++){let i=r[e];if(!Object.prototype.propertyIsEnumerable.call(t,i)||!pu(a[i],o[i],n-1))return!1}return!0}function mu(e,t,n,r=fu){let i=`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`,a=e.options[i];a&&a(e=>{let t=au(n,e);return r(e,t)?e:t})}function hu(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}const gu=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e<l.length;e++)if(l[e]!==o[e]){u=!0;break}}return n?.(u),u?(o=l,a?.(),s=e(...l??[]),r?.(s),s):s}};function _u(e){let t=!1;return()=>{if(!t){t=!0;return}e()}}function vu({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o=()=>{if(!r)return;let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))},s={onAfterUpdate:()=>{o()}};return gu({...a,...s})}function yu(e,t=`_`){let[n,r]=e.split(t);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function bu(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=yu(r);t[n]=a?vu({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function xu(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=yu(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=vu({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function Su(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function Cu(e){return e.row.getValue(e.column.id)}function wu(e){return e.getValue()??e.table.options.renderFallbackValue}function Tu(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}const Eu={assignCellPrototype:(e,t)=>{xu(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>Cu(e)},cell_renderValue:{fn:e=>wu(e)},cell_getContext:{fn:e=>Tu(e),memoDeps:e=>[e]}})}};function Du(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function Ou(e,t,n){let r=Du(e),i=Object.create(r);i.colSpan=0,i.column=t,i.depth=n.depth,i.headerGroup=null,i.id=n.id??t.id,i.index=n.index,i.isPlaceholder=!!n.isPlaceholder,i.placeholderId=n.placeholderId,i.rowSpan=0,i.subHeaders=[];let a=e._headerInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function ku(){return{start:[],end:[]}}function Au(e){let t=e.table.atoms.columnVisibility?.get();if(!t)return!0;let n=e.columns;return n.length?n.some(e=>Su(e,`getIsVisible`,Au)):(cu(t,e.id)?t[e.id]:void 0)??!0}function ju(e){return e.getAllLeafColumns().filter(e=>Su(e,`getIsVisible`,Au))}function Mu(e,t=1){let n=t;for(let r=0;r<e.length;r++){let i=e[r];Su(i,`getIsVisible`,Au)&&i.columns.length&&(n=Math.max(n,Mu(i.columns,t+1)))}return n}function Nu(e,t){return e?`${e}_${t}`:String(t)}function Pu(e,t,n,r){let i=e??``;return t&&(i=i?`${i}_${t}`:String(t)),n&&(i=i?`${i}_${n}`:n),r&&(i=i?`${i}_${r}`:r),i}function Fu(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function Iu(e,t,n,r,i,a){let o={depth:t,id:Nu(r,t),headers:[]},s=[];for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i],c=s[s.length-1],l=a.column.depth===o.depth,u,d=!1;if(l&&a.column.parent?u=a.column.parent:(u=a.column,d=!0),c&&c.column===u)c.subHeaders.push(a);else{let e=Ou(n,u,{id:Pu(r,t,u.id,a.id),isPlaceholder:d,placeholderId:d?String(Fu(s,u)):void 0,depth:t,index:s.length});e.subHeaders.push(a),s.push(e)}o.headers.push(a),a.headerGroup=o}for(let e=0;e<a.length;e++)a[e](o);i.push(o),t>0&&Iu(s,t-1,n,r,i,a)}function Lu(e){for(let t=0;t<e.length;t++){let n=e[t];if(!Su(n.column,`getIsVisible`,Au))continue;let r=0;if(n.subHeaders.length){Lu(n.subHeaders);for(let e=0;e<n.subHeaders.length;e++){let t=n.subHeaders[e];Su(t.column,`getIsVisible`,Au)&&(r+=t.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let e=1,t=n.subHeaders[0];for(;t;)t.rowSpan=0,e++,t=t.subHeaders.length===1&&t.subHeaders[0].column===n.column?t.subHeaders[0]:void 0;n.rowSpan=e}else n.rowSpan=1}}function Ru(e,t,n,r){let i=Mu(e),a=[],o=n._headerGroupInstanceInitFns,s=Array(t.length);for(let e=0;e<t.length;e++)e in t&&(s[e]=Ou(n,t[e],{depth:i,index:e}));return Iu(s,i-1,n,r,a,o),a.reverse(),Lu(a[0]?.headers??[]),a}function zu(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function Bu(e,t,n,r){let i={...e.getDefaultColumnDef(),...t},a=i.accessorKey,o=a===void 0?void 0:String(a),s=i.id??o?.replaceAll(`.`,`_`)??(typeof i.header==`string`?i.header:void 0),c;if(i.accessorFn)c=i.accessorFn;else if(a!==void 0)if(typeof a==`string`&&a.includes(`.`)){let e=a.split(`.`);c=t=>{let n=t;for(let t=0;t<e.length;t++){let r=e[t];n=n?.[r]}return n}}else c=e=>e[i.accessorKey];if(!s)throw Error();let l=zu(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;e<d.length;e++)d[e](u);return u}function Vu(e){let t=e.atoms.columnOrder?.get();return n=>{let r=[];if(!t?.length)r=n;else{let e=new Map;for(let t=0;t<n.length;t++){let r=n[t];e.set(r.id,r)}for(let n=0;n<t.length;n++){let i=t[n],a=e.get(i);a&&(r.push(a),e.delete(i))}for(let t=0;t<n.length;t++){let i=n[t];e.has(i.id)&&r.push(i)}}return Hu(e,r)}}function Hu(e,t){let n=e.atoms.grouping?.get()??[],{groupedColumnMode:r}=e.options;if(!n.length||!r)return t;let i=t.filter(e=>!n.includes(e.id));if(r===`remove`)return i;let a=new Map;for(let e=0;e<t.length;e++){let n=t[e];a.set(n.id,n)}let o=[];for(let e=0;e<n.length;e++){let t=a.get(n[e]);t&&o.push(t)}return[...o,...i]}function Uu(e){return[e,...e.columns.flatMap(e=>e.getFlatColumns())]}function Wu(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return Su(e.table,`getOrderColumns`,Vu)(t)}return[e]}function Gu(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function Ku(e,t,n,r=0){let i=Array(t.length);for(let a=0;a<t.length;a++){if(!(a in t))continue;let o=t[a],s=Bu(e,o,r,n),c=o;s.columns=c.columns?Ku(e,c.columns,s,r+1):[],i[a]=s}return i}function qu(e){return Ku(e,e.options.columns)}function Ju(e){return e.getAllColumns().flatMap(e=>e.getFlatColumns())}function Yu(e){let t=su(),n=e.getAllFlatColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function Xu(e){let t=e.getAllColumns().flatMap(e=>e.getLeafColumns());return Su(e,`getOrderColumns`,Vu)(t)}function Zu(e){let t=su(),n=e.getAllLeafColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function Qu(e,t){return e.getAllFlatColumnsById()[t]}const $u={assignColumnPrototype:(e,t)=>{xu(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>Uu(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>Wu(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{bu(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>Gu(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>qu(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>Ju(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>Yu(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>Xu(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>Zu(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>Qu(e,t)}})}};function ed(e,t){for(let n=0;n<e.subHeaders.length;n++)ed(e.subHeaders[n],t);t.push(e)}function td(e){let t=[];return ed(e,t),t}function nd(e){return{column:e.column,header:e,table:e.column.table}}function rd(e){let{start:t,end:n}=e.atoms.columnPinning?.get()??ku(),r=e.getAllColumns(),i=Su(e,`getVisibleLeafColumns`,ju);if(!t.length&&!n.length)return Ru(r,i,e);let a=e.getAllLeafColumnsById(),o=[];for(let e=0;e<t.length;e++){let n=a[t[e]];n&&Su(n,`getIsVisible`,Au)&&o.push(n)}let s=[];for(let e=0;e<n.length;e++){let t=a[n[e]];t&&Su(t,`getIsVisible`,Au)&&s.push(t)}let c=i.filter(e=>!t.includes(e.id)&&!n.includes(e.id));return Ru(r,[...o,...c,...s],e)}function id(e){return[...e.getHeaderGroups()].reverse()}function ad(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e<t.length;e++){let r=t[e].headers;for(let e=0;e<r.length;e++)n.push(r[e])}return n}function od(e){let t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let e=0;e<t.length;e++){let r=t[e].getLeafHeaders();for(let e=0;e<r.length;e++)n.push(r[e])}return n}const sd={assignHeaderPrototype:(e,t)=>{xu(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>td(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>nd(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{bu(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>rd(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>id(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>ad(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>od(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function cd(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}const ld=(e,t,n,r,i,a,o)=>{let s=cd(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=su(),c._valuesCache=su(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;e<l.length;e++)l[e](c);return c};function ud(){return[]}function dd(e,t){mu(e,`cellSelection`,t?ud():ou(e.initialState.cellSelection)??ud())}function fd(e){e.atoms.cellSelection&&(e.options.autoResetAll??e.options.autoResetCellSelection??!0)&&e._reactivity.schedule(()=>dd(e))}function pd(){return su()}function md(e){e.atoms.expanded&&(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding)&&e._reactivity.schedule(()=>_d(e))}function hd(e,t){e.options.onExpandedChange?.(t)}function gd(e,t){let n=e.atoms.expanded?.get()??{};if(t??!xd(e)){if(n===!0||!vd(e))return;hd(e,!0)}else{if(n!==!0&&!Object.keys(n).length)return;hd(e,su())}}function _d(e,t){let n=e.initialState.expanded;mu(e,`expanded`,t?su():n===!0||Object.assign(su(),ou(n??{})))}function vd(e){return e.getPrePaginatedRowModel().flatRows.some(e=>Ed(e))}function yd(e){return t=>{gd(e)}}function bd(e){let t=e.atoms.expanded?.get()??{};return t===!0||Object.values(t).some(Boolean)}function xd(e){let t=e.atoms.expanded?.get()??{};if(t===!0)return!0;if(!Object.keys(t).length)return!1;let n=e.getRowModel().flatRows.filter(e=>Ed(e));return!(!n.length||n.some(e=>!wd(e)))}function Sd(e){let t=0,n=e.atoms.expanded?.get();return(n===!0?Object.values(e.getRowModel().rowsById).filter(e=>Ed(e)).map(e=>e.id):Object.keys(n??{})).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t}function Cd(e,t){let n=e.table.atoms.expanded?.get()??{},r=n===!0||Td(n,e.id),i=t??!r;i!==r&&(i&&!Ed(e)||hd(e.table,t=>{let n=t===!0||Td(t,e.id),r=su();if(t===!0?Object.values(e.table.getRowModel().rowsById).forEach(e=>{Ed(e)&&(r[e.id]=!0)}):r=Object.assign(su(),t),!n&&i)return r[e.id]=!0,r;if(n&&!i){let t=su(),n=Object.keys(r);for(let i=0;i<n.length;i++){let a=n[i];a!==e.id&&r[a]&&(t[a]=!0)}return t}return t}))}function wd(e){let t=e.table.atoms.expanded?.get()??{};return!!(e.table.options.getIsRowExpanded?.(e)??(t===!0||Td(t,e.id)))}function Td(e,t){return!!(e&&e!==!0&&cu(e,t)&&e[t])}function Ed(e){return e.table.options.getRowCanExpand?.(e)??((e.table.options.enableExpanding??!0)&&!!e.subRows.length)}function Dd(e){let t=!0,n=e;for(;t&&n.parentId;)n=e.table.getRow(n.parentId,!0),t=wd(n);return t}function Od(e){let t=Ed(e);return()=>{t&&Cd(e)}}function kd(e){if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if((e.atoms.pagination?.get()?.pageIndex??0)===0)return;Md(e,!0)}}function Ad(e,t){mu(e,`pagination`,t)}function jd(e,t){Ad(e,n=>{let r=au(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})}function Md(e,t){jd(e,t?0:e.initialState.pagination?.pageIndex??0)}function Nd(e,t){mu(e,`sorting`,t)}function Pd(e,t){Nd(e,t?[]:ou(e.initialState.sorting??[]))}function Fd(e){e.atoms.sorting&&(e.options.autoResetAll??e.options.autoResetSorting??!1)&&Pd(e)}function Id(){return e=>vu({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>Rd(e,e.options.data),onAfterUpdate:_u(()=>{md(e),kd(e),Fd(e),fd(e)})})}function Ld(e,t,n,r=0,i){let a=[];for(let o=0;o<n.length;o++){let s=n[o],c=ld(e,e.getRowId(s,o,i),s,o,r,void 0,i?.id);t.flatRows.push(c),t.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(s,o),c.originalSubRows?.length&&(c.subRows=Ld(e,t,c.originalSubRows,r+1,c)))}return a}function Rd(e,t){let n={rows:[],flatRows:[],rowsById:su()};return n.rows=Ld(e,n,t),n}function zd(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??Id()(e)),e._rowModels.coreRowModel()}function Bd(e){return e.getCoreRowModel()}function Vd(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function Hd(e){return e.getFilteredRowModel()}function Ud(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function Wd(e){return e.getGroupedRowModel()}function Gd(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function Kd(e){return e.getSortedRowModel()}function qd(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function Jd(e){return e.getExpandedRowModel()}function Yd(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function Xd(e){return e.getPaginatedRowModel()}const Zd={constructTableAPIs:e=>{bu(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>zd(e)},table_getPreFilteredRowModel:{fn:()=>Bd(e)},table_getFilteredRowModel:{fn:()=>Vd(e)},table_getPreGroupedRowModel:{fn:()=>Hd(e)},table_getGroupedRowModel:{fn:()=>Ud(e)},table_getPreSortedRowModel:{fn:()=>Wd(e)},table_getSortedRowModel:{fn:()=>Gd(e)},table_getPreExpandedRowModel:{fn:()=>Kd(e)},table_getExpandedRowModel:{fn:()=>qd(e)},table_getPrePaginatedRowModel:{fn:()=>Jd(e)},table_getPaginatedRowModel:{fn:()=>Yd(e)},table_getRowModel:{fn:()=>Xd(e)}})}};function Qd(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function $d(e,t,n){let r=Qd(n),i=Object.create(r);i.column=e,i.id=`${t.id}_${e.id}`,i.row=t;let a=n._cellInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function ef(e){let t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function tf(e){let t=e.getPrePaginatedRowModel().rows;if(e.options.paginateExpandedRows===!1){let e=[],n=t=>{t._displayIndexCache=e.length,e.push(t),t.subRows.length&&t.getIsExpanded?.()&&t.subRows.forEach(n)};return t.forEach(n),e}for(let e=0;e<t.length;e++)t[e]._displayIndexCache=e;return t}function nf(e,t){if(cu(e._valuesCache,t))return e._valuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function rf(e,t){if(cu(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function af(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function of(e){return hu(e.subRows,e=>e.subRows)}function sf(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e<t.length;e++)n=Math.max(n,t[e].depth);return n}function cf(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function lf(e){let t=[],n=e;for(;;){let e=n.getParentRow();if(!e)break;t.push(e),n=e}return t.reverse()}function uf(e){let t=e.table.getAllLeafColumns(),n=e._cellsCache;n||=e._cellsCache=new WeakMap;let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i],o=n.get(a);o||(o=$d(a,e,e.table),n.set(a,o)),r[i]=o}return r}function df(e){let t=su(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];t[r.column.id]=r}return t}function ff(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function pf(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw Error();return r}const mf={assignRowPrototype:(e,t)=>{xu(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>ef(e)},row_getAllCellsByColumnId:{fn:e=>df(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>uf(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>of(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>cf(e)},row_getParentRows:{fn:e=>lf(e)},row_getUniqueValues:{fn:(e,t)=>rf(e,t)},row_getValue:{fn:(e,t)=>nf(e,t)},row_renderValue:{fn:(e,t)=>af(e,t)}})},constructTableAPIs:e=>{bu(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>tf(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>ff(t,e,n,r)},table_getRow:{fn:(t,n)=>pf(e,t,n)},table_getMaxSubRowDepth:{fn:()=>sf(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function hf(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function gf(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{hf(e,t,n),e._reactivity.commit?.()})}function _f(e){let t=ou(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];e.baseAtoms[i].set(t[i])}});let n=Object.values(e._features);for(let t=0;t<n.length;t++)n[t].resetTableInstanceData?.(e)}function vf(e,t){let{features:n,atoms:r,initialState:i}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:i};let a=e.options.mergeOptions(e.options,t),o={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...o,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:i,enumerable:!0,configurable:!0,writable:!0}})}function yf(e,t,n){let r=vf(e,au(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&gf(e,r.state??null)}const bf={coreCellsFeature:Eu,coreColumnsFeature:$u,coreHeadersFeature:sd,coreRowModelsFeature:Zd,coreRowsFeature:mf,coreTablesFeature:{constructTableAPIs:e=>{bu(`coreTablesFeature`,e,{table_reset:{fn:()=>_f(e)},table_setOptions:{fn:t=>yf(e,t)}})}}};function xf(e){return e}function Sf(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),ou(t)}function Cf(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...bf,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=Sf(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e<x.length;e++){let n=x[e];v.baseAtoms[n]=t.createWritableAtom(v.initialState[n],{debugName:`table/baseAtoms/${n}`}),v.atoms[n]=t.createReadonlyAtom(()=>{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&cu(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}hf(v),v.store=tu(t.createReadonlyAtom(()=>{let e={};for(let t=0;t<x.length;t++){let n=x[t];e[n]=v.atoms[n].get()}return e},{compare:Wi,debugName:`table/store`}));for(let e=0;e<y.length;e++){let t=y[e];t.initTableInstanceData?.(v),t.initCellInstanceData&&v._cellInstanceInitFns.push(t.initCellInstanceData.bind(t)),t.initColumnInstanceData&&v._columnInstanceInitFns.push(t.initColumnInstanceData.bind(t)),t.initHeaderGroupInstanceData&&v._headerGroupInstanceInitFns.push(t.initHeaderGroupInstanceData.bind(t)),t.initHeaderInstanceData&&v._headerInstanceInitFns.push(t.initHeaderInstanceData.bind(t)),t.initRowInstanceData&&v._rowInstanceInitFns.push(t.initRowInstanceData.bind(t)),t.constructTableAPIs?.(v)}return v}const wf={getInitialState:e=>({expanded:pd(),...e}),getDefaultTableOptions:e=>({onExpandedChange:lu(`expanded`,e),paginateExpandedRows:!0}),assignRowPrototype:(e,t)=>{xu(`rowExpandingFeature`,e,t,{row_toggleExpanded:{fn:(e,t)=>Cd(e,t)},row_getIsExpanded:{fn:e=>wd(e)},row_getCanExpand:{fn:e=>Ed(e)},row_getIsAllParentsExpanded:{fn:e=>Dd(e)},row_getToggleExpandedHandler:{fn:e=>Od(e)}})},constructTableAPIs:e=>{bu(`rowExpandingFeature`,e,{table_autoResetExpanded:{fn:()=>md(e)},table_setExpanded:{fn:t=>hd(e,t)},table_toggleAllRowsExpanded:{fn:t=>gd(e,t)},table_resetExpanded:{fn:t=>_d(e,t)},table_getCanSomeRowsExpand:{fn:()=>vd(e)},table_getToggleAllRowsExpandedHandler:{fn:()=>yd(e)},table_getIsSomeRowsExpanded:{fn:()=>bd(e)},table_getIsAllRowsExpanded:{fn:()=>xd(e)},table_getExpandedDepth:{fn:()=>Sd(e)}})}},Tf=typeof window>`u`?X.useEffect:X.useLayoutEffect;function Ef(e,t){let[{table:n,rootSource:r}]=(0,X.useState)(()=>{let t=Cf({...e,features:{coreReactivityFeature:iu(),...e.features}});return t.Subscribe=(e=>eu({...e,source:e.source??t.store})),t.FlexRender=$l,{table:t,rootSource:ru(t.store,Wi)}}),i=n;yf(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=ia(r,t,{compare:Wi});return Tf(()=>{r.markCommitted(o),gf(i,a??null,Wi)}),(0,X.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}function Df({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,Z.jsx)(`table`,{"data-slot":`table`,className:De(`w-full caption-bottom text-sm`,e),...t})})}function Of({className:e,...t}){return(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:De(`[&_tr]:border-b`,e),...t})}function kf({className:e,...t}){return(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:De(`[&_tr:last-child]:border-0`,e),...t})}function Af({className:e,...t}){return(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:De(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function jf({className:e,...t}){return(0,Z.jsx)(`th`,{"data-slot":`table-head`,className:De(`h-10 px-2 text-start align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pe-0`,e),...t})}function Mf({className:e,...t}){return(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:De(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0`,e),...t})}const Nf=Rt(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function Pf({className:e,variant:t=`default`,render:n,...r}){return d({defaultTagName:`span`,props:nt({className:De(Nf({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}const Ff=xf({rowExpandingFeature:wf});function If({rows:e,kind:t,options:n,filtered:r}){let{onTenantSelect:i,onTenantUserSelect:a,showAdmin:o}=n,s=(0,X.useMemo)(()=>[{accessorKey:`external_id`,header:`ID`,cell:({row:e})=>(0,Z.jsx)(`span`,{className:`block w-72 break-all font-mono text-xs whitespace-normal`,children:e.original.external_id})},{id:`name`,header:t===`tenants`?`Tenant`:`User`,cell:({row:e,table:n})=>{let r=e.original,i=r.name||r.external_id;return(0,Z.jsxs)(`div`,{className:`flex min-w-48 items-center gap-3 py-1`,children:[t===`users`&&(0,Z.jsx)(`span`,{"data-slot":`directory-avatar`,"aria-hidden":!0,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium uppercase`,children:i.trim().split(/\s+/).slice(0,2).map(e=>Array.from(e)[0]).join(``)}),(0,Z.jsxs)(ut,{variant:`link`,className:`h-auto max-w-64 justify-start p-0 text-start whitespace-normal break-words`,onClick:()=>n.setExpanded(e.getIsExpanded()?{}:{[e.id]:!0}),"aria-expanded":e.getIsExpanded(),title:e.getIsExpanded()?`Hide metadata`:`Show metadata`,children:[(0,Z.jsx)(mt,{"aria-hidden":!0,className:e.getIsExpanded()?`rotate-90`:void 0}),i]})]})}},...t===`users`&&o?[{id:`admin`,header:`Stored admin`,cell:({row:e})=>(0,Z.jsx)(Pf,{variant:`outline`,title:`Stored status does not grant or revoke signed JWT authority`,children:`admin`in e.original&&e.original.admin?`Admin`:`User`})}]:[],{accessorKey:`metadata`,header:`Metadata`,cell:({row:e})=>{let t=Object.entries(e.original.metadata);return t.length?(0,Z.jsxs)(`dl`,{className:`min-w-32 max-w-72 space-y-1 text-xs`,children:[t.slice(0,3).map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Z.jsxs)(`dt`,{className:`max-w-24 shrink-0 truncate text-muted-foreground`,children:[e,`:`]}),(0,Z.jsx)(`dd`,{className:`truncate`,children:typeof t==`string`?t:JSON.stringify(t)})]},e)),t.length>3&&(0,Z.jsxs)(`div`,{className:`text-muted-foreground`,children:[(0,Z.jsx)(`dt`,{className:`sr-only`,children:`Additional metadata`}),(0,Z.jsxs)(`dd`,{children:[`+`,t.length-3,` more in details`]})]})]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`No metadata`})}},{accessorKey:`created_at`,header:`Created`,cell:({row:e})=>(0,Z.jsx)(`time`,{dateTime:e.original.created_at,title:e.original.created_at,className:`whitespace-nowrap text-muted-foreground`,children:new Date(e.original.created_at).toLocaleDateString()})},...(t===`users`?a:i)?[{id:`actions`,header:``,cell:({row:e})=>{let t=e.original;return(0,Z.jsx)(ut,{variant:`ghost`,size:`sm`,onClick:()=>`tenant_id`in t?a?.(t):i?.(t),"aria-label":`Open ${t.name||t.external_id}`,title:`Open`,children:(0,Z.jsx)(mt,{"aria-hidden":!0})})}}]:[]],[t,i,a,o]),c=Ef({features:Ff,data:e,columns:s,getRowId:e=>e.id,getRowCanExpand:()=>!0});return(0,Z.jsxs)(Df,{className:`[&_th]:h-12 [&_th]:px-4 [&_td]:px-4 [&_td]:py-3`,children:[(0,Z.jsx)(Of,{children:c.getHeaderGroups().map(e=>(0,Z.jsx)(Af,{children:e.headers.map(e=>(0,Z.jsx)(jf,{children:(0,Z.jsx)(c.FlexRender,{header:e})},e.id))},e.id))}),(0,Z.jsxs)(kf,{children:[c.getRowModel().rows.map(e=>(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsx)(Af,{children:e.getAllCells().map(e=>(0,Z.jsx)(Mf,{children:(0,Z.jsx)(c.FlexRender,{cell:e})},e.id))}),e.getIsExpanded()&&(0,Z.jsx)(Af,{children:(0,Z.jsx)(Mf,{colSpan:e.getAllCells().length,children:(0,Z.jsxs)(`dl`,{className:`space-y-2 break-all p-3 text-sm`,children:[(0,Z.jsx)(`dt`,{className:`font-medium`,children:`Metadata`}),(0,Z.jsx)(`dd`,{children:(0,Z.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded bg-muted p-3 text-xs whitespace-pre-wrap`,children:JSON.stringify(e.original.metadata,null,2)})})]})})})]},e.id)),!e.length&&(0,Z.jsx)(Af,{children:(0,Z.jsx)(Mf,{colSpan:c.getAllLeafColumns().length,className:`h-32 text-center text-muted-foreground`,children:r?`No records match your filters.`:`No records yet.`})})]})]})}function Lf({options:e,kind:t,session:n}){let r=Bn(),i=ui(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(``),[l]=ua(s.trim(),{wait:300}),[u,d]=(0,X.useState)(`all`),f=e.showAdmin?u:`all`,[p,m]=(0,X.useState)(e.pageSize??20),[h,g]=(0,X.useState)(e.pageSize);h!==e.pageSize&&(g(e.pageSize),m(e.pageSize??20));let _=e.scope??`tenant`,v=e.tenantId!==void 0||e.tenantExternalId!==void 0,y=v||t===`users`&&_===`tenant`,b=li({queryKey:[`identity-tenant`,e.tenantId,e.tenantExternalId],enabled:y,queryFn:({signal:e})=>gi(n,e)}),x=y?b.data:a,S=x?.id,C=t===`users`&&_===`organization`&&!v,w=(t===`users`||v)&&!S,T=e.title??(t===`tenants`?`Tenants`:`Tenant users`);return(0,Z.jsxs)(`section`,{"data-slot":`directory`,"aria-label":T,className:`flex h-full flex-col gap-4 overflow-auto text-foreground`,children:[e.showHeader!==!1&&(0,Z.jsxs)(`header`,{"data-slot":`directory-header`,className:`flex items-center gap-3`,children:[t===`tenants`?(0,Z.jsx)(en,{size:22,"aria-hidden":!0}):(0,Z.jsx)(nn,{size:22,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`font-heading text-lg font-semibold`,children:T}),(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[x?`${x.name||x.external_id} · ${x.external_id}`:_===`tenant`?`Current tenant`:`Current organization`,` `,`· Read-only directory`]})]})]}),C&&(0,Z.jsx)(Rf,{session:n,selected:a,onSelect:t=>{t?.id!==a?.id&&(o(t),e.onTenantChange?.(t))}}),(0,Z.jsxs)(`div`,{"data-slot":`directory-toolbar`,className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsx)(ee,{type:`search`,disabled:w,"aria-label":`Search by name or external ID`,placeholder:`Search by name or external ID…`,value:s,maxLength:255,onChange:e=>c(e.target.value),className:`w-full min-w-0 sm:w-72`}),t===`users`&&e.showAdmin&&(0,Z.jsxs)(Hl,{disabled:w,"aria-label":`Stored admin status`,value:u,onChange:e=>d(e.target.value),children:[(0,Z.jsx)(Ul,{value:`all`,children:`All users`}),(0,Z.jsx)(Ul,{value:`true`,children:`Admins`}),(0,Z.jsx)(Ul,{value:`false`,children:`Non-admins`})]}),(0,Z.jsxs)(`div`,{"data-slot":`directory-page-controls`,className:`flex items-center gap-2 sm:ms-auto`,children:[(0,Z.jsx)(Hl,{disabled:w,"aria-label":`Rows per page`,value:p,onChange:e=>m(Number(e.target.value)),children:[20,50,100].map(e=>(0,Z.jsxs)(Ul,{value:e,children:[e,` per page`]},e))}),(0,Z.jsx)(ut,{variant:`outline`,size:`icon`,"aria-label":`Refresh directory`,title:`Refresh directory`,disabled:i>0,onClick:()=>void r.refetchQueries({type:`active`}),children:(0,Z.jsx)($t,{"aria-hidden":!0,className:i>0?`animate-spin motion-reduce:animate-none`:void 0})})]})]}),y&&b.isError?(0,Z.jsx)(Hf,{error:b.error,retry:()=>void b.refetch()}):y&&b.isPending?(0,Z.jsx)(Vf,{}):w?(0,Z.jsx)(`div`,{"data-slot":`directory-empty`,className:`space-y-3 rounded-lg border border-foreground/10 bg-card p-8 text-center text-card-foreground`,children:(0,Z.jsx)(`p`,{role:`status`,className:`text-muted-foreground`,children:C?`Select a tenant to view its users.`:`No persisted tenant found. Create the tenant, then refresh.`})}):(0,Z.jsx)(zf,{admin:f,options:e,kind:t,session:n,tenantId:S,q:l,size:p},JSON.stringify([S,l,f,p]))]})}function Rf({session:e,selected:t,onSelect:n}){let r=(0,X.useId)(),[i,a]=(0,X.useState)(``),[o]=ua(i.trim(),{wait:300}),s=(0,X.useRef)(null),c=di({queryKey:[`tenant-picker`,o],initialPageParam:``,queryFn:({signal:t,pageParam:n})=>_i(e,{q:o,...n?{page_after:n}:{}},t),getNextPageParam:e=>e.page_after??void 0}),l=c.data?.pages.flatMap(e=>e.items)??[];return(0,Z.jsxs)(`div`,{ref:s,"data-slot":`directory-tenant-picker`,className:`w-full space-y-1.5 sm:max-w-sm`,children:[(0,Z.jsx)(`label`,{htmlFor:r,"data-slot":`directory-tenant-label`,className:`block text-sm font-medium`,children:`Tenant`}),(0,Z.jsxs)(Pl,{items:l,filter:null,value:t,onValueChange:n,itemToStringLabel:e=>`${e.name||e.external_id} · ${e.external_id}`,isItemEqualToValue:(e,t)=>e.id===t.id,onInputValueChange:(e,t)=>{(t.reason===`input-change`||t.reason===`clear-press`)&&a(e)},onOpenChange:e=>{e||a(``)},children:[(0,Z.jsx)(Ll,{id:r,"aria-label":`Tenant`,placeholder:`Find a tenant…`,maxLength:255,showClear:!0,className:`[&_[data-slot=input-group-addon]]:me-0`}),(0,Z.jsxs)(Rl,{container:s,children:[!c.isError&&(0,Z.jsx)(Vl,{children:c.isPending?`Loading tenants…`:`No tenants match.`}),(0,Z.jsx)(zl,{children:e=>(0,Z.jsxs)(Bl,{value:e,children:[e.name||e.external_id,` · `,e.external_id]},e.id)}),c.isError&&(0,Z.jsx)(Hf,{error:c.error,retry:()=>void c.refetch()}),c.hasNextPage&&(0,Z.jsx)(ut,{variant:`ghost`,className:`w-full`,disabled:c.isFetching,onClick:()=>void c.fetchNextPage(),children:c.isFetchingNextPage?`Loading…`:`Load more tenants`})]})]})]})}function zf({options:e,kind:t,session:n,tenantId:r,q:i,admin:a,size:o}){let[s,c]=(0,X.useState)({}),l=li({queryKey:[t,r,i,a,o,s],queryFn:({signal:e})=>vi(n,{kind:t,tenantId:r,q:i,admin:a,size:o,cursor:s},e)});return(0,Z.jsxs)(`div`,{"data-slot":`directory-page`,"aria-busy":l.isFetching,className:`min-w-0 space-y-4`,children:[l.isError?(0,Z.jsx)(Hf,{error:l.error,retry:()=>void l.refetch()}):l.isPending?(0,Z.jsx)(Vf,{}):(0,Z.jsx)(`div`,{"data-slot":`directory-table`,className:`overflow-hidden rounded-lg border border-foreground/10 bg-card text-card-foreground`,children:(0,Z.jsx)(If,{rows:l.data.items,kind:t,options:e,filtered:!!i||a!==`all`},JSON.stringify(s))}),(0,Z.jsx)(`div`,{"data-slot":`directory-pagination`,children:(0,Z.jsx)(Bf,{page:l.isError?void 0:l.data,busy:l.isFetching,onPage:c})})]})}function Bf({page:e,busy:t,onPage:n}){return(0,Z.jsxs)(`nav`,{"aria-label":`Directory pages`,className:`grid grid-cols-2 justify-end gap-2 sm:flex`,children:[(0,Z.jsx)(ut,{variant:`outline`,size:`sm`,disabled:t||!e?.page_before,onClick:()=>n({page_before:e.page_before}),children:`Previous`}),(0,Z.jsx)(ut,{variant:`outline`,size:`sm`,disabled:t||!e?.page_after,onClick:()=>n({page_after:e.page_after}),children:`Next`})]})}function Vf(){return(0,Z.jsx)(`div`,{role:`status`,"aria-label":`Loading directory`,className:`space-y-3 p-4`,children:[0,1,2].map(e=>(0,Z.jsx)(Wl,{className:`h-10 w-full`},e))})}function Hf({error:e,retry:t}){let n=se(e)?e:void 0,r=n?.status,i={401:`Authentication required`,403:`Access denied`,404:`Tenant not found`,429:`Too many requests`},a=n?.headers.get(`retry-after`);return(0,Z.jsxs)(Kl,{variant:`destructive`,children:[(0,Z.jsx)(ql,{children:i[r??0]??`Unable to load directory`}),(0,Z.jsx)(Jl,{children:r===429?`Please retry after ${a??`a few`} seconds.`:e.message}),(0,Z.jsx)(ut,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})}function Uf(e,t,n,r){let i=document.createElement(`style`);i.textContent=jt+(n.customCss??``),e.append(i);let a={root:(0,fi.createRoot)(t),style:i,client:new Xr({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,gcTime:0}}}),options:n,kind:r,revision:0,session:pi(n,()=>Kf(a))};return Yf(a),Wf(a),a}function Wf(e){let t=Qe(e.session.auth);e.root.render((0,Z.jsx)(Vn,{client:e.client,children:t.status===`error`?(0,Z.jsxs)(`div`,{role:`alert`,className:`p-4 text-sm`,children:[(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>Gf(e),children:`Retry authentication`})]}):(0,Z.jsx)(Lf,{options:e.options,kind:e.kind,session:e.session},e.revision)}))}function Gf(e){Qe(e.session.auth).status===`error`?Pe({...e.session.auth,force:!0}).catch(()=>{}):e.client.invalidateQueries()}function Kf(e){e.unsubscribeAuthentication?.(),e.stopAuthentication?.(),hi(e.session),e.client.clear(),e.session=pi(e.options,()=>Kf(e)),e.revision++,Yf(e),Wf(e)}function qf(e,t){let n=e.options;n.customCss!==t.customCss&&(e.style.textContent=jt+(t.customCss??``));let r=n.apiUrl!==t.apiUrl;if(e.options=t,r)return Kf(e);e.session.options=t,Re(e.session.auth,{apiUrl:t.apiUrl,fetchAstralBeamToken:t.fetchAstralBeamToken}),(n.scope!==t.scope||n.tenantId!==t.tenantId||n.tenantExternalId!==t.tenantExternalId)&&(e.client.clear(),e.revision++),Wf(e)}function Jf(e){e.unsubscribeAuthentication?.(),e.stopAuthentication?.(),hi(e.session),e.client.clear(),e.root.unmount(),e.style.remove()}function Yf(e){let t;e.unsubscribeAuthentication=Ft(e.session.auth,()=>{let n=Qe(e.session.auth);if(n.status===`error`)e.client.clear(),e.revision++;else if(n.status===`ready`){let r=Tt(n.currentUser,e.session.auth.session.cached.tenantAdmin);t!==void 0&&t!==r&&(e.session.abortController.abort(),e.session.abortController=new AbortController,e.session.identity=void 0,e.client.clear(),e.revision++),t=r}Wf(e)}),e.stopAuthentication=ft(e.session.auth)}export{Jf as disposeListing,Gf as refreshListing,Uf as renderListing,Kf as resetListing,qf as updateListing};
package/dist/react.d.ts CHANGED
@@ -1,7 +1,63 @@
1
- import { C as AstralBeamChatState, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-BQBdZKyB.js";
2
- import { ReactNode } from "react";
3
- import { AstralBeamChatAttachmentOptions, AstralBeamChatColorScheme, AstralBeamChatTheme, AstralBeamTokenRequest, AstralBeamTokenSource, InferParameters, JsonSchemaObject, MountAstralBeamChatOptions, ParametersSchema, ToolDefinition, WidgetDefinition as WidgetDefinition$1, defineTool } from "@astralbeam/sdk/client";
1
+ import { S as TenantUserRecordEncoded, y as TenantRecordEncoded } from "./api-CWgQSDaI.js";
2
+ import { C as AstralBeamChatState, I as AstralBeamChatColorScheme$1, L as AstralBeamChatTheme$1, R as AstralBeamTokenSource$1, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-C4uH8CV1.js";
3
+ import { CSSProperties, ReactNode } from "react";
4
+ import { AstralBeamChatAttachmentOptions, AstralBeamChatColorScheme, AstralBeamChatTheme, AstralBeamTenantListHandle as AstralBeamTenantListHandle$1, AstralBeamTenantUserListHandle as AstralBeamTenantUserListHandle$1, AstralBeamTokenRequest, AstralBeamTokenSource, InferParameters, JsonSchemaObject, MountAstralBeamChatOptions, MountAstralBeamTenantListOptions, MountAstralBeamTenantUserListOptions, ParametersSchema, ToolDefinition, WidgetDefinition as WidgetDefinition$1, defineTool } from "@astralbeam/sdk/client";
4
5
 
6
+ //#region src/react/listings.d.ts
7
+ type ContainerProps = {
8
+ className?: string | undefined;
9
+ style?: CSSProperties | undefined;
10
+ };
11
+ type AstralBeamTenantListProps = MountAstralBeamTenantListOptions & ContainerProps;
12
+ type AstralBeamTenantUserListProps = MountAstralBeamTenantUserListOptions & ContainerProps;
13
+ declare const AstralBeamTenantList: import("react").ForwardRefExoticComponent<MountAstralBeamTenantListOptions & ContainerProps & import("react").RefAttributes<AstralBeamTenantListHandle$1>>;
14
+ declare const AstralBeamTenantUserList: import("react").ForwardRefExoticComponent<MountAstralBeamTenantUserListOptions & ContainerProps & import("react").RefAttributes<AstralBeamTenantUserListHandle$1>>;
15
+ //#endregion
16
+ //#region src/core/listings.d.ts
17
+ interface AstralBeamListingCoreOptions {
18
+ apiUrl?: string | undefined;
19
+ fetchAstralBeamToken?: AstralBeamTokenSource$1 | undefined;
20
+ /** Tenant is the safe default. Organization mode requires an organization-management JWT. */
21
+ scope?: "tenant" | "organization" | undefined;
22
+ /** Internal UUID. Supply this or tenantExternalId for tenant mode with an organization JWT. */
23
+ tenantId?: string | undefined;
24
+ /** Exact customer-owned Tenant ID. tenantId takes precedence when both are supplied. */
25
+ tenantExternalId?: string | undefined;
26
+ /** Final request failures, after authentication retry. Cancellations are not reported. */
27
+ onError?: ((error: Error) => void) | undefined;
28
+ }
29
+ //#endregion
30
+ //#region src/client/listings.d.ts
31
+ interface AstralBeamListingOptions extends AstralBeamListingCoreOptions {
32
+ fetchAstralBeamToken: NonNullable<AstralBeamListingCoreOptions["fetchAstralBeamToken"]>;
33
+ pageSize?: 20 | 50 | 100 | undefined;
34
+ title?: string | undefined;
35
+ showHeader?: boolean | undefined;
36
+ /** Trusted application CSS, scoped to this widget's shadow root. */
37
+ customCss?: string | undefined;
38
+ colorScheme?: AstralBeamChatColorScheme$1 | undefined;
39
+ theme?: AstralBeamChatTheme$1 | undefined;
40
+ }
41
+ interface MountAstralBeamTenantListOptions$1 extends AstralBeamListingOptions {
42
+ onTenantSelect?: ((tenant: TenantRecordEncoded) => void) | undefined;
43
+ }
44
+ interface MountAstralBeamTenantUserListOptions$1 extends AstralBeamListingOptions {
45
+ /** Called when the Tenant picker selection changes. null means cleared. */
46
+ onTenantChange?: ((tenant: TenantRecordEncoded | null) => void) | undefined;
47
+ /** Show the stored admin column and filter. Does not control authorization. Defaults to false. */
48
+ showAdmin?: boolean | undefined;
49
+ onTenantUserSelect?: ((user: TenantUserRecordEncoded) => void) | undefined;
50
+ }
51
+ interface AstralBeamListingHandle<T extends AstralBeamListingOptions = AstralBeamListingOptions> {
52
+ update(options: Partial<T>): void;
53
+ refresh(): void;
54
+ /** Clears state and reloads using the ready host session. Unmount during sign-out or account transitions. */
55
+ reset(): void;
56
+ unmount(): void;
57
+ }
58
+ type AstralBeamTenantListHandle = AstralBeamListingHandle<MountAstralBeamTenantListOptions$1>;
59
+ type AstralBeamTenantUserListHandle = AstralBeamListingHandle<MountAstralBeamTenantUserListOptions$1>;
60
+ //#endregion
5
61
  //#region src/react/index.d.ts
6
62
  interface WidgetDefinition extends Omit<WidgetDefinition$1, "render"> {
7
63
  /** Draws the widget with the agent-chosen props, in the host's own React tree. */
@@ -55,4 +111,4 @@ interface AstralBeamChatProps extends Omit<MountAstralBeamChatOptions, "widgets"
55
111
  }
56
112
  declare const AstralBeamChat: import("react").ForwardRefExoticComponent<AstralBeamChatProps & import("react").RefAttributes<AstralBeamChatRef>>;
57
113
  //#endregion
58
- export { AstralBeamChat, type AstralBeamChatAttachmentOptions, type AstralBeamChatColorScheme, type AstralBeamChatCore, type AstralBeamChatCoreOptions, AstralBeamChatProps, AstralBeamChatRef, type AstralBeamChatState, type AstralBeamChatTheme, type AstralBeamTokenRequest, type AstralBeamTokenSource, type InferParameters, type ParametersSchema, type ToolDefinition, TypedReactWidgetDefinition, UseAstralBeamChatResult, WidgetDefinition, defineTool, defineWidget, useAstralBeamChat };
114
+ export { AstralBeamChat, type AstralBeamChatAttachmentOptions, type AstralBeamChatColorScheme, type AstralBeamChatCore, type AstralBeamChatCoreOptions, AstralBeamChatProps, AstralBeamChatRef, type AstralBeamChatState, type AstralBeamChatTheme, AstralBeamTenantList, type AstralBeamTenantListHandle, type AstralBeamTenantListProps, AstralBeamTenantUserList, type AstralBeamTenantUserListHandle, type AstralBeamTenantUserListProps, type AstralBeamTokenRequest, type AstralBeamTokenSource, type InferParameters, type ParametersSchema, type ToolDefinition, TypedReactWidgetDefinition, UseAstralBeamChatResult, WidgetDefinition, defineTool, defineWidget, useAstralBeamChat };