@vertesia/ui 0.61.0 → 0.63.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.
- package/lib/esm/core/components/shadcn/calendar.js +7 -39
- package/lib/esm/core/components/shadcn/calendar.js.map +1 -1
- package/lib/esm/core/components/shadcn/filters/comboBox.js +6 -3
- package/lib/esm/core/components/shadcn/filters/comboBox.js.map +1 -1
- package/lib/esm/core/components/shadcn/filters/dateFilter.js +10 -5
- package/lib/esm/core/components/shadcn/filters/dateFilter.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/components/shadcn/calendar.d.ts +3 -3
- package/lib/vertesia-ui-core.js +1 -1
- package/lib/vertesia-ui-core.js.map +1 -1
- package/package.json +5 -5
- package/src/core/components/shadcn/calendar.tsx +9 -65
- package/src/core/components/shadcn/filters/comboBox.tsx +7 -6
- package/src/core/components/shadcn/filters/dateFilter.tsx +34 -16
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
3
|
-
export type CalendarProps = React.ComponentProps<typeof
|
|
2
|
+
import DatePicker from "react-date-picker";
|
|
3
|
+
export type CalendarProps = React.ComponentProps<typeof DatePicker> & {
|
|
4
4
|
size?: "sm" | "md" | "lg";
|
|
5
5
|
};
|
|
6
|
-
declare function Calendar({ className,
|
|
6
|
+
declare function Calendar({ className, size, ...props }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
declare namespace Calendar {
|
|
8
8
|
var displayName: string;
|
|
9
9
|
}
|
package/lib/vertesia-ui-core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{cva as r}from"class-variance-authority";import s,{clsx as a}from"clsx";import{twMerge as i}from"tailwind-merge";import{ChevronUpIcon as l,ChevronDownIcon as o,Loader2 as c,Check as d,CopyIcon as u,Computer as h,Sun as m,Moon as p,X as f,Search as g,ChevronsUpDown as x,SearchIcon as v,SquarePlus as b,ChevronRight as y,MoreHorizontal as N,ChevronLeft as w,ListFilter as k,TriangleAlert as C,Info as _,AlertTriangle as z,CircleX as I,CircleCheck as L,ChevronDown as T,Plus as O,ChevronsUpDownIcon as R}from"lucide-react";import*as S from"react";import M,{createContext as E,useContext as P,useRef as D,useState as A,useEffect as $,forwardRef as F,Fragment as j,useMemo as V,isValidElement as B,useLayoutEffect as U}from"react";import{createPortal as W}from"react-dom";import{Slot as G}from"@radix-ui/react-slot";import{VTooltip as H}from"@vertesia/ui/core";import*as Y from"@radix-ui/react-dialog";import*as K from"@radix-ui/react-separator";import{isEqual as Z}from"lodash-es";import*as q from"@radix-ui/react-popover";import{Command as X}from"cmdk";import*as J from"@radix-ui/react-tabs";import*as Q from"@radix-ui/react-tooltip";import*as ee from"@radix-ui/react-label";import te from"dayjs";import{DayPicker as ne}from"react-day-picker";import*as re from"@radix-ui/react-checkbox";import{Transition as se,Menu as ae,MenuButton as ie,MenuItems as le,MenuItem as oe,Listbox as ce,ListboxButton as de,ListboxOptions as ue,ListboxOption as he,Dialog as me,TransitionChild as pe,DialogPanel as fe,DialogTitle as ge,RadioGroup as xe,Switch as ve}from"@headlessui/react";function be(e){switch(e){case"xs":return"size-4";case"sm":return"size-6";case"md":return"size-8";case"lg":return"size-10";case"xl":return"size-12";case"2xl":return"size-14";default:throw new Error("Unexpected size: "+e)}}function ye({size:t,src:n,name:r,shape:s="circle",color:a="bg-gray-500",className:i}){const l="circle"===s?"rounded-full":"rounded-md",o=be(t||"md");if(n)return e("img",{className:`inline-block ${o} ${l} ${a} ${i}`,src:n,alt:r||n,title:r});if(r){const[n,s]=r.split(" ");let c=s?`${n[0]}${s[0]}`:`${n[0]}${n[1]}`;return e("span",{className:`inline-flex ${o} items-center justify-center ${l} ${a} ${i}`,title:r,children:e("span",{className:("xs"!=t?"text-xs":"text-[0.6rem]")+" font-medium leading-none text-white",children:c})})}return e("span",{className:`inline-block ${o} overflow-hidden ${l} ${a}`,children:e("svg",{className:"h-full w-full text-gray-300",fill:"currentColor",viewBox:"0 0 24 24",children:e("path",{d:"M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z"})})})}function Ne({size:t,shape:n="circle",color:r="bg-gray-500",className:s,children:a}){const i="circle"===n?"rounded-full":"rounded-md",l=be(t||"md");return e("span",{className:`inline-block ${l} overflow-hidden ${i} ${r} ${s}`,children:a})}function we(...e){return i(a(e))}const ke=r("inline-flex items-center rounded-md px-2 py-1 text-xs font-medium",{variants:{variant:{default:"text-foreground bg-muted",secondary:"bg-secondary text-primary",destructive:"bg-destructive text-destructive",attention:"bg-attention text-attention",success:"bg-success text-success",info:"bg-info text-info",done:"bg-done text-done"}},defaultVariants:{variant:"default"}});function Ce({className:t,variant:n,children:r,onClick:s,...a}){return e("span",{className:we(ke({variant:n}),t),onClick:s,...a,children:r})}const _e=r("inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ring-1 ring-inset ring-border",{variants:{variant:{default:"",success:"",destructive:"",attention:"",done:"",info:""}},defaultVariants:{variant:"default"}}),ze=r("h-1.5 w-1.5",{variants:{variant:{default:"fill-foreground",success:"fill-success",destructive:"fill-destructive",attention:"fill-attention",done:"fill-done",info:"fill-info"}},defaultVariants:{variant:"default"}});function Ie({variant:n,className:r,dotClassName:s,children:a,...i}){return t("span",{className:we(_e({variant:n}),r),...i,children:[e("svg",{className:we(ze({variant:n}),s),viewBox:"0 0 6 6","aria-hidden":"true",children:e("circle",{cx:3,cy:3,r:3})}),a]})}function Le({className:t,children:n}){return e("div",{className:s("flex items-ceter justify-center",t),children:n})}class Te{left;top;width;height;alignAxis;gap;constructor(e=0){this.gap=e}position(e,t,n){switch(e){case"top":this.top=t.top-n.height-this.gap,this.alignAxis="x";break;case"bottom":this.top=t.bottom+this.gap,this.alignAxis="x";break;case"left":this.left=t.left-n.width-this.gap,this.alignAxis="y";break;case"right":this.left=t.right+this.gap,this.alignAxis="y";break;case"ne":this.top=t.top-n.height-this.gap,this.left=t.right+this.gap;break;case"nw":this.top=t.top-n.height-this.gap,this.left=t.left-n.width-this.gap;break;case"se":this.top=t.bottom+this.gap,this.left=t.right+this.gap;break;case"sw":this.top=t.bottom+this.gap,this.left=t.left-n.width-this.gap}}align(e,t,n){if(this.alignAxis)switch(e){case"start":"x"===this.alignAxis?this.left=t.left:this.top=t.top;break;case"end":"x"===this.alignAxis?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case"center":"x"===this.alignAxis?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case"fill":"x"===this.alignAxis?(this.left=t.left,this.width=t.right-t.left):(this.top=t.top,this.height=t.bottom-t.top)}}computePosition(e,t,n){if(this.position(e.position,n,t),e.align&&this.align(e.align,n,t),!this.left&&!this.top)throw new Error("Invalid position. Cannot compute x,y coordinates");const r=null!=this.width,s=null!=this.height,a=r?this.width:t.width,i=s?this.height:t.height;return{rect:new DOMRect(this.left,this.top,a,i),constrainWidth:r,constrainHeight:s,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){const t=function(e){switch(e){case"start":return"end";case"end":return"start";default:return e}}(e.align);if(t!==e.align)return{...e,align:t}}}else{const t=function(e){switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne";default:return e}}(e.position);if(t!==e.position)return{...e,position:t}}return null}}function Oe(e,t,n){return"x"===n?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function Re(e,t,n,r){const s=new Te(e.gap);let a=s.computePosition(e,t,n);const i=Oe(a.rect,r,"x"),l=Oe(a.rect,r,"y");if(i&&l)return a;let o=null;return i||(o=s.flipAxis(e,"x")),l||(o=s.flipAxis(o||e,"y")),o?(a=new Te(s.gap).computePosition(o,t,n),function(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}(a.rect,r)?a:null):null}function Se(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),s=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return s<=n||a<=r?null:new DOMRect(n,r,s-n,a-r)}function Me(e){const t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){const r=getComputedStyle(e);if(t&&"visible"!==r.overflowY||n&&"visible"!==r.overflowX)return!0}return!1}class Ee{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=function(e,t=document.documentElement){const n=[];let r=e.parentElement;for(;r&&r!==t;)Me(r)&&n.push(r),r=r.parentElement;return n.push(t),n}(this.anchor,this.root),this.visibleClientRect=function(e){if(0===e.length)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Se(e[n].getBoundingClientRect(),t),!t)return null;return t}(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){const t=this.scrollableParents,n=()=>{this.update()};window.addEventListener("resize",n);for(const e of t)e.addEventListener("scroll",n);let r,s;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout((function(){r&&document.addEventListener("click",r)}),0)),this.options.closeOnEsc&&(s=e=>{"Escape"===e.key&&this.tryClose()},window.setTimeout((function(){s&&document.addEventListener("keydown",s)}),0));const a=this.options.blockPageScroll;return a&&(document.body.style.overflow="hidden",document.body.style.height="100%"),()=>{window.removeEventListener("resize",n);for(const e of t)e.removeEventListener("scroll",n);r&&document.removeEventListener("click",r),s&&document.removeEventListener("keydown",s),a&&(document.body.style.overflow="",document.body.style.height="")}}open(e,t){if(this.context)throw new Error("The popup controller is already bound to an element");this.tryOpen(e,t)}tryOpen(e,t){this.context||(this.context={element:e,constraints:t,cleanup:this.registerListeners(e)},e.style.display="",e.style.visibility="hidden",this.update(),this.options.onOpen&&this.options.onOpen(this))}close(){if(!this.context)throw new Error("The popup controller is not bound to an element");this.tryClose()}tryClose(){this.context&&(this.options.onClose&&this.options.onClose(this),this.context.cleanup(),this.context.element.style.display="none",this.context=void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;const e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),s=this.visibleClientRect;if(!s)return;const a=Re(t,n,r,s);this.context.position=a||void 0,a&&(a.constrainHeight&&(e.style.height=a.rect.height+"px"),a.constrainWidth&&(e.style.width=a.rect.width+"px"),e.style.left=a.rect.left+"px",e.style.top=a.rect.top+"px",e.style.visibility="visible")}createPopupElement(){const e=document.createElement("div");return e.style.margin="0",e.style.padding="0",e.style.border="none",e.style.background="transparent",e.className="composable-Popup",e}}const Pe=E(void 0);function De(){const e=P(Pe);if(!e)throw new Error("usePopupController must be used inside a Popup component");return e}function Ae({ctrlRef:t,id:n,constraints:r,isOpen:s,children:a,className:i,onClose:l,zIndex:o,position:c,...d}){const u=D(null),[h,m]=A();return $((()=>{if(!d.anchor)throw new Error("Anchor element is required");const e=new Ee({...d,onClose:l});return m(e),()=>{e.tryClose()}}),[]),$((()=>{t&&(t.current=h)}),[h]),$((()=>{h&&u.current?h.isOpen!==s&&(s?h.open(u.current,r):h.close()):h?.isOpen&&!s&&h.close()}),[s,h,u.current]),e(Pe.Provider,{value:h,children:s&&W(e("div",{id:n,style:{visibility:"hidden",position:c||"absolute",zIndex:o||100},ref:u,className:i,children:a}),document.body)})}function $e({anchor:t,root:n,children:r,...s}){return!t.current||n&&!n.current?null:e(Ae,{anchor:t.current,root:n?.current||void 0,...s,children:r})}class Fe{filter(e,t){const n=t.toLowerCase();return e.filter((e=>this.valueOf(e).toLowerCase().includes(n)))}renderOption(e){return this.valueOf(e)}findById(e,t){return e.find((e=>this.idOf(e)===t))}createItem(e){return null}}class je extends Fe{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new je}class Ve extends je{createItem(e){return e}static instance=new Ve}function Be(e,t){return{buttonRight:4,buttonWidth:24,maxMenuHeight:240,menuClass:"w-72 bg-white mt-1 shadow-md border border-gray-200 overflow-auto p-0 z-10",inputClass:s(t?"block m-0 p-0 border-0 focus:outline-none focus:ring-0 bg-transparent":"block sm:text-sm sm:leading-6 rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-slate-600 dark:text-slate-50 dark:bg-slate-800 placeholder:text-gray-400 dark:placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 dark:focus:ring-indigo-800 py-1.5",e?"w-full":"!w-auto"),optionClass:"py-2 px-3 shadow-sm flex flex-col [&.option-selected]:font-semibold [&.option-highlighted]:bg-blue-300",Input:We,Menu:He,Toggle:Ge}}function Ue({menuAlign:r="fill",menuGap:s,focusOnMount:a,onSelect:i,value:l,zIndex:o,unstyledInput:c,fullWidth:d,api:u,layout:h,adapter:m,items:p,placeholder:f}){const[g]=A(`combobox-popup-${Math.floor(1e6*Math.random())}`),x=D(void 0),v=D(null),b=h?Object.assign(Be(d,c),h):Be(d,c),y=M.useRef(null),N=Ye({adapter:m,items:p,value:l,popupId:g});$((()=>{v.current&&a&&v.current.focus()}),[v.current]),$((()=>{N.onSelect=i,N.popupCtrl=x.current}),[i,x.current]),$((()=>{if(u&&N&&v.current)return u.current={open:()=>N.openMenu(),close:()=>N.closeMenu(),toggle:()=>N.toggleMenu(),setInputValue:e=>N.inputText=e,inputValue:N.inputText||"",selectedItem:N.selectedItem,focus:()=>v.current?.focus()},()=>{u.current=null}}),[u,N,v.current]);const w=N.isMenuOpen&&N.filteredItems.length>0;return t(n,{children:[e(b.Input,{boxRef:y,inputRef:v,ctrl:N,layout:b,placeholder:f}),e($e,{id:g,ctrlRef:x,className:"combobox-popup",closeOnClick:!0,closeOnEsc:!0,onClose:()=>N.closeMenu(),isOpen:w,anchor:y,zIndex:o,constraints:{position:"bottom",align:r,gap:null!=s?s:4},children:e(b.Menu,{fillWidth:"fill"===r,items:N.filteredItems,ctrl:N,layout:b,adapter:m})})]})}function We({inputRef:n,placeholder:r,boxRef:s,ctrl:a,layout:i}){const l=i.buttonWidth,o=l>0?{paddingRight:`${l}px`}:void 0,c=i.Toggle;return t("div",{className:"relative",ref:s,children:[e("input",{ref:n,placeholder:r,...a.getInputProps(),style:o,className:i.inputClass}),c&&e("button",{style:{top:0,bottom:0,right:`${i.buttonRight}px`,width:`${l}px`,position:"absolute",border:"none",padding:0,margin:0,backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},...a.getToggleButtonProps(),children:e(c,{ctrl:a,layout:i})})]})}function Ge({ctrl:t}){return t.isMenuOpen?e(l,{className:"w-4 h-4"}):e(o,{className:"w-4 h-4"})}function He({fillWidth:t,items:n,layout:r,ctrl:a,adapter:i}){const{highlightedIndex:l,selectedItem:o}=a;return e("ul",{style:{width:t?"100%":void 0,maxHeight:r.maxMenuHeight?`${r.maxMenuHeight}px`:"240px"},className:r.menuClass,...a.getMenuProps(),children:n.map(((t,n)=>e("li",{"data-index":n,className:s(r.optionClass,l===n&&"option-highlighted",o===t&&"option-selected"),...a.getItemProps(t,n),children:i.renderOption(t)},i.idOf(t))))})}function Ye(e){const[t,n]=A(new Ke(e));return $((()=>{t?.withState(n)}),[]),t}class Ke{popupId;items;adapter;onSelect;setState;_selectedItem=null;_filteredItems;_inputText="";_highlightedIndex=null;_isMenuOpen=!1;popupCtrl;constructor({adapter:e,items:t,value:n,popupId:r}){this.adapter=e,this.items=t,this.popupId=r,"string"==typeof n?this._inputText=n:n&&(this._selectedItem=e.findById(t,e.idOf(n))||null,this._selectedItem&&(this._inputText=e.valueOf(n))),this._inputText?this._filteredItems=this.adapter.filter(this.items,this._inputText):this._filteredItems=this.items}withState(e){return this.setState=e,this}clone(){const e=new Ke({adapter:this.adapter,items:this.items,popupId:this.popupId});return e.setState=this.setState,e.onSelect=this.onSelect,e._inputText=this._inputText,e._highlightedIndex=this._highlightedIndex,e._selectedItem=this._selectedItem,e._isMenuOpen=this._isMenuOpen,e._filteredItems=this._filteredItems,e.popupCtrl=this.popupCtrl,e}updateState(){this.setState?.(this.clone())}get filteredItems(){return this._inputText?this.adapter.filter(this.items,this._inputText):this.items}get selectedItem(){return this._selectedItem}set selectedItem(e){this._selectedItem=e,this._inputText=e?this.adapter.valueOf(e):"",this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items,this.updateState(),this.onSelect?.(e)}get isMenuOpen(){return this._isMenuOpen}set inputText(e){if(this._inputText=e,this._filteredItems=e?this.adapter.filter(this.items,e):this.items,this._highlightedIndex=null,this._selectedItem=null,this.updateState(),this.isMenuOpen&&this.popupCtrl){const e=this.popupCtrl,t=e.context?.position?.position;t&&"top"===t&&window.setTimeout((()=>{e.update()}),100)}}get inputText(){return this._inputText}set highlightedIndex(e){this._highlightedIndex=e,this.updateState()}get highlightedIndex(){return this._highlightedIndex}openMenu(){this._filteredItems.length>0&&(this._isMenuOpen=!0,this.updateState())}closeMenu(e){this._isMenuOpen&&(this._highlightedIndex=null,this._isMenuOpen=!1,this.updateState())}toggleMenu(){this._isMenuOpen?this.closeMenu():this.openMenu()}highlightIndex(e,t=!1){this.highlightedIndex=e;const n=document.getElementById(this.popupId);n&&n.querySelector(`li[data-index="${e}"]`)?.scrollIntoView(t)}getMenuProps(){return{}}getToggleButtonProps(){return{onClick:()=>{this._isMenuOpen=!this._isMenuOpen,this.updateState()}}}getItemProps(e,t){return{"aria-selected":this._highlightedIndex===t,onClick:()=>{this.selectedItem=e,this.closeMenu()},onMouseEnter:()=>{this.highlightedIndex!==t&&(this.highlightedIndex=t)},onMouseLeave:()=>{this.highlightedIndex===t&&(this.highlightedIndex=null)}}}getInputProps(){const e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{const t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{const n=t.key;if("Enter"===n){if(null!=this.highlightedIndex)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){const e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else"ArrowDown"===n?this.isMenuOpen?this.highlightIndex(null===this.highlightedIndex?0:(r=this.highlightedIndex,s=e.length,(r+1)%s),!1):this.openMenu():"ArrowUp"===n&&this.isMenuOpen&&this.highlightIndex(null===this.highlightedIndex?0:function(e,t){return(e-1+t)%t}(this.highlightedIndex,e.length),!0);var r,s}}}}const Ze=r("hover:cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{destructive:"bg-destructive dark:bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive-muted/50 dark:ring-destructive-muted/50 shadow-xs hover:bg-destructive/50",outline:"border border-input bg-background shadow-xs hover:bg-muted ring-inset",secondary:"bg-primary/5 dark:bg-primary/10 text-primary shadow-xs hover:bg-primary/10 dark:hover:bg-primary/20 ring-inset",ghost:"hover:bg-muted/50 dark:hover:bg-muted/20 ring-inset",link:"text-white underline-offset-4 hover:underline ring-inset",primary:"bg-primary text-white shadow-xs hover:bg-primary/90 ring-inset",unstyled:""},size:{xs:"h-7 rounded px-2 py-1 text-xs gap-x-1",sm:"h-8 rounded px-3 text-xs",md:"h-9 rounded-md px-4 py-2",lg:"h-10 rounded-md px-3",xl:"rounded-md px-3.5 py-2.5 text-sm gap-x-2",icon:"p-0 m-0 rounded-full"}},defaultVariants:{variant:"primary",size:"md"}}),qe=S.forwardRef((({className:n,variant:r,size:a,asChild:i=!1,alt:l,isDisabled:o,isLoading:d,title:u,onClick:h,type:m,...p},f)=>{const g=t(i?G:"button",{className:s(we(Ze({variant:r,size:a})),n),disabled:o||d||p.disabled,ref:f,onClick:h,type:m,autoFocus:!1,...p,children:[d&&e(c,{className:"animate-spin"}),p.children]});return l||u?e(H,{description:l||u,asChild:!0,className:"cursor-pointer",size:"xs",placement:"top",children:g}):g}));qe.displayName="Button";const Xe=S.forwardRef((({size:t,content:n,toast:r,className:s,alt:a,...i},l)=>{const[o,c]=A(!1);return e(qe,{ref:l,className:we(s),variant:"unstyled",size:t||"sm",onClick:()=>{navigator.clipboard.writeText(n).then((()=>{c(!0),setTimeout((()=>c(!1)),2e3),r&&r.toast&&r.toast({status:"success",title:r.message||"Copied to clipboard",duration:2e3})})).catch((e=>{console.error("Failed to copy text: ",e),r&&r.toast&&r.toast({status:"error",title:"Failed to copy",duration:2e3})}))},...i,alt:a??"Copy",children:o?e(d,{className:"text-success"}):e(u,{className:"size-4"})})}));Xe.displayName="CopyButton";const Je=E({theme:"system",setTheme:()=>null});function Qe({children:t,defaultTheme:n="system",storageKey:r="vite-ui-theme",...s}){const[a,i]=A((()=>localStorage.getItem(r)||n));$((()=>{const e=window.document.documentElement;if(e.classList.remove("light","dark"),"system"!==a)e.classList.add(a);else{const t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";e.classList.add(t)}}),[a]);const l={theme:a,setTheme:e=>{localStorage.setItem(r,e),i(e)}};return e(Je.Provider,{...s,value:l,children:t})}const et=()=>{const e=P(Je);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e};function tt({option:t,current:n,setTheme:r,icon:s}){return e(qe,{variant:n===t?"secondary":"outline",size:"sm",onClick:()=>r(t),alt:t,children:s})}function nt(){const{setTheme:n}=et(),r=et().theme;return t("div",{className:"flex justify-between px-2 items-center",children:[e("p",{className:"text-sm font-semibold",children:"Theme"}),t("div",{className:"flex gap-2",children:[e(tt,{current:r,option:"system",setTheme:n,icon:e(h,{className:"text-muted"})}),e(tt,{current:r,option:"light",setTheme:n,icon:e(m,{className:"text-muted"})}),e(tt,{current:r,option:"dark",setTheme:n,icon:e(p,{className:"text-muted"})})]})]})}const rt=S.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:we("rounded-xl border bg-card text-card-foreground shadow",t),...n})));rt.displayName="Card";const st=S.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:we("flex flex-col p-6",t),...n})));st.displayName="CardHeader";const at=S.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:we("font-semibold leading-none tracking-tight",t),...n})));at.displayName="CardTitle";const it=S.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:we("text-sm text-muted-foreground",t),...n})));it.displayName="CardDescription";const lt=S.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:we("p-6 pt-0",t),...n})));lt.displayName="CardContent";const ot=S.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:we("flex items-center p-6 pt-0",t),...n})));function ct({children:t}){return e("span",{style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},children:t})}ot.displayName="CardFooter";const dt=E(!1);function ut(){return!!P(dt)}function ht({children:t}){return e(dt.Provider,{value:!0,children:t})}function mt({className:n,children:r,isOpen:s,onClose:a,description:i="Modal Description",noCloseButton:l=!1,allowOverflow:o=!1,disableCloseOnClickOutside:c=!1}){const d=e=>{e||a()};return t(xt,{open:s,onOpenChange:e=>{c&&!e||d(e)},children:[o&&e(Nt,{className:"z-50 fixed inset-0 bg-black/80"}),e(ct,{children:e(kt,{children:i})}),t(wt,{className:we("min-h-20 p-4","fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 sm:rounded-lg",n),children:[!l&&e(yt,{onClick:()=>d(!1),asChild:!0,autoFocus:!1,children:e(qe,{variant:"outline",alt:"Close",className:"top-4 right-4 absolute data-[state=open]:bg-accent opacity-70 hover:opacity-100 rounded-sm focus:outline-none focus:ring-2 focus:ring-ring ring-offset-background focus:ring-offset-2 data-[state=open]:text-muted-foreground transition-opacity disabled:pointer-events-none",children:e(f,{className:"w-4 h-4"})})}),e(ht,{children:r})]})]})}const pt=({children:t,show:n=!0,className:r,...s})=>n?e(Ct,{className:we("text-lg font-semibold leading-6 tracking-tight py-2",r),...s,children:t}):e(ct,{children:e(Ct,{children:t})}),ft=({children:t,className:n,...r})=>e("div",{className:we("text-sm max-h-[80vh] overflow-y-auto",n),...r,children:t}),gt=({align:t="right",children:n,className:r,...s})=>e("div",{className:we("w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end sm:space-x-2",{left:"justify-start",center:"justify-center",right:"justify-end"}[t],r),...s,children:n}),xt=Y.Root,vt=Y.Trigger,bt=Y.Portal,yt=Y.Close,Nt=S.forwardRef((({className:t,...n},r)=>e(Y.Overlay,{ref:r,className:we("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n})));Nt.displayName=Y.Overlay.displayName;const wt=S.forwardRef((({className:n,children:r,...s},a)=>t(bt,{children:[e(Nt,{}),e(Y.Content,{ref:a,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:we("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-2 border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...s,children:r})]})));wt.displayName=Y.Content.displayName;const kt=S.forwardRef((({className:t,...n},r)=>e(Y.Description,{ref:r,className:we("text-sm text-muted-foreground",t),...n})));kt.displayName=Y.Description.displayName;const Ct=S.forwardRef((({className:t,...n},r)=>e(Y.Title,{ref:r,className:we("text-lg font-semibold leading-none tracking-tight",t),...n})));Ct.displayName=Y.Title.displayName;const _t=r("",{variants:{size:{xs:"rounded py-1 text-xs rounded-xs",sm:"rounded text-xs rounded-sm",md:"rounded-md py-2 text-sm",lg:"rounded-md text-base",xl:"rounded-md py-2.5 text-lg"},variant:{default:"flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",unstyled:"block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent",noPadding:"block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background",legacy:"py-1.5 block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background"}},defaultVariants:{size:"md",variant:"default"}}),zt=S.forwardRef((({className:n,type:r,size:s="md",variant:a="default",clearable:i=!0,onChange:l,value:o,...c},d)=>t("div",{className:"w-full",style:{position:"relative",display:"inline-block"},children:[e("input",{type:r,className:we(_t({size:s,variant:a}),n,i&&o?"pr-6":""),ref:d,value:null==o?"":o,onChange:e=>{l&&l(e.target.value)},...c}),i&&o&&!c.readOnly&&!c.disabled&&e("button",{onClick:()=>{l&&l("")},className:`absolute ${"number"!==r?"right-0":"right-7"} top-1/2 -translate-y-1/2 size-7 text-muted-foreground hover:text-destructive cursor-pointer flex items-center justify-center`,type:"button","aria-label":"Clear input",children:e(f,{size:16})})]})));zt.displayName="Input";const It=S.forwardRef((({className:t,orientation:n="horizontal",decorative:r=!0,...s},a)=>e(K.Root,{ref:a,decorative:r,orientation:n,className:we("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",t),...s})));It.displayName=K.Root.displayName;const Lt=S.createContext(null),Tt=({hover:t=!1,click:n=!1,children:r,_open:s,onOpenChange:a})=>{const[i,l]=S.useState(s||!1),o=ut();return e(Lt.Provider,{value:{open:i,setOpen:l,hover:t,click:n},children:e(q.Root,{open:i,onOpenChange:e=>{l(e),a&&a(e)},modal:o,children:r})})};function Ot(e=!1,t=()=>{},n){e&&t("enter"===n)}const Rt=S.forwardRef((({children:t,...n},r)=>{const s=S.useContext(Lt);if(!s)throw new Error("PopoverTrigger must be used within a Popover");const{setOpen:a,hover:i,click:l}=s;return e(q.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>Ot(i,a,"enter"),onMouseLeave:()=>Ot(i,a,"leave"),onClick:()=>{l&&a((e=>!e))},...n,children:t})}));Rt.displayName=q.Trigger.displayName;const St=q.Anchor,Mt=S.forwardRef((({className:t,align:n="center",side:r="bottom",...s},a)=>{const i=S.useContext(Lt);if(!i)throw new Error("PopoverContent must be used within a Popover");const{setOpen:l,hover:o}=i;return e(q.Portal,{children:e(q.Content,{ref:a,align:n,side:r,onMouseEnter:()=>Ot(o,l,"enter"),onMouseLeave:()=>Ot(o,l,"leave"),className:we("z-50 w-72 rounded-md border-popover bg-popover text-popover-foreground ring-1 ring-gray-200 dark:ring-slate-700 shadow-md focus:outline-none animate-in","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",t),...s})})}));Mt.displayName=q.Content.displayName;const Et=q.Close;Et.displayName=q.Close.displayName;const Pt=S.forwardRef((({className:t,...n},r)=>e(X,{ref:r,className:we("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...n})));Pt.displayName=X.displayName;const Dt=({children:t,...n})=>e(xt,{...n,children:e(wt,{className:"shadow-lg p-0 overflow-hidden",children:e(Pt,{className:"[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:w-5 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",children:t})})}),At=S.forwardRef((({className:n,...r},s)=>t("div",{className:"flex items-center px-3 border-b","cmdk-input-wrapper":"",children:[e(g,{className:"opacity-50 size-4 shrink-0"}),e(X.Input,{ref:s,className:we("focus:ring-0","border-0 flex h-8 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",n),...r})]})));At.displayName=X.Input.displayName;const $t=S.forwardRef((({className:t,...n},r)=>e(X.List,{ref:r,className:we("max-h-[200px] overflow-y-auto overflow-x-hidden",t),...n})));$t.displayName=X.List.displayName;const Ft=S.forwardRef(((t,n)=>e(X.Empty,{ref:n,className:"py-2 text-sm text-center",...t})));Ft.displayName=X.Empty.displayName;const jt=S.forwardRef((({className:t,...n},r)=>e(X.Group,{ref:r,className:we("overflow-y-auto overflow-x-hidden p-1 text-foreground","[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...n})));jt.displayName=X.Group.displayName;const Vt=S.forwardRef((({className:t,...n},r)=>e(X.Separator,{ref:r,className:we("-mx-1 h-px bg-border",t),...n})));Vt.displayName=X.Separator.displayName;const Bt=S.forwardRef((({className:t,...n},r)=>e(X.Item,{ref:r,className:we("hover:bg-muted cursor-pointer relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...n})));Bt.displayName=X.Item.displayName;const Ut=({className:t,...n})=>e("span",{className:we("ml-auto text-xs tracking-widest text-muted-foreground",t),...n});function Wt({options:n,optionLabel:r,value:a,onChange:i,addNew:l,addNewLabel:o,disabled:c,filterBy:u,label:h,placeholder:m,className:p,popupClass:g,isClearable:y,border:N=!0,multiple:w=!1,by:k}){const C=D(null),[_,z]=A(!1),[I,L]=A(0),[T,O]=A("");$((()=>{const e=C.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect().width;L(t)},n=new ResizeObserver((()=>{t()}));return t(),n.observe(e),()=>{n.disconnect()}}),[]);const R=(e,t)=>!(!t||0===t.length)&&t.some((t=>S(t,e))),S=(e,t)=>null==e||null==t?e===t:"string"==typeof k?e[k]===t[k]:"function"==typeof k?k(e,t):Z(e,t);let M=n||[];const E=T.toLowerCase(),P=function(e){return e?"string"==typeof e?t=>String(t[e]).toLowerCase():e:e=>String(e).toLowerCase()}(u);M=M.filter((e=>P(e).includes(E)));return t(Tt,{children:[e(Rt,{asChild:!0,children:t("div",{ref:C,onClick:e=>{c?e.preventDefault():z(!_)},className:s(p,N&&"border border-border","flex flex-row gap-2 items-center justify-between p-2 rounded-md group relative",!c&&"cursor-pointer hover:bg-muted"),children:[t("div",{className:s("flex flex-col w-full rounded-md text-sm items-center justify-center truncate",!c&&"",y&&a&&(!Array.isArray(a)||a.length>0)&&"pr-6"),children:[h&&e("div",{className:"w-full text-left text-xs font-semibold",children:h}),e("div",{className:s("w-full text-left",!c&&""),children:w?(()=>{const n=Array.isArray(a)?a:a?[a]:[];return 0===n.length?e("span",{className:"text-muted",children:m}):1===n.length?r?r(n[0]):n[0]:t("div",{className:"flex flex-wrap gap-1",children:[n.slice(0,1).map(((t,n)=>e("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded",children:r?r(t):t},n))),n.length>1&&t("span",{className:"inline-flex items-center px-2 py-1 text-xs bg-muted rounded",children:["+",n.length-1," more"]})]})})():(()=>{if(!a||Array.isArray(a)&&0===a.length)return e("span",{className:"text-muted",children:m});const t=Array.isArray(a)?a[0]:a;return r?r(t):t})()})]}),t("div",{className:"flex items-center gap-1",children:[y&&a&&(!Array.isArray(a)||a.length>0)&&e("div",{onClick:e=>{e.stopPropagation(),i(w?[]:void 0)},className:"cursor-pointer hover:bg-muted/20 rounded p-1",children:e(f,{className:"size-4"})}),!c&&e(x,{className:"size-4 opacity-50"})]})]})}),t(Mt,{style:{width:`${I}px`,zIndex:1e6},className:s("min-w-[8rem] w-64 bg-popover p-1 border shadow","divide-y divide-border",g),children:[u&&t("div",{className:"flex justify-start items-center mb-1",children:[e("div",{className:"mx-2",children:e(v,{className:"size-4"})}),e(zt,{variant:"unstyled",value:T,onChange:O,className:"w-full p-1 rounded-md",placeholder:"Search..."})]}),e(Pt,{className:"overflow-hidden",children:t($t,{className:"max-h-[200px] overflow-y-auto",children:[e(Ft,{children:"No result found."}),e(jt,{className:"overflow-visible",children:M?.map(((n,s)=>{const l=w?R(n,Array.isArray(a)?a:[]):null!=a&&S(a,n);return e(Bt,{onSelect:()=>(e=>{if(w){const t=Array.isArray(a)?a:[];if(R(e,t)){const n=t.filter((t=>!S(t,e)));i(n)}else i([...t,e])}else z(!1),i(e)})(n),className:"w-full",children:w?t("div",{className:"w-full flex justify-between items-center cursor-pointer",children:[e("div",{className:"w-full truncate text-left",children:r?r(n):n}),l&&e(d,{className:"size-4"})]}):t(Et,{className:"w-full flex justify-between items-center",children:[e("div",{className:"w-full truncate text-left",children:r?r(n):n}),l&&e(d,{className:"size-4"})]})},s)}))})]})}),l&&e("div",{className:"p-1",children:t("a",{onClick:l,className:s("gap-x-2 px-2 py-1.5 truncate group flex rounded-md items-center text-sm cursor-pointer hover:bg-accent"),children:[e(b,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),o]})})]})]})}Ut.displayName="CommandShortcut";const Gt=S.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1}),Ht=({tabs:t,defaultValue:n,current:r,className:s,fullWidth:a,children:i,onTabChange:l,responsive:o=!1})=>{const c="function"==typeof r?r():r||n,[d,u]=S.useState(c);S.useEffect((()=>{c&&u(c)}),[c]);const h=e=>{u(e),l&&l(e)},m=S.useCallback((e=>{h(e)}),[h]);return e(Gt.Provider,{value:{tabs:t,size:a?t.length:0,current:d,setTab:m,responsive:o},children:e(J.Root,{defaultValue:t[0]?.name,value:d,onValueChange:h,className:s,children:i})})},Yt=({className:r})=>{const{tabs:s,size:a,current:i,setTab:l,responsive:o}=S.useContext(Gt),c=0!==a,d=S.useCallback((e=>{if(!s||!l)return;const t=s.find((t=>t.name===e));t?.href&&window.history.pushState(null,"",t.href),l(e)}),[s,l]);return s&&l?t(n,{children:[o&&e("div",{className:"px-2 block lg:hidden",children:e(Wt,{label:"Tab",className:r,options:s,optionLabel:e=>"string"==typeof e.label?e.label:String(e.label),value:s.find((e=>e.name===i)),onChange:e=>{d(e.name)}})}),e(Zt,{size:a,className:we(c?"w-full":"",r,o?"hidden lg:flex":""),children:s.map((t=>e(qt,{value:t.name,disabled:t.disabled,href:t.href,onClick:()=>d(t.name),children:t.label},t.name)))})]}):(console.warn("TabsBar: No tabs provided or setTab not available"),null)},Kt=()=>{const{tabs:t}=S.useContext(Gt);return t?e(n,{children:t.map((t=>e(Xt,{value:t.name,children:t.content},t.name)))}):null},Zt=S.forwardRef((({className:t,size:n,...r},s)=>e(Gt.Provider,{value:{size:n},children:e(J.List,{ref:s,className:we("border-b -mb-px flex space-x-4",t),...r})})));Zt.displayName=J.List.displayName;const qt=S.forwardRef((({className:t,href:n,...r},s)=>{const{size:a}=S.useContext(Gt),i=S.useCallback((e=>{n&&(e.preventDefault(),window.history.pushState(null,"",n)),r.onClick&&r.onClick(e)}),[n,r.onClick]);return e(J.Trigger,{ref:s,className:we("border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer","border-transparent text-muted-foreground hover:border-border hover:text-foreground","data-[state=active]:border-primary data-[state=active]:text-primary","disabled:pointer-events-none disabled:opacity-50",t,a?`w-1/${a}`:""),onClick:i,...r})}));qt.displayName=J.Trigger.displayName;const Xt=S.forwardRef((({className:t,...n},r)=>e(J.Content,{ref:r,className:we("focus-visible:outline-none",t),...n})));Xt.displayName=J.Content.displayName;const Jt=Q.Provider,Qt=Q.Root,en=Q.Trigger,tn=S.forwardRef((({className:t,sideOffset:n=4,side:r="top",...s},a)=>e(Q.Portal,{children:e(Q.Content,{ref:a,sideOffset:n,side:r,style:{zIndex:100},className:we("max-w-[90vw]","z-50 overflow-hidden rounded-md bg-tooltips border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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",t),...s})})));function nn({description:n,children:r,size:s="sm",placement:a="top",className:i,asChild:l}){return e(Jt,{delayDuration:0,children:t(Qt,{children:[e(en,{className:"cursor-pointer",asChild:l,children:r}),e(tn,{side:a,className:`px-3 py-1.5 max-w-${s} text-${s} px-3 ${i}`,children:n})]})})}tn.displayName=Q.Content.displayName;const rn=r("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),sn=S.forwardRef((({className:n,required:r,...s},a)=>t(ee.Root,{ref:a,className:we(rn(),n),...s,children:[s.children,r&&e("span",{className:"text-destructive-foreground ml-1",children:"*"})]})));function an({children:n,maxItems:r=3,className:s,separator:a}){if(n.length<=r)return e(ln,{className:we("w-full",s),children:e(on,{children:n.map(((r,s)=>t(S.Fragment,{children:[e(cn,{children:r.href?e(dn,{href:r.href,children:r.label}):e(un,{children:r.label})}),s<n.length-1&&e(hn,{children:a??e(y,{})})]},s)))})});const i=n[0],l=n.slice(-(r-2));return e(ln,{className:we("w-full",s),children:t(on,{children:[e(cn,{children:i.href?e(dn,{href:i.href,children:i.label}):e(un,{children:i.label})}),e(hn,{children:a??e(y,{})}),e(cn,{children:e(mn,{})}),e(hn,{children:a??e(y,{})}),l.map(((n,r)=>t(S.Fragment,{children:[e(cn,{children:n.href?e(dn,{href:n.href,children:n.label}):e(un,{children:n.label})}),r<l.length-1&&e(hn,{children:a??e(y,{})})]},r)))]})})}sn.displayName=ee.Root.displayName;const ln=S.forwardRef((({...t},n)=>e("nav",{ref:n,"aria-label":"breadcrumb",...t})));ln.displayName="Breadcrumb";const on=S.forwardRef((({className:t,...n},r)=>e("ol",{ref:r,className:we("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...n})));on.displayName="BreadcrumbList";const cn=S.forwardRef((({className:t,...n},r)=>e("li",{ref:r,className:we("inline-flex items-center gap-1.5",t),...n})));cn.displayName="BreadcrumbItem";const dn=S.forwardRef((({asChild:t,className:n,...r},s)=>e("a",{ref:s,className:we("transition-colors hover:text-foreground",n),...r})));dn.displayName="BreadcrumbLink";const un=S.forwardRef((({className:t,...n},r)=>e("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:we("font-normal text-foreground",t),...n})));un.displayName="BreadcrumbPage";const hn=({children:t,className:n,...r})=>e("li",{role:"presentation","aria-hidden":"true",className:we("[&>svg]:w-3.5 [&>svg]:h-3.5",n),...r,children:t??e(y,{})});hn.displayName="BreadcrumbSeparator";const mn=({className:n,...r})=>t("span",{role:"presentation","aria-hidden":"true",className:we("flex h-9 w-9 items-center justify-center",n),...r,children:[e(N,{className:"h-4 w-4"}),e("span",{className:"sr-only",children:"More"})]});mn.displayName="BreadcrumbEllipsis";const pn=({children:t,className:n})=>{const r=D(null),[s,a]=A("auto");return $((()=>{if(r.current){const e=new ResizeObserver((e=>{const t=e[0].contentRect.height;a(t)}));return e.observe(r.current),()=>{e.disconnect()}}}),[]),e("div",{className:we(n,"overflow-hidden transition-all duration-100 ease-in"),style:{height:s},children:e("div",{ref:r,children:t})})};function fn({className:t,classNames:n,showOutsideDays:r=!0,size:s="md",...a}){const i={sm:"size-6",md:"size-8",lg:"size-10"}[s];return e(ne,{showOutsideDays:r,className:we("",t),classNames:{months:"flex w-full flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0 flex-1",month:"space-y-4 w-full flex flex-col",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:we(Ze({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full h-full border-collapse space-y-1",head_row:"",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"w-full mt-2",cell:we("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===a.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:we(Ze({variant:"ghost"}),i,"flex items-center justify-center","p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...n},components:{IconLeft:({className:t,...n})=>e(w,{className:we("h-4 w-4",t),...n}),IconRight:({className:t,...n})=>e(y,{className:we("h-4 w-4",t),...n})},...a})}fn.displayName="Calendar";const gn=S.forwardRef((({className:t,...n},r)=>e(re.Root,{ref:r,className:we("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...n,children:e(re.Indicator,{className:we("flex items-center justify-center text-current"),children:e(d,{className:"h-4 w-4"})})})));function xn({value:t,labelRenderer:r,fallbackLabel:s}){const[a,i]=A(s||t),[l,o]=A(!1);return $((()=>{if(!r)return void i(s||t);(async()=>{o(!0);try{const e=r(t);if(e instanceof Promise){const t=await e;i(t)}else i(e)}catch(e){console.error("Error rendering label:",e),i(s||t)}finally{o(!1)}})()}),[t,r,s]),l?e("span",{className:"text-muted-foreground",children:"Loading..."}):e(n,{children:a})}gn.displayName=re.Root.displayName;const vn=({filterType:r,filterValues:s,setFilterValues:a,options:i,labelRenderer:l})=>{const[o,c]=A(!1),[d,u]=A(""),h=D(null),m=i?.filter((e=>!s.some((t=>t.value===e.value))));return t(Tt,{_open:o,onOpenChange:e=>{c(e),e||setTimeout((()=>{u("")}),200)},children:[e(Rt,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 transition text-muted hover:text-primary shrink-0",children:e("div",{className:"flex gap-1.5 items-center",children:1===s?.length?(()=>{const t=s[0];return e(xn,{value:t.value||"",labelRenderer:l,fallbackLabel:t.label})})():`${s?.length} selected`})}),e(Mt,{className:"w-[300px] p-0",children:e(pn,{children:t(Pt,{children:[e(At,{placeholder:r,className:"h-9",value:d,onInputCapture:e=>{u(e.currentTarget.value)},ref:h}),t($t,{children:[e(Ft,{children:"No results found."}),e(jt,{children:s.map((n=>t(Bt,{className:"group flex gap-2 items-center",onSelect:()=>{a(s.filter((e=>e.value!==n.value))),setTimeout((()=>{u("")}),200),c(!1)},children:[e(gn,{checked:!0}),e(xn,{value:n.value||"",labelRenderer:l,fallbackLabel:n.label})]},n.value)))}),m?.length>0&&t(n,{children:[e(Vt,{}),e(jt,{children:m.filter((e=>String(e.label||e.value).toLowerCase().includes(d.toLowerCase()))).map((n=>t(Bt,{className:"group flex gap-2 items-center",value:String(n.label||n.value),onSelect:()=>{a([...s,{value:n.value,label:n.label}]),setTimeout((()=>{u("")}),200),c(!1)},children:[e(gn,{checked:!1,className:"opacity-0 group-data-[selected=true]:opacity-100"}),e("span",{className:"text-muted",children:e(xn,{value:n.value||"",labelRenderer:n.labelRenderer||l,fallbackLabel:n.label})})]},n.value)))})]})]})]})})})]})},bn=({filterValues:n,setFilterValues:r})=>{const[s,a]=A(!1),i=n[0]?new Date(n[0]):void 0;return t(Tt,{_open:s,onOpenChange:a,children:[e(Rt,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center",children:i?te(i).format("MMM D, YYYY"):e("span",{children:"Pick a date"})})}),e(Mt,{className:"w-auto p-0",align:"start",children:e(fn,{mode:"single",className:"p-0",defaultMonth:i,selected:i,onSelect:e=>{e&&(r([te(e).format("YYYY-MM-DD")]),a(!1))}})})]})},yn=({filterType:n,filterValue:r,setFilterValue:s})=>{const[a,i]=A(!1),[l,o]=A(r);return t(Tt,{_open:a,onOpenChange:e=>{i(e),e||l===r||o(r)},children:[e(Rt,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center",children:r||"Enter text..."})}),e(Mt,{className:"w-[300px] p-3",children:t("div",{className:"flex flex-col gap-1",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:n})}),e(zt,{autoFocus:!0,type:"text",size:"sm",value:l,onChange:o,onKeyDown:e=>{"Enter"===e.key&&(s(l),i(!1))},placeholder:"Enter text..."}),e(qe,{size:"sm",variant:"outline",onClick:()=>{s(l),i(!1)},children:"Apply"})]})})]})};function Nn(t,n,r){switch(t.type){case"date":return e(bn,{filterValues:t.value.map((e=>e.value||"")),setFilterValues:e=>{n((n=>n.map((n=>n===t?{...n,value:e.length>0?[{value:e[0],label:te(e[0]).format("LLL dd, y")}]:[]}:n))))}});case"text":return e(yn,{filterType:t.placeholder||t.name,filterValue:t.value[0]?.value||"",setFilterValue:e=>{n((n=>n.map((n=>n===t?{...n,value:[{value:e,label:e}]}:n))))}});default:{const s=r.find((e=>e.name===t.name));return e(vn,{filterType:t.placeholder||t.name,filterValues:t.value,setFilterValues:e=>{n((n=>n.map((n=>n===t?{...n,value:e}:n))))},options:s?.options||[],labelRenderer:s?.labelRenderer})}}}function wn({filters:n,setFilters:r,filterGroups:s}){return e("div",{className:"flex gap-2 flex-wrap justify-start",children:n.filter((e=>e.value?.length>0)).map((n=>t("div",{className:"flex gap-[1px] items-center text-sm",children:[e("div",{className:"flex gap-1.5 shrink-0 rounded-l bg-muted p-1.5 h-8 items-center",children:n.placeholder||n.name}),Nn(n,r,s),e(qe,{variant:"ghost",size:"icon",onClick:()=>{r((e=>e.filter((e=>e!==n))))},className:"bg-muted rounded-l-none rounded-r-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0",children:e(f,{className:"size-6"})})]},n.name+"-"+("date"==n.type?"date":n.value.map((e=>e.value)).join(",")))))})}function kn({selectedView:n,textValue:r,setTextValue:s,setFilters:a,handleClose:i,filterGroups:l}){const o=()=>{a((e=>[...e,{name:n||"",placeholder:l.find((e=>e.name===n))?.placeholder,value:[{value:r,label:r}],type:"text"}])),i()};return t("div",{className:"p-2 flex flex-col gap-1",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:l.find((e=>e.name===n))?.placeholder})}),e(zt,{autoFocus:!0,type:"text",size:"sm",value:r,onChange:s,onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"Enter text..."}),e(qe,{size:"sm",variant:"outline",onClick:o,disabled:!r.trim(),children:"Apply"})]})}function Cn({selectedView:t,selectedDate:n,setSelectedDate:r,setFilters:s,filters:a,handleClose:i,filterGroups:l}){return e("div",{className:"p-2",children:e(fn,{mode:"single",defaultMonth:n,selected:n,onSelect:e=>{if(r(e),e){const n=l.find((e=>e.name===t)),r=new Date(e);r.setHours(0,0,0,0),s([...a,{name:t||"",placeholder:n?.placeholder,value:[{value:r.toISOString(),label:te(r).format("LLL dd, y")}],type:n?.type||"date"}]),i()}},size:"sm"})})}function _n({selectedView:r,commandInput:s,setFilters:a,handleClose:i,filterGroups:l}){if(!r)return null;const o=(e=>{const t=l.find((t=>t.name===e));if(!t)return[];let n=t.options||[];if(!s.trim())return n;if(t.filterBy){const e=s.toLowerCase();return n.filter((n=>{if(void 0===n.value)return!1;return t.filterBy(n.value,e)}))}const r=s.toLowerCase();return n.filter((e=>String(e.value||"").toLowerCase().includes(r)))})(r);if(0===o.length)return e(Ft,{children:"No matching options"});const c=l.find((e=>e.name===r))?.placeholder||l.find((e=>e.name===r))?.name;return t(n,{children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:c})}),o.map((t=>{const n=l.find((e=>e.name===r));return e(Bt,{className:"group flex gap-2 items-center w-full hover:bg-muted",onSelect:()=>{a((e=>{const s=e.findIndex((e=>e.name===r)),a={value:t.value,label:t.label};if(s>=0){const t=[...e];return t[s]={...t[s],value:[...t[s].value,a]},t}return[...e,{name:r||"",placeholder:n?.placeholder||"",value:[a],type:n?.type||"select"}]})),i()},children:e(xn,{value:t.value||"",labelRenderer:t.labelRenderer||n?.labelRenderer,fallbackLabel:t.label})},t.value||`option-${Math.random()}`)}))]})}function zn({filters:n,setFilters:r,filterGroups:s}){const[a,i]=M.useState(!1),[l,o]=M.useState(null),[c,d]=M.useState(""),u=M.useRef(null),[h,m]=M.useState(),[p,f]=M.useState(""),g=()=>{i(!1),setTimeout((()=>{o(null),d(""),m(void 0)}),200)},x=new URL(window.location.href).searchParams;return $((()=>{try{const e=new URLSearchParams(x.toString());if(n.length>0){const t=n.map((e=>{const t=Array.isArray(e.value)?e.value.map((e=>encodeURIComponent(e.value||""))).join(","):encodeURIComponent(e.value||"");return`${encodeURIComponent(e.name)}:${t}`})).join(";");e.set("filters",t)}else e.delete("filters");const t=`${window.location.pathname}?${e.toString()}`;window.history.replaceState({},"",t)}catch(e){console.error("Failed to update URL with filters:",e)}}),[n]),$((()=>{const e=x.get("filters");if(e)try{const t=e.split(";").map((e=>{const[t,n]=e.split(":"),r=decodeURIComponent(t),a=n.split(",").map((e=>decodeURIComponent(e))),i=s.find((e=>e.name===r));console.log("group",i);const l=a.map((e=>{if("text"===i?.type)return{value:e,label:e};{const t=i?.options?.find((t=>t.value===e));let n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):i?.labelRenderer&&(n=String(i.labelRenderer(e))),{value:e,label:n}}}));return console.log("valuesWithLabels",l),{name:r,type:i?.type||"select",placeholder:i?.placeholder,value:l}}));r(t)}catch(e){console.error("Failed to parse filters from URL:",e)}}),[]),t("div",{className:"flex gap-2 flex-wrap justify-start w-full items-center",children:[e("div",{className:"flex gap-2 items-center",children:t(Tt,{_open:a,onOpenChange:e=>{i(e),e||setTimeout((()=>{o(null),d(""),f("")}),200)},children:[e(Rt,{asChild:!0,children:t(qe,{variant:"ghost",role:"combobox","aria-expanded":a,size:"md",className:we("transition group flex gap-1.5"),children:[e(k,{className:"size-4 shrink-0 transition-all text-muted"}),"Filter"]})}),e(Mt,{className:"w-[300px] p-0",align:"start",children:t(Pt,{children:["select"===s.find((e=>e.name===l))?.type?e(At,{placeholder:l?`Filter by ${l}`:"Filter...",className:"h-9 ring-0",value:c,onValueChange:e=>{d(e)},ref:u,autoFocus:!0}):null,e($t,{className:"max-h-[300px] overflow-y-auto",children:e(jt,{children:l?(()=>{if(!l)return null;const t=s.find((e=>e.name===l))?.type;switch(t){case"date":return e(Cn,{selectedView:l,selectedDate:h,setSelectedDate:m,setFilters:r,filters:n,handleClose:g,filterGroups:s});case"text":return e(kn,{selectedView:l,textValue:p,setTextValue:f,setFilters:r,handleClose:g,filterGroups:s});default:return e(_n,{selectedView:l,commandInput:c,setFilters:r,handleClose:g,filterGroups:s})}})():(()=>{let t=s.map((e=>({...e,options:(e.options??[]).filter((t=>!n.some((n=>"date"===n.type?n.name===e.name:n.name===e.name&&n.value.some((e=>e.value===t.value))))))}))).filter((e=>(e.options??[]).length>0||"date"===e.type&&!n.some((t=>t.name===e.name))||"text"===e.type&&!n.some((t=>t.name===e.name))));return 0===t.length?e(Ft,{children:"No available filters"}):t.map(((t,n)=>e(Bt,{onSelect:()=>{return e=t.name,o(e),d(""),void u.current?.focus();var e},className:"group flex gap-2 items-center hover:bg-muted",children:e("span",{children:t.placeholder??t.name})},n)))})()})})]})})]})}),e(wn,{filters:n,setFilters:r,filterGroups:s}),n.filter((e=>e.value?.length>0)).length>0&&e((()=>e("div",{className:"flex gap-2 items-center",children:e(qe,{variant:"outline",size:"xs",className:"transition group",onClick:()=>r([]),children:"Clear All"})})),{})]})}var In;!function(e){e.IS="is",e.IS_NOT="is_not",e.CONTAINS="contains",e.BEFORE="before",e.AFTER="after",e.IS_ANY_OF="is_any_of"}(In||(In={}));const Ln=F((({className:t,level:n=3,...r},s)=>e(`h${n}`,{ref:s,className:we({h1:"text-2xl font-medium tracking-tight",h2:"text-xl font-medium tracking-tight",h3:"text-lg font-medium",h4:"text-base font-medium",h5:"text-sm font-medium",h6:"text-xs font-medium"}[`h${n}`],"mb-2",t),...r})));Ln.displayName="Heading";const Tn=r("text-foreground",{variants:{size:{xl:"text-base md:text-lg leading-relaxed",lg:"text-base leading-relaxed",default:"text-sm leading-normal",sm:"text-sm leading-normal",xs:"text-xs leading-normal"},weight:{normal:"font-normal",medium:"font-medium",semibold:"font-semibold"}},defaultVariants:{size:"default",weight:"normal"}}),On=F((({className:t,size:n,weight:r,...s},a)=>e("p",{ref:a,className:we(Tn({size:n,weight:r,className:t})),...s})));function Rn({title:n,content:r,onConfirm:s,onCancel:a,isOpen:i}){const l=D(null);return t(mt,{isOpen:i,onClose:a,description:"Confirm Modal",children:[t("div",{className:"sm:flex sm:items-start p-2",children:[e("div",{className:"mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10",children:e(C,{className:"size-6 text-red-600","aria-hidden":"true"})}),t("div",{className:"mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left",children:[e(pt,{className:"leading-6",show:!0,children:n}),e("div",{className:"mt-2",children:e("div",{className:"prose text-sm text-gray-500",children:r})})]})]}),t(gt,{align:"right",children:[e(qe,{variant:"destructive",onClick:s,children:"Confirm"}),e(qe,{variant:"outline",onClick:a,ref:l,children:"Cancel"})]})]})}function Sn(){return P(Mn)}On.displayName="Text";const Mn=E((()=>{})),En="--tailwind-portal";function Pn({children:t}){const n=D(null),[r,s]=A(null);return $((()=>{if(n.current){const e=n.current.ownerDocument;let t=e.getElementById(En);t||(t=e.createElement("DIV"),t.id=En,e.body.appendChild(t)),s(t)}}),[n.current]),r?W(t,r):e("span",{ref:n})}const Dn={success:L,error:I,warning:z,info:_},An={success:"text-green-600",error:"text-red-600",warning:"text-yellow-600",info:"text-blue-600"};function $n({data:n,onClose:r}){const[s,a]=A(!0);$((()=>{let e;return n.duration&&(e=setTimeout((()=>{a(!1)}),n.duration)),()=>{e&&clearTimeout(e)}}),[]);const i=Dn[n.status]||_,l=An[n.status]||"text-blue-600";return e("div",{"aria-live":"assertive",className:"pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-100",children:e("div",{className:"flex w-full flex-col items-center space-y-4 sm:items-end",children:e(se,{appear:!0,show:s,as:j,afterLeave:r,enter:"transform ease-out duration-700 transition",enterFrom:"translate-y-0 opacity-0 sm:translate-y-0 sm:translate-x-2",enterTo:"translate-y-2 opacity-100 sm:translate-x-0",leave:"transition ease-in duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e("div",{className:"pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5",children:e("div",{className:"p-4",children:t("div",{className:"flex items-start",children:[e("div",{className:"shrink-0",children:e(i,{className:`size-6 ${l}`,"aria-hidden":"true"})}),t("div",{className:"ml-3 w-0 flex-1 pt-0.5",children:[e("p",{className:"text-sm font-medium text-gray-900",children:n.title}),e("p",{className:"mt-1 text-sm text-gray-500",children:n.description})]}),e("div",{className:"ml-4 flex shrink-0",children:t("button",{type:"button",className:"inline-flex rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-hidden focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",onClick:()=>a(!1),children:[e("span",{className:"sr-only",children:"Close"}),e(f,{className:"size-5","aria-hidden":"true"})]})})]})})})})})})}function Fn({children:r}){const[s,a]=A(null),i=e=>{a(e)};return t(n,{children:[e(Mn.Provider,{value:i,children:r}),s&&e(Pn,{children:e($n,{data:s,onClose:()=>i(null)})})]})}function jn({idToDelete:t,title:n,content:r,setIdToDelete:s,deleteApi:a}){const i=Sn();return e(Rn,{title:n,content:r,isOpen:!!t,onConfirm:async()=>{if(t)return a(t).then((()=>{i({title:"Delete succeeded",status:"success"})})).catch((e=>{i({title:"Failed to delete",description:e.message??"An error occurred while deleting the object",status:"error"})})).finally((()=>{s(void 0)}))},onCancel:()=>{s(void 0)}})}function Vn({className:t}){return e("hr",{className:s("w-full h-0.5 border-t-0 bg-border",t)})}function Bn({trigger:n,children:r}){return t(ae,{as:"div",className:"relative",children:[e(ie,{as:"span",className:"-m-1.5 flex items-center p-1.5",children:n}),e(se,{as:j,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:e(le,{className:"absolute right-0 z-10 mt-2.5 w-48 origin-top-right rounded-md bg-white dark:bg-slate-900 dark:border-slate-800 dark:border py-2 shadow-lg ring-1 ring-gray-900/5 dark:ring-slate-200/5 focus:outline-hidden",children:r})})]})}function Un({children:t,href:n="#",onClick:r,closeOnClick:a=!0,isDisabled:i=!1}){return e(oe,{disabled:i,children:({active:l,close:o})=>e("a",{href:n,onClick:e=>{e.preventDefault(),e.stopPropagation(),r&&r(e),a&&o()},className:s(l?"bg-gray-50 dark:bg-slate-800":"",i?"opacity-50 cursor-not-allowed":"","block px-3 py-1 text-sm leading-6 text-gray-900 dark:text-gray-200"),children:t})})}function Wn({items:n,value:r,onChange:a}){return e(ce,{value:r,onChange:a,children:({open:a})=>t("div",{className:"relative",children:[t("div",{className:"inline-flex divide-x divide-indigo-700 rounded-md shadow-2xs",children:[t("div",{className:"inline-flex items-center gap-x-1.5 rounded-l-md bg-indigo-600 px-3 py-2 text-white shadow-2xs",children:[r.name&&e(d,{className:"-ml-0.5 size-5","aria-hidden":"true"}),e("p",{className:"text-sm font-semibold",children:r.name||""})]}),t(de,{className:"inline-flex items-center rounded-l-none rounded-r-md bg-indigo-600 p-2 hover:bg-indigo-700 focus:outline-hidden focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2 focus:ring-offset-gray-50",children:[e("span",{className:"sr-only",children:"Change selection"}),e(T,{className:"size-5 text-white","aria-hidden":"true"})]})]}),e(se,{show:a,as:j,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e(ue,{className:"absolute right-0 z-10 mt-2 w-72 origin-top-right divide-y divide-gray-200 overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden",children:n.map((n=>e(he,{className:({active:e})=>s(e?"bg-indigo-600 text-white":"text-gray-900","cursor-default select-none p-4 text-sm"),value:n,children:({selected:r,active:a})=>t("div",{className:"flex flex-col",children:[t("div",{className:"flex justify-between",children:[e("p",{className:r?"font-semibold":"font-normal",children:n.name}),r?e("span",{className:a?"text-white":"text-indigo-600",children:e(d,{className:"size-5","aria-hidden":"true"})}):null]}),e("p",{className:s(a?"text-indigo-200":"text-gray-500","mt-2"),children:n.description})]})},n.id)))})})]})})}function Gn({size:r,className:a}){const i=function(e){switch(e){case"xs":return"size-2";case"sm":return"size-3";case"md":return"size-4";case"lg":return"size-5";case"xl":return"size-7";case"2xl":return"size-10";default:throw new Error("Unexpected size: "+e)}}(r||"md");return e(n,{children:t("svg",{className:s("animate-[spin_0.8s_linear_infinite] text-indigo-500",i,a),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})}const Hn={primary:"shadow-2xs bg-indigo-600 text-white hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600",secondary:"shadow-2xs bg-white text-gray-900 hover:bg-gray-50 ring-1 ring-inset ring-gray-300",soft:"shadow-2xs bg-indigo-50 text-indigo-600 hover:bg-indigo-100",ghost:"text-indigo-600 hover:bg-indigo-100 dark:text-indigo-400 dark:hover:bg-indigo-900",unstyled:""},Yn={primary:"text-white",secondary:"text-indigo-500",soft:"text-indigo-600",ghost:"text-indigo-600",unstyled:"text-gray-600"};function Kn({title:n,className:r,type:a="button",children:i,size:l,onClick:o,variant:c="primary",isLoading:d=!1,isDisabled:u=!1}){const h=function(e){switch(e){case"xs":return"rounded-xs px-2 py-1 text-xs gap-x-1";case"sm":return"rounded-xs px-2 py-1 text-sm gap-x-1";case"md":return"rounded-md px-2.5 py-1.5 text-sm gap-x-1.5";case"lg":return"rounded-md px-3 py-2 text-sm gap-x-1.5";case"xl":return"rounded-md px-3.5 py-2.5 text-sm gap-x-2";default:throw new Error("Unexpected size: "+e)}}(l||"md");return t("button",{title:n,disabled:u||d,onClick:o,type:a,className:s("whitespace-nowrap inline-flex items-center justify-center font-semibold hover:cursor-pointer",Hn[c],h,u&&"cursor-not-allowed text-gray-300!",r),children:[d&&e(Gn,{className:Yn[c],size:l}),i]})}function Zn({buttonLabel:n,title:r,children:s,onClick:a}){return t("div",{className:"text-center py-12",children:[e("svg",{className:"mx-auto h-12 w-12 text-gray-400 dark:text-gray-200",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:e("path",{vectorEffect:"non-scaling-stroke",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"})}),e("h3",{className:"mt-2 text-sm font-semibold text-gray-500",children:r}),e("p",{className:"mt-1 text-sm text-gray-500",children:s}),e("div",{className:"mt-6",children:t(Kn,{onClick:a,size:"lg",children:[e(O,{className:"-ml-0.5 mr-1.5 size-5","aria-hidden":"true"}),n]})})]})}function qn({children:n,onUpload:r}){const s=D(null);return t("label",{style:{cursor:"pointer"},children:[n,e("input",{ref:s,type:"file",style:{display:"none"},onChange:()=>{s.current?.files&&r(function(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}(s.current.files))}})]})}function Xn({onUpload:n}){const r=Jn({onUpload:n});return e("div",{...r,className:"flex items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600",children:t("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-full",children:[t("div",{className:"flex flex-col items-center justify-center pt-5 pb-6",children:[e("svg",{className:"w-8 h-8 mb-4 text-gray-500 dark:text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16",children:e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})}),t("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[e("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),e("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),e("input",{id:"dropzone-file",type:"file",className:"hidden"})]})})}function Jn({onUpload:e,dragOverClass:t="is-drag-over-on",dropEffect:n="copy"}){const r=D(null);return{onDrop:n=>{n.preventDefault(),delete r.current.__dragOver_cnt__,r.current?.classList.remove(t);const s=n.dataTransfer.items;if(s){const t=[],n=(e,t="")=>new Promise((r=>{if(e.isFile)e.file((e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])}));else if(e.isDirectory){const s=e.createReader(),a=[],i=()=>{s.readEntries((s=>{if(s.length){for(const r of s)a.push(n(r,t+e.name+"/"));i()}else Promise.all(a).then((e=>r(e.flat())))}))};i()}}));for(let e=0;e<s.length;e++){const r=s[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then((t=>{const n=t.flat();n.length&&e(n)}))}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{(function(e){let t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t})(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{(function(e){let t=e.__dragOver_cnt__;return!!t&&(e.__dragOver_cnt__=t-1,1===t)})(r.current)&&r.current?.classList.remove(t)},ref:r}}function Qn({description:n,required:r,label:a,className:i,direction:l="column",children:o}){return t("div",{className:s("flex w-full space-y-1",i,"row"===l?"flex-row justify-between":"flex-col"),children:[t("div",{className:"flex items-center gap-1",children:[t("label",{className:"text-sm font-medium mb-1",children:[a,r?e("span",{className:"text-destructive -mt-4 ml-1",children:"*"}):""]}),n&&e("div",{className:"mx-2 flex w-4 items-center",children:e(nn,{description:n,children:e(_,{className:"size-3 text-muted"})})})]}),o]})}const er="rounded-md text-sm flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",tr={INPUT_UNSTYLED:"block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent",INPUT_NO_PADDING:er,INPUT:er+" py-1.5"};function nr({value:n=[],onChange:r,className:a,delimiters:i=", ",placeholder:l}){const[o,c]=A("");return t("div",{className:s(a,"w-full space-x-1 space-y-1 p-2",tr.INPUT),children:[n&&n.length>0&&n.map(((t,s)=>e(Ce,{variant:"secondary",onClick:()=>(e=>{n&&n.length>0&&(n.splice(e,1),r([...n]))})(s),style:{whiteSpace:"nowrap"},className:"cursor-pointer",children:t},s))),e("div",{children:e(zt,{clearable:!1,className:"placeholder:text-muted-foreground px-1",variant:"unstyled",type:"text",value:o,onBlur:e=>{const t=e.target.value;t&&t.trim()&&(r([...n,t.trim()]),c(""))},onKeyDown:e=>{const t=e.target.value,s=!t.trim(),a=e.key;"Enter"===a||i.indexOf(a)>-1?(e.preventDefault(),n&&!s&&(r([...n,t.trim()]),c(""))):"Backspace"===a&&s&&n&&n.length>0&&(n.pop(),r([...n]))},onChange:c,placeholder:n&&0!==n.length?"":l})})]})}function rr({underline:t="always",className:n,children:r,...a}){let i;return"always"===t?i="underline":"hover"===t&&(i="hover:underline"),e("a",{className:s("text-indigo-800 dark:text-indigo-300",n,i),...a,children:r})}function sr({className:t,children:n}){return e("ul",{className:`${t} space-y-1 flex flex-col items-start dark:px-2`,children:n})}const ar=F((function(t,n){const{current:r,children:a,className:i,href:l="#",onClick:o,...c}=t;return e("li",{className:s(i,r?"bg-gray-50 text-indigo-600":"text-gray-700 dark:dark:text-slate-300 hover:text-indigo-600 hover:bg-gray-50 dark:hover:bg-slate-800 dark:hover:text-slate-50 dark:border dark:border-transparent dark:hover:border-slate-50","w-full rounded-md p-2 pl-3 text-sm leading-6 font-semibold"),children:e("a",{ref:n,href:l,onClick:e=>{o?(e.preventDefault(),o(e)):"#"===l&&e.preventDefault()},className:"w-full flex items-center gap-x-3",...c,children:a})})}));function ir({icon:n,status:r,title:s,children:a,className:i}){let l,o,c,d;switch(r){case"error":l=e(I,{className:"size-5 text-destructive","aria-hidden":"true"}),o="",c="text-foreground",d="bg-destructive border border-destructive";break;case"warning":l=e(z,{className:"size-5 text-attention","aria-hidden":"true"}),o="",c="text-foreground",d="bg-attention border border-attention";break;case"success":l=e(L,{className:"size-5 text-success","aria-hidden":"true"}),o="",c="text-foreground",d="bg-success border border-success";break;case"info":l=e(_,{className:"size-5 text-info","aria-hidden":"true"}),o="",c="text-foreground",d="bg-info border border-info";break;case"default":l=e(_,{className:"size-5 text-muted","aria-hidden":"true"}),o="",c="text-foreground",d="bg-muted border border-muted";break;case"done":l=e(_,{className:"size-5 text-done","aria-hidden":"true"}),o="",c="text-foreground",d="bg-done border border-done"}return e("div",{className:`rounded-md p-4 ${d} ${i}`,children:t("div",{className:"flex",children:[e("div",{className:"shrink-0",children:n??l}),t("div",{className:"w-full ml-2 px-1",children:[s&&e("h3",{className:`text-sm font-medium mb-2 ${o}`,children:s}),e("div",{className:`text-sm ${c} break-words`,children:a})]})]})})}function lr({title:t,className:n,children:r}){return e(ir,{status:"error",title:t,className:n,children:e("pre",{children:r})})}function or({title:t,className:n,children:r}){return e(ir,{status:"info",title:t,className:n,children:r})}function cr({title:t,className:n,children:r}){return e(ir,{status:"warning",title:t,className:n,children:r})}function dr({title:t,className:n,children:r}){return e(ir,{status:"success",title:t,className:n,children:r})}function ur({title:t,className:n,children:r}){return e(ir,{status:"default",title:t,className:n,children:r})}function hr({className:n,children:r,isOpen:a,onClose:i,noCloseButton:l=!1,allowOverflow:o=!1,disableCloseOnClickOutside:c=!1}){return e(se,{show:a,as:j,children:t(me,{style:{zIndex:50},as:"div",className:"relative",onClose:c?()=>{}:e=>{e||i()},children:[e(pe,{as:j,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",unmount:!0,children:e("div",{className:"fixed inset-0 bg-gray-500 dark:bg-slate-800 dark:opacity-75 opacity-75 transition-opacity"})}),e("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:e("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:e(pe,{as:j,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:t(fe,{className:s("p-0! relative transform rounded-lg bg-white dark:bg-slate-900 text-left dark:text-slate-100 shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-md sm:p-6",o?"overflow-visible":"overflow-hidden",n),children:[!l&&e(mr,{onClose:i}),r]})})})})]})})}function mr({onClose:n}){return e("div",{className:"absolute right-0 top-0 hidden pr-4 pt-4 sm:block",children:t("button",{tabIndex:-1,type:"button",className:"rounded-md bg-white text-gray-400 dark:text-slate-200 dark:bg-slate-800 hover:brightness-95 focus:outline-hidden focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 hover:cursor-pointer",onClick:n,children:[e("span",{className:"sr-only",children:"Close"}),e(f,{className:"size-6","aria-hidden":"true"})]})})}function pr({children:t,showDivider:n=!1}){return e("div",{className:n?"border-b-solid border-b border-b-1":"",children:e(ge,{as:"h3",className:"py-4 pl-4 pr-8 text-base font-semibold leading-6 text-gray-900 dark:text-slate-50",children:t})})}function fr({children:t,className:n="justify-end",fill:r=!1}){return e("div",{className:s("w-full flex space-x-2 p-4 border-t-solid border-t-gray-100 dark:border-t-gray-800 border-t",n||"justify-end",r?"bg-gray-100 dark:bg-slate-800":""),children:t})}function gr({children:t,className:n=""}){return e("div",{className:s("p-4",n),children:t})}function xr(e){return null==e||isNaN(e)?"":e.toString()}sr.Item=ar;const vr=M.forwardRef((({value:t,onChange:n,className:r,noScroll:a=!1,noSpinners:i=!1,...l},o)=>{const[c,d]=M.useState(xr(t));return $((()=>{if(null==t||!isNaN(t)){const e=xr(t);d(e)}}),[t]),e("input",{onWheel:a?e=>{e.target.blur()}:l.onWheel,type:"number",value:c,onChange:e=>{const t=e.target.value;if(d(t),""===t)n&&n(void 0,t);else{const e=parseFloat(t);n&&n(e,t)}},className:s(r,tr.INPUT,{"no-spinners":i},i&&"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"),ref:o,...l})}));class br{renderOption(e){return this.labelOf(e)}findById(e,t){return e.find((e=>this.idOf(e)===t))}}function yr({checkColor:t,cols:n="grid-cols-1",gap:r="gap-2",value:a,onChange:i,options:l,checkIcon:o=wr,adapter:c}){const[d,u]=A(a),h=e=>{u(e),i(e)},m=d?c.idOf(d):void 0;return e("div",{className:s("grid",n,r),children:l.map((n=>{const r=c.idOf(n);return e(Nr,{checkColor:t,isSelected:r===m,option:n,adapter:c,onSelect:h,CheckIcon:o},r)}))})}function Nr({checkColor:n,CheckIcon:r,adapter:s,isSelected:a,option:i,onSelect:l}){const[o,c]=A(!1);return t("div",{className:"flex gap-1 cursor-pointer items-center",onClick:()=>l(i),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[e("div",{className:"",children:e(r,{size:24,isChecked:a,isHighlighted:o,color:n})}),e("div",{children:s.renderOption(i)})]})}function wr({size:t,isChecked:n,isHighlighted:r,color:s="currentColor"}){const a=r?1:.6;return e("svg",n?{width:`${t}px`,height:`${t}px`,viewBox:"0 0 24 24",version:"1.1",children:e("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:e("g",{id:"ic_fluent_checkbox_checked_24_regular",fill:s,fillRule:"nonzero",opacity:a,children:e("path",{d:"M18.25,3 C19.7687831,3 21,4.23121694 21,5.75 L21,18.25 C21,19.7687831 19.7687831,21 18.25,21 L5.75,21 C4.23121694,21 3,19.7687831 3,18.25 L3,5.75 C3,4.23121694 4.23121694,3 5.75,3 L18.25,3 Z M18.25,4.5 L5.75,4.5 C5.05964406,4.5 4.5,5.05964406 4.5,5.75 L4.5,18.25 C4.5,18.9403559 5.05964406,19.5 5.75,19.5 L18.25,19.5 C18.9403559,19.5 19.5,18.9403559 19.5,18.25 L19.5,5.75 C19.5,5.05964406 18.9403559,4.5 18.25,4.5 Z M10,14.4393398 L16.4696699,7.96966991 C16.7625631,7.6767767 17.2374369,7.6767767 17.5303301,7.96966991 C17.7965966,8.23593648 17.8208027,8.65260016 17.6029482,8.94621165 L17.5303301,9.03033009 L10.5303301,16.0303301 C10.2640635,16.2965966 9.84739984,16.3208027 9.55378835,16.1029482 L9.46966991,16.0303301 L6.46966991,13.0303301 C6.1767767,12.7374369 6.1767767,12.2625631 6.46966991,11.9696699 C6.73593648,11.7034034 7.15260016,11.6791973 7.44621165,11.8970518 L7.53033009,11.9696699 L10,14.4393398 L16.4696699,7.96966991 L10,14.4393398 Z"})})})}:{width:`${t}px`,height:`${t}px`,viewBox:"0 0 24 24",version:"1.1",children:e("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:e("g",{id:"ic_fluent_checkbox_unchecked_24_regular",fill:s,fillRule:"nonzero",opacity:a,children:e("path",{d:"M5.75,3 L18.25,3 C19.7687831,3 21,4.23121694 21,5.75 L21,18.25 C21,19.7687831 19.7687831,21 18.25,21 L5.75,21 C4.23121694,21 3,19.7687831 3,18.25 L3,5.75 C3,4.23121694 4.23121694,3 5.75,3 Z M5.75,4.5 C5.05964406,4.5 4.5,5.05964406 4.5,5.75 L4.5,18.25 C4.5,18.9403559 5.05964406,19.5 5.75,19.5 L18.25,19.5 C18.9403559,19.5 19.5,18.9403559 19.5,18.25 L19.5,5.75 C19.5,5.05964406 18.9403559,4.5 18.25,4.5 L5.75,4.5 Z"})})})})}function kr({clearTitle:n,ClearIcon:r=f,showFilter:s,filterBy:a,isClearable:i,disabled:l,by:o,options:c,value:d,onChange:u,className:h,addNew:m,addNewLabel:p,placeholder:g,optionLabel:x=e=>String(e),label:v}){const[b,y]=A(),N=D(null),[w,k]=A();$((()=>{if(N.current){const e=new ResizeObserver((e=>{k(e[0].contentRect.width)}));return e.observe(N.current),()=>e.disconnect()}}),[]);const C=e=>{e.preventDefault(),e.stopPropagation(),i&&u(void 0)},_=e=>{y(e.target.value)};let z=c||[];if(void 0===s&&(s=z?.length>=10),s&&b){const e=b.toLowerCase(),t=function(e){return e?"string"==typeof e?t=>String(t[e]).toLowerCase():e:e=>String(e).toLowerCase()}(a);z=z.filter((n=>t(n).includes(e)))}const I=e=>{"Escape"!==e.key&&"Enter"!==e.key&&"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&e.stopPropagation()};return e(ce,{value:d||null,onChange:u,by:o,disabled:l,children:()=>e("div",{className:"overflow-y-visible "+h,children:t("div",{className:"relative",children:[t(de,{ref:N,className:"relative w-full cursor-default rounded-md bg-white py-1.5 text-left text-gray-900 shadow-2xs ring-1 ring-inset ring-gray-300 focus:outline-hidden focus:ring-2 focus:ring-indigo-600 dark:ring-slate-600 dark:text-slate-50 dark:bg-slate-800 sm:text-sm sm:leading-6 hover:cursor-pointer",children:[v&&e("div",{className:"w-full text-gray-500 text-left px-2",children:v}),e("span",{className:"block truncate pl-3 pr-14",children:d?x(d):g}),i&&null!=d&&e("span",{className:"absolute inset-y-0 right-0 mr-5 flex items-center pr-2",onClick:C,children:e(r,{title:n,className:"size-5 text-gray-400 hover:text-red-500 cursor-pointer","aria-hidden":"true"})}),!l&&e("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:e(R,{className:"size-5 text-gray-400","aria-hidden":"true"})})]}),t(ue,{anchor:"bottom",style:{width:w,zIndex:1e8},className:"absolute z-10 mt-1 overflow-auto rounded-md bg-white dark:ring-slate-600 dark:text-slate-50 dark:bg-slate-800 py-1 text-base shadow-lg ring-1 ring-gray-300 ring-opacity-5 focus:outline-hidden sm:text-sm",children:[s&&e("div",{className:"p-1",children:e("input",{type:"text",value:b||"",onKeyDown:I,onChange:_,className:"w-full p-1 border border-gray-300 rounded-md dark:bg-slate-700 dark:text-slate-50",placeholder:"Filter..."})}),e("div",{className:"overflow-y-auto max-h-60",children:z.map(((t,n)=>e(Cr,{option:t,optionLabel:x,className:"hover:cursor-pointer"},n)))}),m&&e(Le,{className:"font-semibold py-2 border-t",children:e(Kn,{variant:"secondary",onClick:m,children:p})})]})]})})})}function Cr({option:r,optionLabel:a,onClick:i,className:l}){return e(he,{className:({active:e})=>s(e?"bg-indigo-600 text-white dark:bg-indigo-800 dark:text-white":"text-gray-900 dark:text-slate-50","relative cursor-default select-none py-2 pl-3 pr-9",l),value:r,onClick:i,children:({selected:i,active:l})=>t(n,{children:[e("div",{className:s(i?"font-semibold":"font-inherit","block truncate"),children:a(r)}),i?e("div",{className:s(l?"text-white":"text-indigo-600","absolute inset-y-0 right-0 flex items-center pr-4"),children:e(d,{className:"size-5","aria-hidden":"true"})}):null]})})}function _r(t,n){return{label:String(t),check:e(n?d:"div",{className:"size-4"}),reverse:!1,className:"flex-1 px-2 py-2 hover:bg-accent nowrap"}}function zr({value:t,options:n,onChange:r,className:a,optionLayout:i,by:l,noCheck:o}){const[c,d]=A(t),u=e=>{d(e),r(e)},h=V((()=>"string"==typeof l?(e,t)=>e[l]===t[l]:l||((e,t)=>e===t)),[l]);return e("div",{className:s("",a),children:n.map(((t,n)=>{const r=!!c&&h(c,t);let s;return i?(s=i(t,r),s=Object.assign(_r(t,r),s)):s=_r(t,r),e(Ir,{option:t,onSelect:u,layout:s,noCheck:o},n)}))})}function Ir({option:n,onSelect:r,layout:a,noCheck:i}){return t("div",{className:s("group flex items-center cursor-pointer gap-x-2 hover:bg-muted",a.reverse&&"flex-row-reverse",a.className),onClick:()=>r(n),children:[i?null:e("div",{className:"",children:a.check}),e("div",{className:"flex-1",children:a.label})]})}function Lr({onSelect:r,selected:a,options:i}){return t(xe,{value:a,onChange:r,children:[e(xe.Label,{className:"sr-only",children:"Server size"}),e("div",{className:"space-y-4",children:i.map((r=>e(xe.Option,{value:r,className:({active:e})=>s(e?"border-border ring-2 ring-ring":"border-border","relative block cursor-pointer rounded-lg border bg-accent px-6 py-4 shadow-2xs focus:outline-hidden sm:flex sm:justify-between"),children:({active:a,checked:i})=>t(n,{children:[e("span",{className:"flex items-center",children:t("span",{className:"flex flex-col text-sm",children:[e(xe.Label,{as:"span",className:"font-medium text-text",children:r.label}),r.description&&e(xe.Description,{as:"span",className:"text-muted-foreground",children:r.description})]})}),e("span",{className:s(a?"border":"border-2",i?"border-accent-foreground":"border-transparent","pointer-events-none absolute -inset-px rounded-lg"),"aria-hidden":"true"})]})},r.id)))})]})}function Tr({isOpen:n,title:r,onClose:s,children:a}){const[i,l]=A(768);return e(se,{show:n,as:j,children:t(me,{as:"div",className:"relative z-10",onClose:s,children:[e("div",{className:"fixed inset-0"}),e("div",{className:"fixed inset-0 overflow-hidden",children:e("div",{className:"absolute inset-0 overflow-hidden",children:e("div",{className:"pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10 sm:pl-16",children:e(pe,{as:j,enter:"transform transition ease-in-out duration-500 sm:duration-700",enterFrom:"translate-x-full",enterTo:"translate-x-0",leave:"transform transition ease-in-out duration-500 sm:duration-700",leaveFrom:"translate-x-0",leaveTo:"translate-x-full",unmount:!0,children:e(fe,{className:"pointer-events-auto border-l",style:{width:`${i}px`},children:t("div",{className:"relative flex h-full",children:[e("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-indigo-500 transition-colors",onMouseDown:e=>{e.preventDefault();let t=!0;const n=e.pageX,r=i,s=e=>{if(t){const t=n-e.pageX,s=Math.max(r+t,480);l(s)}},a=()=>{t=!1,document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",a)}}),t("div",{className:"flex-1 flex flex-col overflow-y-scroll gap-4 bg-background py-6 shadow-xl",children:[e("div",{className:"px-4 sm:px-6",children:t("div",{className:"flex items-start justify-between",children:[e(ge,{className:"w-full text-base font-semibold leading-6",children:e("div",{className:"text-2xl",children:r??""})}),e("div",{className:"ml-3 flex h-7 items-center",children:e(Or,{onClose:s})})]})}),e("div",{className:"px-4 sm:px-6",children:a})]})]})})})})})})]})})}function Or({onClose:t}){return e(qe,{alt:"Close panel",variant:"ghost",onClick:t,children:e(f,{className:"size-6","aria-hidden":"true"})})}const Rr={sm:["h-5 w-8","size-3","translate-x-4"],md:["h-6 w-11","size-4","translate-x-6"],lg:["h-8 w-16","size-6","translate-x-9"]};function Sr({value:n,onChange:r,size:s="md",children:a,className:i}){const l=Rr[s];return t(ve,{checked:n,onChange:()=>r(!n),className:`flex items-center ${i} hover:cursor-pointer`,children:[e("div",{className:`${n?"bg-primary":"bg-muted"} relative inline-flex ${l[0]} items-center rounded-full`,children:e("span",{className:`${n?l[2]:"translate-x-1"} inline-block ${l[1]} transform rounded-full bg-white transition`})}),a&&e("span",{className:"px-2",children:a})]})}function Mr({className:t,children:n,...r}){return e("table",{className:s("\ndivide-y divide-border\n[&>tbody]:divide-y [&>tbody]:divide-border\n[&_th]:text-left [&_th]:px-3 [&_th]:py-3.5 [&_th]:text-sm [&_th]:font-normal [&_th]:text-muted-foreground\n[&_td]:px-3 [&_td]:py-4 [&_td]:text-sm\n",t),...r,children:n})}function Er({columns:t}){return e("tr",{className:"hover:bg-muted",children:Array(t).fill(0).map(((t,n)=>e("td",{children:e("div",{className:"animate-pulse rounded-xs h-5 bg-gray-200 dark:bg-gray-600"})},n)))})}function Pr({isLoading:t=!1,columns:n,rows:r=3,children:s}){return e("tbody",{children:t?Array(r).fill(0).map(((t,r)=>e(Er,{columns:n},r))):s})}function Dr({className:t,children:n,...r}){return e("tr",{className:s("hover:bg-muted hover:cursor-pointer",t),...r,children:n})}function Ar(){return P($r)}const $r=E({});function Fr(e,t){const n="function"==typeof t?t():t;let r=null;const s=[];for(const t of e){const e={...t};e.current=!1,s.push(e),e.name===n&&(r=e)}return r||(r=s[0]),r.current=!0,s}function jr({current:t,onSelect:n,tabs:r,children:s,navigate:a}){const[i,l]=A([]);$((()=>{l(Fr(r,t))}),[t,r]);const o={tabs:i,select:e=>{n&&!1===n(e)||(e.href?a?a(e.href):window.location.href=e.href:l([...Fr(i,e.name)]))}};return e($r.Provider,{value:o,children:e("div",{className:"flex flex-col h-full",children:s})})}function Vr({actions:n,className:r}){const{tabs:a,select:i}=Ar();return t("div",{className:"border-b flex items-start justify-between",children:[e("nav",{className:"flex space-x-4 px-4","aria-label":"Tabs",children:a.map((t=>{const n=t.disabled?"cursor-not-allowed":"cursor-pointer";return e("a",{href:t.href||"#"+t.name,onClick:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),!t.disabled&&i(t)})(e,t),className:s(t.current?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-50":"border-transparent text-gray-500 dark:text-slate-300 hover:border-slate-400 hover:text-gray-700 dark:hover:border-slate-200 dark:hover:text-gray-200 ",r,"whitespace-nowrap border-b-2 py-2 px-1 text-sm font-medium",n),"aria-current":t.current?"page":void 0,children:t.label},t.name)}))}),e("div",{className:"flex gap-x-1",children:n})]})}function Br({}){const{tabs:t}=Ar(),n=t.find((e=>e.current))?.content;if(!n)return null;if(B(n))return e("div",{className:"h-full overflow-y-auto flex-1",children:n});return e("div",{className:"h-full overflow-y-auto flex-1",children:e(n,{})})}const Ur=M.forwardRef((({unstyled:t,value:n,onChange:r,className:a,...i},l)=>{const[o,c]=A(n||"");return e("textarea",{ref:l,...i,className:s("w-full",t?tr.INPUT_UNSTYLED:tr.INPUT,a),value:o,onChange:e=>{const t=e.target.value;c(t),r&&r(t)}})}));class Wr{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(const t of this.watchers)t(e)}}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter((t=>t!==e))}}}function Gr(e){const t=M.createContext(void 0);return e.Context=t,t.Provider}class Hr{consume=void 0;_current;constructor(e){this._current=e}set current(e){e!==this._current&&(this._current=e,this.consume?.(e))}get current(){return this._current}withConsumer(e){return this.consume=e,e&&e(this.current),this}}function Yr(e){const t=e.Context;if(!t)throw new Error("Context not defined for "+e.name);return P(t)}function Kr(e){const[t,n]=A(e.value);return $((()=>e.watch((e=>{n("function"==typeof e?()=>e:e)}))),[e]),t}function Zr(e,t){return $((()=>(e.value=t,()=>{e.value=void 0})),[e,t]),t}function qr(e,t){$((()=>e.watch(t)),[e,t])}function Xr(e){const[t,n]=A(e.current);return $((()=>(e.withConsumer(n),()=>{e.withConsumer(void 0)})),[e]),t}function Jr(e,t){$((()=>(e.withConsumer(t),()=>{e.withConsumer(void 0)})),[e,t])}function Qr(e,t){$((()=>(e.current=t,()=>{e.current=void 0})),[e,t])}class es{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(const t of this.watchers)t(e)}}addWatcher(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter((t=>t!==e))}}}function ts(e){const[t,n]=A(e.value);return $((()=>e.addWatcher((e=>{n("function"==typeof e?()=>e:e)}))),[e]),t}function ns(e,t){const n=D(null);return $((()=>{const r=r=>{n.current&&!n.current.contains(r.target)&&(t&&t(r)||e(r))};return window.setTimeout((()=>{document.addEventListener("click",r)}),0),()=>{document.removeEventListener("click",r)}}),[]),n}function rs(){const[e,t]=A(null);return[e,async e=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(e),t(e),!0}catch(e){return console.warn("Copy failed",e),t(null),!1}}]}function ss(e){$((()=>{const t=window.matchMedia("(prefers-color-scheme: dark)"),n=t=>e(t.matches);return t.addEventListener("change",n),e(t.matches),()=>t.removeEventListener("change",n)}),[])}function as(e,t){const[n,r]=A(e);return $((()=>{const n=setTimeout((()=>{r(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n}function is(e,t,n){const r=[],s=new EventSource(e);return s.addEventListener("message",(e=>{const n=JSON.parse(e.data);n&&(r.push(n),t(r.join("")))})),s.addEventListener("close",(e=>{s.close();const t=JSON.parse(e.data);n(t)})),()=>{s.close()}}function ls(e,t,n){$((()=>{"function"==typeof e?e().then((e=>is(e,t,n))):is(e,t,n)}),[e])}function os(e,t){Array.isArray(t)&&(t={deps:t});const n=t||{},[r,s]=A(null),[a,i]=A(!1),[l,o]=A(n.defaultValue),c=()=>(n.start&&n.start(),i(!0),e().then((e=>{o(e),n.onSuccess&&n.onSuccess(e)})).catch((e=>{s(e),n.onError&&n.onError(e)})).finally((()=>{i(!1),n.end&&n.end()})));return $((()=>{n.condition&&!n.condition()||c()}),n.deps),{data:l,isLoading:a,error:r,setData:o,refetch:c}}function cs(e,t){return!t||Array.isArray(t)?t={deps:[]}:t&&(t.deps=[]),os(e,t)}function ds(e=!1){const[t,n]=A(e);return{isOn:t,isOff:!t,set:e=>n(e),on:()=>n(!0),off:()=>n(!1),toggle:()=>n(!t)}}function us(e,t,n={}){$((()=>{const r=new IntersectionObserver((e=>{const r=e[0].isIntersecting;n.leave?r||t(e[0]):r&&t(e[0])}),{threshold:n.threshold||1});return e.current&&r.observe(e.current),()=>{e.current&&r.unobserve(e.current)}}),n.deps?n.deps.concat(e):[e])}function hs(){const e=D(!0);return $((t=>(t&&e.current&&t(),e.current=!1,()=>{e.current=!0})),[]),e.current}const ms="undefined"!=typeof window?U:$;class ps{state;constructor(e){this.state=e}get(){return this.state[0]}set(e){this.state[1](e)}}function fs(e){const t=A(e);return new ps(t)}function gs(...e){return i(a(e))}export{pn as AnimateChangeInHeight,ye as Avatar,Ce as Badge,an as Breadcrumbs,qe as Button,rt as Card,lt as CardContent,it as CardDescription,ot as CardFooter,st as CardHeader,at as CardTitle,Le as Center,gn as Checkbox,Ue as ComboBox,Pt as Command,Dt as CommandDialog,Ft as CommandEmpty,jt as CommandGroup,At as CommandInput,Bt as CommandItem,$t as CommandList,Vt as CommandSeparator,Ut as CommandShortcut,Rn as ConfirmModal,Xe as CopyButton,Ae as DOMPopup,bn as DateCombobox,ur as DefaultBox,jn as DeleteModal,xt as Dialog,yt as DialogClose,wt as DialogContent,kt as DialogDescription,Nt as DialogOverlay,bt as DialogPortal,Ct as DialogTitle,vt as DialogTrigger,Vn as Divider,Ie as DotBadge,Xn as DropZone,Bn as Dropdown,Wn as DropdownList,Zn as EmptyCollection,lr as ErrorBox,qn as FileUploadInput,zn as FilterBar,In as FilterOperator,Qn as FormItem,Ln as Heading,or as InfoBox,zt as Input,nr as InputList,sn as Label,rr as Link,Cr as ListOption,Un as MenuItem,sr as MenuList,ir as MessageBox,hr as Modal,gr as ModalBody,ht as ModalContextProvider,fr as ModalFooter,pr as ModalTitle,nt as ModeToggle,vr as NumberInput,Fe as OptionAdapter,Tt as Popover,St as PopoverAnchor,Et as PopoverClose,Mt as PopoverContent,Rt as PopoverTrigger,$e as Popup,Ee as PopupController,Pn as Portal,Wr as Property,yr as RadioGroup,br as RadioOptionAdapter,Er as RowSkeleton,kr as SelectBox,zr as SelectList,Lr as SelectStack,vn as SelectionCombobox,It as Separator,es as SharedState,ps as SharedValue,Tr as SidePanel,Hr as Slot,Gn as Spinner,je as StringOptionAdapter,Ve as StringOptionAdapterWithCreate,tr as Styles,dr as SuccessBox,Ne as SvgAvatar,Sr as Switch,Pr as TBody,Dr as TR,Mr as Table,jr as Tabs,Vr as TabsBar,Xt as TabsContent,$r as TabsContext,Zt as TabsList,Br as TabsPanel,qt as TabsTrigger,On as Text,yn as TextCombobox,Ur as Textarea,Qe as ThemeProvider,Mn as ToastContext,Fn as ToastProvider,Qt as Tooltip,tn as TooltipContent,Jt as TooltipProvider,en as TooltipTrigger,mt as VModal,ft as VModalBody,gt as VModalFooter,pt as VModalTitle,Wt as VSelectBox,Ht as VTabs,Yt as VTabsBar,Kt as VTabsPanel,nn as VTooltip,cr as WarningBox,Ze as buttonVariants,gs as cn,Re as computePosition,Gr as createCompositeStateProvider,Be as getDefaultComboBoxLayout,ns as useClickOutside,Ye as useComboboxCtrl,Yr as useCompositeState,rs as useCopyToClipboard,ss as useDarkMode,as as useDebounce,Qr as useDefineSlot,Jn as useDropZone,ls as useEventSource,os as useFetch,cs as useFetchOnce,ds as useFlag,Kr as useGetCompositeStateProperty,us as useIntersectionObserver,hs as useIsFirstRendering,ut as useIsInModal,De as usePopupController,ms as useSafeLayoutEffect,Zr as useSetCompositeStateProperty,fs as useSharedValue,Xr as useSlot,Ar as useTabs,Sn as useToast,qr as useWatchCompositeStateProperty,ts as useWatchSharedState,Jr as useWatchSlot};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{cva as r}from"class-variance-authority";import s,{clsx as i}from"clsx";import{twMerge as a}from"tailwind-merge";import{ChevronUpIcon as l,ChevronDownIcon as o,Loader2 as c,Check as d,CopyIcon as u,Computer as h,Sun as m,Moon as p,X as f,Search as g,ChevronsUpDown as x,SearchIcon as v,SquarePlus as b,ChevronRight as y,MoreHorizontal as N,ListFilter as w,TriangleAlert as k,Info as C,AlertTriangle as _,CircleX as z,CircleCheck as I,ChevronDown as L,Plus as T,ChevronsUpDownIcon as O}from"lucide-react";import*as R from"react";import S,{createContext as M,useContext as E,useRef as P,useState as A,useEffect as D,forwardRef as $,Fragment as F,useMemo as j,isValidElement as V,useLayoutEffect as B}from"react";import{createPortal as U}from"react-dom";import{Slot as W}from"@radix-ui/react-slot";import{VTooltip as G}from"@vertesia/ui/core";import*as H from"@radix-ui/react-dialog";import*as Y from"@radix-ui/react-separator";import{isEqual as K}from"lodash-es";import*as Z from"@radix-ui/react-popover";import{Command as q}from"cmdk";import*as X from"@radix-ui/react-tabs";import*as J from"@radix-ui/react-tooltip";import*as Q from"@radix-ui/react-label";import ee from"dayjs";import te from"react-date-picker";import*as ne from"@radix-ui/react-checkbox";import{Transition as re,Menu as se,MenuButton as ie,MenuItems as ae,MenuItem as le,Listbox as oe,ListboxButton as ce,ListboxOptions as de,ListboxOption as ue,Dialog as he,TransitionChild as me,DialogPanel as pe,DialogTitle as fe,RadioGroup as ge,Switch as xe}from"@headlessui/react";function ve(e){switch(e){case"xs":return"size-4";case"sm":return"size-6";case"md":return"size-8";case"lg":return"size-10";case"xl":return"size-12";case"2xl":return"size-14";default:throw new Error("Unexpected size: "+e)}}function be({size:t,src:n,name:r,shape:s="circle",color:i="bg-gray-500",className:a}){const l="circle"===s?"rounded-full":"rounded-md",o=ve(t||"md");if(n)return e("img",{className:`inline-block ${o} ${l} ${i} ${a}`,src:n,alt:r||n,title:r});if(r){const[n,s]=r.split(" ");let c=s?`${n[0]}${s[0]}`:`${n[0]}${n[1]}`;return e("span",{className:`inline-flex ${o} items-center justify-center ${l} ${i} ${a}`,title:r,children:e("span",{className:("xs"!=t?"text-xs":"text-[0.6rem]")+" font-medium leading-none text-white",children:c})})}return e("span",{className:`inline-block ${o} overflow-hidden ${l} ${i}`,children:e("svg",{className:"h-full w-full text-gray-300",fill:"currentColor",viewBox:"0 0 24 24",children:e("path",{d:"M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z"})})})}function ye({size:t,shape:n="circle",color:r="bg-gray-500",className:s,children:i}){const a="circle"===n?"rounded-full":"rounded-md",l=ve(t||"md");return e("span",{className:`inline-block ${l} overflow-hidden ${a} ${r} ${s}`,children:i})}function Ne(...e){return a(i(e))}const we=r("inline-flex items-center rounded-md px-2 py-1 text-xs font-medium",{variants:{variant:{default:"text-foreground bg-muted",secondary:"bg-secondary text-primary",destructive:"bg-destructive text-destructive",attention:"bg-attention text-attention",success:"bg-success text-success",info:"bg-info text-info",done:"bg-done text-done"}},defaultVariants:{variant:"default"}});function ke({className:t,variant:n,children:r,onClick:s,...i}){return e("span",{className:Ne(we({variant:n}),t),onClick:s,...i,children:r})}const Ce=r("inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ring-1 ring-inset ring-border",{variants:{variant:{default:"",success:"",destructive:"",attention:"",done:"",info:""}},defaultVariants:{variant:"default"}}),_e=r("h-1.5 w-1.5",{variants:{variant:{default:"fill-foreground",success:"fill-success",destructive:"fill-destructive",attention:"fill-attention",done:"fill-done",info:"fill-info"}},defaultVariants:{variant:"default"}});function ze({variant:n,className:r,dotClassName:s,children:i,...a}){return t("span",{className:Ne(Ce({variant:n}),r),...a,children:[e("svg",{className:Ne(_e({variant:n}),s),viewBox:"0 0 6 6","aria-hidden":"true",children:e("circle",{cx:3,cy:3,r:3})}),i]})}function Ie({className:t,children:n}){return e("div",{className:s("flex items-ceter justify-center",t),children:n})}class Le{left;top;width;height;alignAxis;gap;constructor(e=0){this.gap=e}position(e,t,n){switch(e){case"top":this.top=t.top-n.height-this.gap,this.alignAxis="x";break;case"bottom":this.top=t.bottom+this.gap,this.alignAxis="x";break;case"left":this.left=t.left-n.width-this.gap,this.alignAxis="y";break;case"right":this.left=t.right+this.gap,this.alignAxis="y";break;case"ne":this.top=t.top-n.height-this.gap,this.left=t.right+this.gap;break;case"nw":this.top=t.top-n.height-this.gap,this.left=t.left-n.width-this.gap;break;case"se":this.top=t.bottom+this.gap,this.left=t.right+this.gap;break;case"sw":this.top=t.bottom+this.gap,this.left=t.left-n.width-this.gap}}align(e,t,n){if(this.alignAxis)switch(e){case"start":"x"===this.alignAxis?this.left=t.left:this.top=t.top;break;case"end":"x"===this.alignAxis?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case"center":"x"===this.alignAxis?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case"fill":"x"===this.alignAxis?(this.left=t.left,this.width=t.right-t.left):(this.top=t.top,this.height=t.bottom-t.top)}}computePosition(e,t,n){if(this.position(e.position,n,t),e.align&&this.align(e.align,n,t),!this.left&&!this.top)throw new Error("Invalid position. Cannot compute x,y coordinates");const r=null!=this.width,s=null!=this.height,i=r?this.width:t.width,a=s?this.height:t.height;return{rect:new DOMRect(this.left,this.top,i,a),constrainWidth:r,constrainHeight:s,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){const t=function(e){switch(e){case"start":return"end";case"end":return"start";default:return e}}(e.align);if(t!==e.align)return{...e,align:t}}}else{const t=function(e){switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne";default:return e}}(e.position);if(t!==e.position)return{...e,position:t}}return null}}function Te(e,t,n){return"x"===n?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function Oe(e,t,n,r){const s=new Le(e.gap);let i=s.computePosition(e,t,n);const a=Te(i.rect,r,"x"),l=Te(i.rect,r,"y");if(a&&l)return i;let o=null;return a||(o=s.flipAxis(e,"x")),l||(o=s.flipAxis(o||e,"y")),o?(i=new Le(s.gap).computePosition(o,t,n),function(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}(i.rect,r)?i:null):null}function Re(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),s=Math.min(e.right,t.right),i=Math.min(e.bottom,t.bottom);return s<=n||i<=r?null:new DOMRect(n,r,s-n,i-r)}function Se(e){const t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){const r=getComputedStyle(e);if(t&&"visible"!==r.overflowY||n&&"visible"!==r.overflowX)return!0}return!1}class Me{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=function(e,t=document.documentElement){const n=[];let r=e.parentElement;for(;r&&r!==t;)Se(r)&&n.push(r),r=r.parentElement;return n.push(t),n}(this.anchor,this.root),this.visibleClientRect=function(e){if(0===e.length)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Re(e[n].getBoundingClientRect(),t),!t)return null;return t}(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){const t=this.scrollableParents,n=()=>{this.update()};window.addEventListener("resize",n);for(const e of t)e.addEventListener("scroll",n);let r,s;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout((function(){r&&document.addEventListener("click",r)}),0)),this.options.closeOnEsc&&(s=e=>{"Escape"===e.key&&this.tryClose()},window.setTimeout((function(){s&&document.addEventListener("keydown",s)}),0));const i=this.options.blockPageScroll;return i&&(document.body.style.overflow="hidden",document.body.style.height="100%"),()=>{window.removeEventListener("resize",n);for(const e of t)e.removeEventListener("scroll",n);r&&document.removeEventListener("click",r),s&&document.removeEventListener("keydown",s),i&&(document.body.style.overflow="",document.body.style.height="")}}open(e,t){if(this.context)throw new Error("The popup controller is already bound to an element");this.tryOpen(e,t)}tryOpen(e,t){this.context||(this.context={element:e,constraints:t,cleanup:this.registerListeners(e)},e.style.display="",e.style.visibility="hidden",this.update(),this.options.onOpen&&this.options.onOpen(this))}close(){if(!this.context)throw new Error("The popup controller is not bound to an element");this.tryClose()}tryClose(){this.context&&(this.options.onClose&&this.options.onClose(this),this.context.cleanup(),this.context.element.style.display="none",this.context=void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;const e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),s=this.visibleClientRect;if(!s)return;const i=Oe(t,n,r,s);this.context.position=i||void 0,i&&(i.constrainHeight&&(e.style.height=i.rect.height+"px"),i.constrainWidth&&(e.style.width=i.rect.width+"px"),e.style.left=i.rect.left+"px",e.style.top=i.rect.top+"px",e.style.visibility="visible")}createPopupElement(){const e=document.createElement("div");return e.style.margin="0",e.style.padding="0",e.style.border="none",e.style.background="transparent",e.className="composable-Popup",e}}const Ee=M(void 0);function Pe(){const e=E(Ee);if(!e)throw new Error("usePopupController must be used inside a Popup component");return e}function Ae({ctrlRef:t,id:n,constraints:r,isOpen:s,children:i,className:a,onClose:l,zIndex:o,position:c,...d}){const u=P(null),[h,m]=A();return D((()=>{if(!d.anchor)throw new Error("Anchor element is required");const e=new Me({...d,onClose:l});return m(e),()=>{e.tryClose()}}),[]),D((()=>{t&&(t.current=h)}),[h]),D((()=>{h&&u.current?h.isOpen!==s&&(s?h.open(u.current,r):h.close()):h?.isOpen&&!s&&h.close()}),[s,h,u.current]),e(Ee.Provider,{value:h,children:s&&U(e("div",{id:n,style:{visibility:"hidden",position:c||"absolute",zIndex:o||100},ref:u,className:a,children:i}),document.body)})}function De({anchor:t,root:n,children:r,...s}){return!t.current||n&&!n.current?null:e(Ae,{anchor:t.current,root:n?.current||void 0,...s,children:r})}class $e{filter(e,t){const n=t.toLowerCase();return e.filter((e=>this.valueOf(e).toLowerCase().includes(n)))}renderOption(e){return this.valueOf(e)}findById(e,t){return e.find((e=>this.idOf(e)===t))}createItem(e){return null}}class Fe extends $e{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new Fe}class je extends Fe{createItem(e){return e}static instance=new je}function Ve(e,t){return{buttonRight:4,buttonWidth:24,maxMenuHeight:240,menuClass:"w-72 bg-white mt-1 shadow-md border border-gray-200 overflow-auto p-0 z-10",inputClass:s(t?"block m-0 p-0 border-0 focus:outline-none focus:ring-0 bg-transparent":"block sm:text-sm sm:leading-6 rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-slate-600 dark:text-slate-50 dark:bg-slate-800 placeholder:text-gray-400 dark:placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 dark:focus:ring-indigo-800 py-1.5",e?"w-full":"!w-auto"),optionClass:"py-2 px-3 shadow-sm flex flex-col [&.option-selected]:font-semibold [&.option-highlighted]:bg-blue-300",Input:Ue,Menu:Ge,Toggle:We}}function Be({menuAlign:r="fill",menuGap:s,focusOnMount:i,onSelect:a,value:l,zIndex:o,unstyledInput:c,fullWidth:d,api:u,layout:h,adapter:m,items:p,placeholder:f}){const[g]=A(`combobox-popup-${Math.floor(1e6*Math.random())}`),x=P(void 0),v=P(null),b=h?Object.assign(Ve(d,c),h):Ve(d,c),y=S.useRef(null),N=He({adapter:m,items:p,value:l,popupId:g});D((()=>{v.current&&i&&v.current.focus()}),[v.current]),D((()=>{N.onSelect=a,N.popupCtrl=x.current}),[a,x.current]),D((()=>{if(u&&N&&v.current)return u.current={open:()=>N.openMenu(),close:()=>N.closeMenu(),toggle:()=>N.toggleMenu(),setInputValue:e=>N.inputText=e,inputValue:N.inputText||"",selectedItem:N.selectedItem,focus:()=>v.current?.focus()},()=>{u.current=null}}),[u,N,v.current]);const w=N.isMenuOpen&&N.filteredItems.length>0;return t(n,{children:[e(b.Input,{boxRef:y,inputRef:v,ctrl:N,layout:b,placeholder:f}),e(De,{id:g,ctrlRef:x,className:"combobox-popup",closeOnClick:!0,closeOnEsc:!0,onClose:()=>N.closeMenu(),isOpen:w,anchor:y,zIndex:o,constraints:{position:"bottom",align:r,gap:null!=s?s:4},children:e(b.Menu,{fillWidth:"fill"===r,items:N.filteredItems,ctrl:N,layout:b,adapter:m})})]})}function Ue({inputRef:n,placeholder:r,boxRef:s,ctrl:i,layout:a}){const l=a.buttonWidth,o=l>0?{paddingRight:`${l}px`}:void 0,c=a.Toggle;return t("div",{className:"relative",ref:s,children:[e("input",{ref:n,placeholder:r,...i.getInputProps(),style:o,className:a.inputClass}),c&&e("button",{style:{top:0,bottom:0,right:`${a.buttonRight}px`,width:`${l}px`,position:"absolute",border:"none",padding:0,margin:0,backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},...i.getToggleButtonProps(),children:e(c,{ctrl:i,layout:a})})]})}function We({ctrl:t}){return t.isMenuOpen?e(l,{className:"w-4 h-4"}):e(o,{className:"w-4 h-4"})}function Ge({fillWidth:t,items:n,layout:r,ctrl:i,adapter:a}){const{highlightedIndex:l,selectedItem:o}=i;return e("ul",{style:{width:t?"100%":void 0,maxHeight:r.maxMenuHeight?`${r.maxMenuHeight}px`:"240px"},className:r.menuClass,...i.getMenuProps(),children:n.map(((t,n)=>e("li",{"data-index":n,className:s(r.optionClass,l===n&&"option-highlighted",o===t&&"option-selected"),...i.getItemProps(t,n),children:a.renderOption(t)},a.idOf(t))))})}function He(e){const[t,n]=A(new Ye(e));return D((()=>{t?.withState(n)}),[]),t}class Ye{popupId;items;adapter;onSelect;setState;_selectedItem=null;_filteredItems;_inputText="";_highlightedIndex=null;_isMenuOpen=!1;popupCtrl;constructor({adapter:e,items:t,value:n,popupId:r}){this.adapter=e,this.items=t,this.popupId=r,"string"==typeof n?this._inputText=n:n&&(this._selectedItem=e.findById(t,e.idOf(n))||null,this._selectedItem&&(this._inputText=e.valueOf(n))),this._inputText?this._filteredItems=this.adapter.filter(this.items,this._inputText):this._filteredItems=this.items}withState(e){return this.setState=e,this}clone(){const e=new Ye({adapter:this.adapter,items:this.items,popupId:this.popupId});return e.setState=this.setState,e.onSelect=this.onSelect,e._inputText=this._inputText,e._highlightedIndex=this._highlightedIndex,e._selectedItem=this._selectedItem,e._isMenuOpen=this._isMenuOpen,e._filteredItems=this._filteredItems,e.popupCtrl=this.popupCtrl,e}updateState(){this.setState?.(this.clone())}get filteredItems(){return this._inputText?this.adapter.filter(this.items,this._inputText):this.items}get selectedItem(){return this._selectedItem}set selectedItem(e){this._selectedItem=e,this._inputText=e?this.adapter.valueOf(e):"",this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items,this.updateState(),this.onSelect?.(e)}get isMenuOpen(){return this._isMenuOpen}set inputText(e){if(this._inputText=e,this._filteredItems=e?this.adapter.filter(this.items,e):this.items,this._highlightedIndex=null,this._selectedItem=null,this.updateState(),this.isMenuOpen&&this.popupCtrl){const e=this.popupCtrl,t=e.context?.position?.position;t&&"top"===t&&window.setTimeout((()=>{e.update()}),100)}}get inputText(){return this._inputText}set highlightedIndex(e){this._highlightedIndex=e,this.updateState()}get highlightedIndex(){return this._highlightedIndex}openMenu(){this._filteredItems.length>0&&(this._isMenuOpen=!0,this.updateState())}closeMenu(e){this._isMenuOpen&&(this._highlightedIndex=null,this._isMenuOpen=!1,this.updateState())}toggleMenu(){this._isMenuOpen?this.closeMenu():this.openMenu()}highlightIndex(e,t=!1){this.highlightedIndex=e;const n=document.getElementById(this.popupId);n&&n.querySelector(`li[data-index="${e}"]`)?.scrollIntoView(t)}getMenuProps(){return{}}getToggleButtonProps(){return{onClick:()=>{this._isMenuOpen=!this._isMenuOpen,this.updateState()}}}getItemProps(e,t){return{"aria-selected":this._highlightedIndex===t,onClick:()=>{this.selectedItem=e,this.closeMenu()},onMouseEnter:()=>{this.highlightedIndex!==t&&(this.highlightedIndex=t)},onMouseLeave:()=>{this.highlightedIndex===t&&(this.highlightedIndex=null)}}}getInputProps(){const e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{const t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{const n=t.key;if("Enter"===n){if(null!=this.highlightedIndex)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){const e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else"ArrowDown"===n?this.isMenuOpen?this.highlightIndex(null===this.highlightedIndex?0:(r=this.highlightedIndex,s=e.length,(r+1)%s),!1):this.openMenu():"ArrowUp"===n&&this.isMenuOpen&&this.highlightIndex(null===this.highlightedIndex?0:function(e,t){return(e-1+t)%t}(this.highlightedIndex,e.length),!0);var r,s}}}}const Ke=r("hover:cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{destructive:"bg-destructive dark:bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive-muted/50 dark:ring-destructive-muted/50 shadow-xs hover:bg-destructive/50",outline:"border border-input bg-background shadow-xs hover:bg-muted ring-inset",secondary:"bg-primary/5 dark:bg-primary/10 text-primary shadow-xs hover:bg-primary/10 dark:hover:bg-primary/20 ring-inset",ghost:"hover:bg-muted/50 dark:hover:bg-muted/20 ring-inset",link:"text-white underline-offset-4 hover:underline ring-inset",primary:"bg-primary text-white shadow-xs hover:bg-primary/90 ring-inset",unstyled:""},size:{xs:"h-7 rounded px-2 py-1 text-xs gap-x-1",sm:"h-8 rounded px-3 text-xs",md:"h-9 rounded-md px-4 py-2",lg:"h-10 rounded-md px-3",xl:"rounded-md px-3.5 py-2.5 text-sm gap-x-2",icon:"p-0 m-0 rounded-full"}},defaultVariants:{variant:"primary",size:"md"}}),Ze=R.forwardRef((({className:n,variant:r,size:i,asChild:a=!1,alt:l,isDisabled:o,isLoading:d,title:u,onClick:h,type:m,...p},f)=>{const g=t(a?W:"button",{className:s(Ne(Ke({variant:r,size:i})),n),disabled:o||d||p.disabled,ref:f,onClick:h,type:m,autoFocus:!1,...p,children:[d&&e(c,{className:"animate-spin"}),p.children]});return l||u?e(G,{description:l||u,asChild:!0,className:"cursor-pointer",size:"xs",placement:"top",children:g}):g}));Ze.displayName="Button";const qe=R.forwardRef((({size:t,content:n,toast:r,className:s,alt:i,...a},l)=>{const[o,c]=A(!1);return e(Ze,{ref:l,className:Ne(s),variant:"unstyled",size:t||"sm",onClick:()=>{navigator.clipboard.writeText(n).then((()=>{c(!0),setTimeout((()=>c(!1)),2e3),r&&r.toast&&r.toast({status:"success",title:r.message||"Copied to clipboard",duration:2e3})})).catch((e=>{console.error("Failed to copy text: ",e),r&&r.toast&&r.toast({status:"error",title:"Failed to copy",duration:2e3})}))},...a,alt:i??"Copy",children:o?e(d,{className:"text-success"}):e(u,{className:"size-4"})})}));qe.displayName="CopyButton";const Xe=M({theme:"system",setTheme:()=>null});function Je({children:t,defaultTheme:n="system",storageKey:r="vite-ui-theme",...s}){const[i,a]=A((()=>localStorage.getItem(r)||n));D((()=>{const e=window.document.documentElement;if(e.classList.remove("light","dark"),"system"!==i)e.classList.add(i);else{const t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";e.classList.add(t)}}),[i]);const l={theme:i,setTheme:e=>{localStorage.setItem(r,e),a(e)}};return e(Xe.Provider,{...s,value:l,children:t})}const Qe=()=>{const e=E(Xe);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e};function et({option:t,current:n,setTheme:r,icon:s}){return e(Ze,{variant:n===t?"secondary":"outline",size:"sm",onClick:()=>r(t),alt:t,children:s})}function tt(){const{setTheme:n}=Qe(),r=Qe().theme;return t("div",{className:"flex justify-between px-2 items-center",children:[e("p",{className:"text-sm font-semibold",children:"Theme"}),t("div",{className:"flex gap-2",children:[e(et,{current:r,option:"system",setTheme:n,icon:e(h,{className:"text-muted"})}),e(et,{current:r,option:"light",setTheme:n,icon:e(m,{className:"text-muted"})}),e(et,{current:r,option:"dark",setTheme:n,icon:e(p,{className:"text-muted"})})]})]})}const nt=R.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:Ne("rounded-xl border bg-card text-card-foreground shadow",t),...n})));nt.displayName="Card";const rt=R.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:Ne("flex flex-col p-6",t),...n})));rt.displayName="CardHeader";const st=R.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:Ne("font-semibold leading-none tracking-tight",t),...n})));st.displayName="CardTitle";const it=R.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:Ne("text-sm text-muted-foreground",t),...n})));it.displayName="CardDescription";const at=R.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:Ne("p-6 pt-0",t),...n})));at.displayName="CardContent";const lt=R.forwardRef((({className:t,...n},r)=>e("div",{ref:r,className:Ne("flex items-center p-6 pt-0",t),...n})));function ot({children:t}){return e("span",{style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},children:t})}lt.displayName="CardFooter";const ct=M(!1);function dt(){return!!E(ct)}function ut({children:t}){return e(ct.Provider,{value:!0,children:t})}function ht({className:n,children:r,isOpen:s,onClose:i,description:a="Modal Description",noCloseButton:l=!1,allowOverflow:o=!1,disableCloseOnClickOutside:c=!1}){const d=e=>{e||i()};return t(gt,{open:s,onOpenChange:e=>{c&&!e||d(e)},children:[o&&e(yt,{className:"z-50 fixed inset-0 bg-black/80"}),e(ot,{children:e(wt,{children:a})}),t(Nt,{className:Ne("min-h-20 p-4","fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 sm:rounded-lg",n),children:[!l&&e(bt,{onClick:()=>d(!1),asChild:!0,autoFocus:!1,children:e(Ze,{variant:"outline",alt:"Close",className:"top-4 right-4 absolute data-[state=open]:bg-accent opacity-70 hover:opacity-100 rounded-sm focus:outline-none focus:ring-2 focus:ring-ring ring-offset-background focus:ring-offset-2 data-[state=open]:text-muted-foreground transition-opacity disabled:pointer-events-none",children:e(f,{className:"w-4 h-4"})})}),e(ut,{children:r})]})]})}const mt=({children:t,show:n=!0,className:r,...s})=>n?e(kt,{className:Ne("text-lg font-semibold leading-6 tracking-tight py-2",r),...s,children:t}):e(ot,{children:e(kt,{children:t})}),pt=({children:t,className:n,...r})=>e("div",{className:Ne("text-sm max-h-[80vh] overflow-y-auto",n),...r,children:t}),ft=({align:t="right",children:n,className:r,...s})=>e("div",{className:Ne("w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end sm:space-x-2",{left:"justify-start",center:"justify-center",right:"justify-end"}[t],r),...s,children:n}),gt=H.Root,xt=H.Trigger,vt=H.Portal,bt=H.Close,yt=R.forwardRef((({className:t,...n},r)=>e(H.Overlay,{ref:r,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n})));yt.displayName=H.Overlay.displayName;const Nt=R.forwardRef((({className:n,children:r,...s},i)=>t(vt,{children:[e(yt,{}),e(H.Content,{ref:i,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-2 border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...s,children:r})]})));Nt.displayName=H.Content.displayName;const wt=R.forwardRef((({className:t,...n},r)=>e(H.Description,{ref:r,className:Ne("text-sm text-muted-foreground",t),...n})));wt.displayName=H.Description.displayName;const kt=R.forwardRef((({className:t,...n},r)=>e(H.Title,{ref:r,className:Ne("text-lg font-semibold leading-none tracking-tight",t),...n})));kt.displayName=H.Title.displayName;const Ct=r("",{variants:{size:{xs:"rounded py-1 text-xs rounded-xs",sm:"rounded text-xs rounded-sm",md:"rounded-md py-2 text-sm",lg:"rounded-md text-base",xl:"rounded-md py-2.5 text-lg"},variant:{default:"flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",unstyled:"block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent",noPadding:"block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background",legacy:"py-1.5 block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background"}},defaultVariants:{size:"md",variant:"default"}}),_t=R.forwardRef((({className:n,type:r,size:s="md",variant:i="default",clearable:a=!0,onChange:l,value:o,...c},d)=>t("div",{className:"w-full",style:{position:"relative",display:"inline-block"},children:[e("input",{type:r,className:Ne(Ct({size:s,variant:i}),n,a&&o?"pr-6":""),ref:d,value:null==o?"":o,onChange:e=>{l&&l(e.target.value)},...c}),a&&o&&!c.readOnly&&!c.disabled&&e("button",{onClick:()=>{l&&l("")},className:`absolute ${"number"!==r?"right-0":"right-7"} top-1/2 -translate-y-1/2 size-7 text-muted-foreground hover:text-destructive cursor-pointer flex items-center justify-center`,type:"button","aria-label":"Clear input",children:e(f,{size:16})})]})));_t.displayName="Input";const zt=R.forwardRef((({className:t,orientation:n="horizontal",decorative:r=!0,...s},i)=>e(Y.Root,{ref:i,decorative:r,orientation:n,className:Ne("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",t),...s})));zt.displayName=Y.Root.displayName;const It=R.createContext(null),Lt=({hover:t=!1,click:n=!1,children:r,_open:s,onOpenChange:i})=>{const[a,l]=R.useState(s||!1),o=dt();return e(It.Provider,{value:{open:a,setOpen:l,hover:t,click:n},children:e(Z.Root,{open:a,onOpenChange:e=>{l(e),i&&i(e)},modal:o,children:r})})};function Tt(e=!1,t=()=>{},n){e&&t("enter"===n)}const Ot=R.forwardRef((({children:t,...n},r)=>{const s=R.useContext(It);if(!s)throw new Error("PopoverTrigger must be used within a Popover");const{setOpen:i,hover:a,click:l}=s;return e(Z.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>Tt(a,i,"enter"),onMouseLeave:()=>Tt(a,i,"leave"),onClick:()=>{l&&i((e=>!e))},...n,children:t})}));Ot.displayName=Z.Trigger.displayName;const Rt=Z.Anchor,St=R.forwardRef((({className:t,align:n="center",side:r="bottom",...s},i)=>{const a=R.useContext(It);if(!a)throw new Error("PopoverContent must be used within a Popover");const{setOpen:l,hover:o}=a;return e(Z.Portal,{children:e(Z.Content,{ref:i,align:n,side:r,onMouseEnter:()=>Tt(o,l,"enter"),onMouseLeave:()=>Tt(o,l,"leave"),className:Ne("z-50 w-72 rounded-md border-popover bg-popover text-popover-foreground ring-1 ring-gray-200 dark:ring-slate-700 shadow-md focus:outline-none animate-in","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",t),...s})})}));St.displayName=Z.Content.displayName;const Mt=Z.Close;Mt.displayName=Z.Close.displayName;const Et=R.forwardRef((({className:t,...n},r)=>e(q,{ref:r,className:Ne("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...n})));Et.displayName=q.displayName;const Pt=({children:t,...n})=>e(gt,{...n,children:e(Nt,{className:"shadow-lg p-0 overflow-hidden",children:e(Et,{className:"[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:w-5 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",children:t})})}),At=R.forwardRef((({className:n,...r},s)=>t("div",{className:"flex items-center px-3 border-b","cmdk-input-wrapper":"",children:[e(g,{className:"opacity-50 size-4 shrink-0"}),e(q.Input,{ref:s,className:Ne("focus:ring-0","border-0 flex h-8 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",n),...r})]})));At.displayName=q.Input.displayName;const Dt=R.forwardRef((({className:t,...n},r)=>e(q.List,{ref:r,className:Ne("max-h-[200px] overflow-y-auto overflow-x-hidden",t),...n})));Dt.displayName=q.List.displayName;const $t=R.forwardRef(((t,n)=>e(q.Empty,{ref:n,className:"py-2 text-sm text-center",...t})));$t.displayName=q.Empty.displayName;const Ft=R.forwardRef((({className:t,...n},r)=>e(q.Group,{ref:r,className:Ne("overflow-y-auto overflow-x-hidden p-1 text-foreground","[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...n})));Ft.displayName=q.Group.displayName;const jt=R.forwardRef((({className:t,...n},r)=>e(q.Separator,{ref:r,className:Ne("-mx-1 h-px bg-border",t),...n})));jt.displayName=q.Separator.displayName;const Vt=R.forwardRef((({className:t,...n},r)=>e(q.Item,{ref:r,className:Ne("hover:bg-muted cursor-pointer relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...n})));Vt.displayName=q.Item.displayName;const Bt=({className:t,...n})=>e("span",{className:Ne("ml-auto text-xs tracking-widest text-muted-foreground",t),...n});function Ut({options:n,optionLabel:r,value:i,onChange:a,addNew:l,addNewLabel:o,disabled:c,filterBy:u,label:h,placeholder:m,className:p,popupClass:g,isClearable:y,border:N=!0,multiple:w=!1,by:k}){const C=P(null),[_,z]=A(!1),[I,L]=A(0),[T,O]=A("");D((()=>{const e=C.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect().width;L(t)},n=new ResizeObserver((()=>{t()}));return t(),n.observe(e),()=>{n.disconnect()}}),[]);const R=(e,t)=>!(!t||0===t.length)&&t.some((t=>S(t,e))),S=(e,t)=>null==e||null==t?e===t:"string"==typeof k?e[k]===t[k]:"function"==typeof k?k(e,t):K(e,t);let M=n||[];const E=T.toLowerCase(),$=function(e){return e?"string"==typeof e?t=>String(t[e]).toLowerCase():e:e=>String(e).toLowerCase()}(u);M=M.filter((e=>$(e).includes(E)));return t(Lt,{children:[e(Ot,{asChild:!0,children:t("div",{ref:C,onClick:e=>{c?e.preventDefault():z(!_)},className:s(p,N&&"border border-border","flex flex-row gap-2 items-center justify-between p-2 rounded-md group relative",!c&&"cursor-pointer hover:bg-muted"),children:[t("div",{className:s("flex flex-col w-full rounded-md text-sm items-center justify-center truncate",!c&&"",y&&i&&(!Array.isArray(i)||i.length>0)&&"pr-6"),children:[h&&e("div",{className:"w-full text-left text-xs font-semibold",children:h}),e("div",{className:s("w-full text-left",!c&&""),children:w?(()=>{const n=Array.isArray(i)?i:i?[i]:[];return 0===n.length?e("span",{className:"text-muted",children:m}):1===n.length?r?r(n[0]):n[0]:t("div",{className:"flex flex-wrap gap-1",children:[n.slice(0,1).map(((t,n)=>e("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded",children:r?r(t):t},n))),n.length>1&&t("span",{className:"inline-flex items-center px-2 py-1 text-xs bg-muted rounded",children:["+",n.length-1," more"]})]})})():(()=>{if(!i||Array.isArray(i)&&0===i.length)return e("span",{className:"text-muted",children:m});const t=Array.isArray(i)?i[0]:i;return r?r(t):t})()})]}),t("div",{className:"flex items-center gap-1",children:[y&&i&&(!Array.isArray(i)||i.length>0)&&e("div",{onClick:e=>{e.stopPropagation(),a(w?[]:void 0)},className:"cursor-pointer hover:bg-muted/20 rounded p-1",children:e(f,{className:"size-4"})}),!c&&e(x,{className:"size-4 opacity-50"})]})]})}),t(St,{style:{width:`${I}px`,zIndex:1e6},className:s("min-w-[8rem] w-64 bg-popover p-1 border shadow","divide-y divide-border",g),children:[u&&t("div",{className:"flex justify-start items-center mb-1",children:[e("div",{className:"mx-2",children:e(v,{className:"size-4"})}),e(_t,{variant:"unstyled",value:T,onChange:O,className:"w-full p-1 rounded-md",placeholder:"Search..."})]}),e(Et,{className:"overflow-hidden",children:t(Dt,{className:"max-h-[200px] overflow-y-auto",children:[e($t,{children:"No result found."}),e(Ft,{className:"overflow-visible",children:M?.map(((n,s)=>{const l=w?R(n,Array.isArray(i)?i:[]):null!=i&&S(i,n);return e(Vt,{onSelect:()=>(e=>{if(w){const t=Array.isArray(i)?i:[];if(R(e,t)){const n=t.filter((t=>!S(t,e)));a(n)}else a([...t,e])}else z(!1),a(e)})(n),className:"w-full",children:w?t("div",{className:"w-full flex justify-between items-center cursor-pointer",children:[e("div",{className:"w-full truncate text-left",children:r?r(n):n}),l&&e(d,{className:"size-4"})]}):t(Mt,{className:"w-full flex justify-between items-center",children:[e("div",{className:"w-full truncate text-left",children:r?r(n):n}),l&&e(d,{className:"size-4"})]})},s)}))})]})}),l&&e("div",{className:"p-1",children:t("a",{onClick:l,className:s("gap-x-2 px-2 py-1.5 truncate group flex rounded-md items-center text-sm cursor-pointer hover:bg-accent"),children:[e(b,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),o]})})]})]})}Bt.displayName="CommandShortcut";const Wt=R.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1}),Gt=({tabs:t,defaultValue:n,current:r,className:s,fullWidth:i,children:a,onTabChange:l,responsive:o=!1})=>{const c="function"==typeof r?r():r||n,[d,u]=R.useState(c);R.useEffect((()=>{c&&u(c)}),[c]);const h=e=>{u(e),l&&l(e)},m=R.useCallback((e=>{h(e)}),[h]);return e(Wt.Provider,{value:{tabs:t,size:i?t.length:0,current:d,setTab:m,responsive:o},children:e(X.Root,{defaultValue:t[0]?.name,value:d,onValueChange:h,className:s,children:a})})},Ht=({className:r})=>{const{tabs:s,size:i,current:a,setTab:l,responsive:o}=R.useContext(Wt),c=0!==i,d=R.useCallback((e=>{if(!s||!l)return;const t=s.find((t=>t.name===e));t?.href&&window.history.pushState(null,"",t.href),l(e)}),[s,l]);return s&&l?t(n,{children:[o&&e("div",{className:"px-2 block lg:hidden",children:e(Ut,{label:"Tab",className:r,options:s,optionLabel:e=>"string"==typeof e.label?e.label:String(e.label),value:s.find((e=>e.name===a)),onChange:e=>{d(e.name)}})}),e(Kt,{size:i,className:Ne(c?"w-full":"",r,o?"hidden lg:flex":""),children:s.map((t=>e(Zt,{value:t.name,disabled:t.disabled,href:t.href,onClick:()=>d(t.name),children:t.label},t.name)))})]}):(console.warn("TabsBar: No tabs provided or setTab not available"),null)},Yt=()=>{const{tabs:t}=R.useContext(Wt);return t?e(n,{children:t.map((t=>e(qt,{value:t.name,children:t.content},t.name)))}):null},Kt=R.forwardRef((({className:t,size:n,...r},s)=>e(Wt.Provider,{value:{size:n},children:e(X.List,{ref:s,className:Ne("border-b -mb-px flex space-x-4",t),...r})})));Kt.displayName=X.List.displayName;const Zt=R.forwardRef((({className:t,href:n,...r},s)=>{const{size:i}=R.useContext(Wt),a=R.useCallback((e=>{n&&(e.preventDefault(),window.history.pushState(null,"",n)),r.onClick&&r.onClick(e)}),[n,r.onClick]);return e(X.Trigger,{ref:s,className:Ne("border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer","border-transparent text-muted-foreground hover:border-border hover:text-foreground","data-[state=active]:border-primary data-[state=active]:text-primary","disabled:pointer-events-none disabled:opacity-50",t,i?`w-1/${i}`:""),onClick:a,...r})}));Zt.displayName=X.Trigger.displayName;const qt=R.forwardRef((({className:t,...n},r)=>e(X.Content,{ref:r,className:Ne("focus-visible:outline-none",t),...n})));qt.displayName=X.Content.displayName;const Xt=J.Provider,Jt=J.Root,Qt=J.Trigger,en=R.forwardRef((({className:t,sideOffset:n=4,side:r="top",...s},i)=>e(J.Portal,{children:e(J.Content,{ref:i,sideOffset:n,side:r,style:{zIndex:100},className:Ne("max-w-[90vw]","z-50 overflow-hidden rounded-md bg-tooltips border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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",t),...s})})));function tn({description:n,children:r,size:s="sm",placement:i="top",className:a,asChild:l}){return e(Xt,{delayDuration:0,children:t(Jt,{children:[e(Qt,{className:"cursor-pointer",asChild:l,children:r}),e(en,{side:i,className:`px-3 py-1.5 max-w-${s} text-${s} px-3 ${a}`,children:n})]})})}en.displayName=J.Content.displayName;const nn=r("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),rn=R.forwardRef((({className:n,required:r,...s},i)=>t(Q.Root,{ref:i,className:Ne(nn(),n),...s,children:[s.children,r&&e("span",{className:"text-destructive-foreground ml-1",children:"*"})]})));function sn({children:n,maxItems:r=3,className:s,separator:i}){if(n.length<=r)return e(an,{className:Ne("w-full",s),children:e(ln,{children:n.map(((r,s)=>t(R.Fragment,{children:[e(on,{children:r.href?e(cn,{href:r.href,children:r.label}):e(dn,{children:r.label})}),s<n.length-1&&e(un,{children:i??e(y,{})})]},s)))})});const a=n[0],l=n.slice(-(r-2));return e(an,{className:Ne("w-full",s),children:t(ln,{children:[e(on,{children:a.href?e(cn,{href:a.href,children:a.label}):e(dn,{children:a.label})}),e(un,{children:i??e(y,{})}),e(on,{children:e(hn,{})}),e(un,{children:i??e(y,{})}),l.map(((n,r)=>t(R.Fragment,{children:[e(on,{children:n.href?e(cn,{href:n.href,children:n.label}):e(dn,{children:n.label})}),r<l.length-1&&e(un,{children:i??e(y,{})})]},r)))]})})}rn.displayName=Q.Root.displayName;const an=R.forwardRef((({...t},n)=>e("nav",{ref:n,"aria-label":"breadcrumb",...t})));an.displayName="Breadcrumb";const ln=R.forwardRef((({className:t,...n},r)=>e("ol",{ref:r,className:Ne("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...n})));ln.displayName="BreadcrumbList";const on=R.forwardRef((({className:t,...n},r)=>e("li",{ref:r,className:Ne("inline-flex items-center gap-1.5",t),...n})));on.displayName="BreadcrumbItem";const cn=R.forwardRef((({asChild:t,className:n,...r},s)=>e("a",{ref:s,className:Ne("transition-colors hover:text-foreground",n),...r})));cn.displayName="BreadcrumbLink";const dn=R.forwardRef((({className:t,...n},r)=>e("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:Ne("font-normal text-foreground",t),...n})));dn.displayName="BreadcrumbPage";const un=({children:t,className:n,...r})=>e("li",{role:"presentation","aria-hidden":"true",className:Ne("[&>svg]:w-3.5 [&>svg]:h-3.5",n),...r,children:t??e(y,{})});un.displayName="BreadcrumbSeparator";const hn=({className:n,...r})=>t("span",{role:"presentation","aria-hidden":"true",className:Ne("flex h-9 w-9 items-center justify-center",n),...r,children:[e(N,{className:"h-4 w-4"}),e("span",{className:"sr-only",children:"More"})]});hn.displayName="BreadcrumbEllipsis";const mn=({children:t,className:n})=>{const r=P(null),[s,i]=A("auto");return D((()=>{if(r.current){const e=new ResizeObserver((e=>{const t=e[0].contentRect.height;i(t)}));return e.observe(r.current),()=>{e.disconnect()}}}),[]),e("div",{className:Ne(n,"overflow-hidden transition-all duration-100 ease-in"),style:{height:s},children:e("div",{ref:r,children:t})})};function pn({className:t,size:n="md",...r}){return e(te,{className:`${t} ${{sm:"text-sm",md:"text-base",lg:"text-lg"}[n]}`,calendarIcon:!1,...r})}pn.displayName="Calendar";const fn=R.forwardRef((({className:t,...n},r)=>e(ne.Root,{ref:r,className:Ne("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...n,children:e(ne.Indicator,{className:Ne("flex items-center justify-center text-current"),children:e(d,{className:"h-4 w-4"})})})));function gn({value:t,labelRenderer:r,fallbackLabel:s}){const[i,a]=A(s||t),[l,o]=A(!1);return D((()=>{if(!r)return void a(s||t);(async()=>{o(!0);try{const e=r(t);if(e instanceof Promise){const t=await e;a(t)}else a(e)}catch(e){console.error("Error rendering label:",e),a(s||t)}finally{o(!1)}})()}),[t,r,s]),l?e("span",{className:"text-muted-foreground",children:"Loading..."}):e(n,{children:i})}fn.displayName=ne.Root.displayName;const xn=({filterType:r,filterValues:s,setFilterValues:i,options:a,labelRenderer:l})=>{const[o,c]=A(!1),[d,u]=A(""),h=P(null),m=a?.filter((e=>!s.some((t=>t.value===e.value))));return t(Lt,{_open:o,onOpenChange:e=>{c(e),e||setTimeout((()=>{u("")}),200)},children:[e(Ot,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 transition text-muted hover:text-primary shrink-0",children:e("div",{className:"flex gap-1.5 items-center",children:1===s?.length?(()=>{const t=s[0];return e(gn,{value:t.value||"",labelRenderer:l,fallbackLabel:t.label})})():`${s?.length} selected`})}),e(St,{className:"w-[300px] p-0",children:e(mn,{children:t(Et,{children:[e(At,{placeholder:r,className:"h-9",value:d,onInputCapture:e=>{u(e.currentTarget.value)},ref:h}),t(Dt,{children:[e($t,{children:"No results found."}),e(Ft,{children:s.map((n=>t(Vt,{className:"group flex gap-2 items-center",onSelect:()=>{i(s.filter((e=>e.value!==n.value))),setTimeout((()=>{u("")}),200),c(!1)},children:[e(fn,{checked:!0}),e(gn,{value:n.value||"",labelRenderer:l,fallbackLabel:n.label})]},n.value)))}),m?.length>0&&t(n,{children:[e(jt,{}),e(Ft,{children:m.filter((e=>String(e.label||e.value).toLowerCase().includes(d.toLowerCase()))).map((n=>t(Vt,{className:"group flex gap-2 items-center",value:String(n.label||n.value),onSelect:()=>{i([...s,{value:n.value,label:n.label}]),setTimeout((()=>{u("")}),200),c(!1)},children:[e(fn,{checked:!1,className:"opacity-0 group-data-[selected=true]:opacity-100"}),e("span",{className:"text-muted",children:e(gn,{value:n.value||"",labelRenderer:n.labelRenderer||l,fallbackLabel:n.label})})]},n.value)))})]})]})]})})})]})},vn=({filterValues:n,setFilterValues:r})=>{const[s,i]=A(!1),a=n[0]?new Date(n[0]):void 0;return t(Lt,{_open:s,onOpenChange:i,children:[e(Ot,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center",children:a?ee(a).format("MMM D, YYYY"):e("span",{children:"Pick a date"})})}),e(St,{className:"w-auto p-0",align:"start",children:e(pn,{className:"p-0",value:a,onChange:e=>{if(e){const t=Array.isArray(e)?e[0]:e;t&&(r([ee(t).format("YYYY-MM-DD")]),i(!1))}}})})]})},bn=({filterType:n,filterValue:r,setFilterValue:s})=>{const[i,a]=A(!1),[l,o]=A(r);return t(Lt,{_open:i,onOpenChange:e=>{a(e),e||l===r||o(r)},children:[e(Ot,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center",children:r||"Enter text..."})}),e(St,{className:"w-[300px] p-3",children:t("div",{className:"flex flex-col gap-1",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:n})}),e(_t,{autoFocus:!0,type:"text",size:"sm",value:l,onChange:o,onKeyDown:e=>{"Enter"===e.key&&(s(l),a(!1))},placeholder:"Enter text..."}),e(Ze,{size:"sm",variant:"outline",onClick:()=>{s(l),a(!1)},children:"Apply"})]})})]})};function yn(t,n,r){switch(t.type){case"date":return e(vn,{filterValues:t.value.map((e=>e.value||"")),setFilterValues:e=>{n((n=>n.map((n=>n===t?{...n,value:e.length>0?[{value:e[0],label:ee(e[0]).format("LLL dd, y")}]:[]}:n))))}});case"text":return e(bn,{filterType:t.placeholder||t.name,filterValue:t.value[0]?.value||"",setFilterValue:e=>{n((n=>n.map((n=>n===t?{...n,value:[{value:e,label:e}]}:n))))}});default:{const s=r.find((e=>e.name===t.name));return e(xn,{filterType:t.placeholder||t.name,filterValues:t.value,setFilterValues:e=>{n((n=>n.map((n=>n===t?{...n,value:e}:n))))},options:s?.options||[],labelRenderer:s?.labelRenderer})}}}function Nn({filters:n,setFilters:r,filterGroups:s}){return e("div",{className:"flex gap-2 flex-wrap justify-start",children:n.filter((e=>e.value?.length>0)).map((n=>t("div",{className:"flex gap-[1px] items-center text-sm",children:[e("div",{className:"flex gap-1.5 shrink-0 rounded-l bg-muted p-1.5 h-8 items-center",children:n.placeholder||n.name}),yn(n,r,s),e(Ze,{variant:"ghost",size:"icon",onClick:()=>{r((e=>e.filter((e=>e!==n))))},className:"bg-muted rounded-l-none rounded-r-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0",children:e(f,{className:"size-6"})})]},n.name+"-"+("date"==n.type?"date":n.value.map((e=>e.value)).join(",")))))})}function wn({selectedView:n,textValue:r,setTextValue:s,setFilters:i,handleClose:a,filterGroups:l}){const o=()=>{i((e=>[...e,{name:n||"",placeholder:l.find((e=>e.name===n))?.placeholder,value:[{value:r,label:r}],type:"text"}])),a()};return t("div",{className:"p-2 flex flex-col gap-1",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:l.find((e=>e.name===n))?.placeholder})}),e(_t,{autoFocus:!0,type:"text",size:"sm",value:r,onChange:s,onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"Enter text..."}),e(Ze,{size:"sm",variant:"outline",onClick:o,disabled:!r.trim(),children:"Apply"})]})}function kn({selectedView:n,selectedDate:r,setSelectedDate:s,setFilters:i,filters:a,handleClose:l,filterGroups:o}){const[c,d]=A(!0);return t(Lt,{_open:c,onOpenChange:d,children:[e(Ot,{className:"w-full p-2 text-left hover:bg-muted/50 rounded-sm",children:e("div",{className:"flex gap-1.5 items-center",children:r?ee(r).format("MMM D, YYYY"):e("span",{children:"Pick a date"})})}),e(St,{className:"w-auto p-0",align:"start",children:e(te,{value:r,onChange:e=>{const t=Array.isArray(e)?e[0]:e;if(s(t||void 0),t){const e=o.find((e=>e.name===n)),r=new Date(t);r.setHours(0,0,0,0),i([...a,{name:n||"",placeholder:e?.placeholder,value:[{value:r.toISOString(),label:ee(r).format("LLL dd, y")}],type:e?.type||"date"}]),d(!1),l()}},calendarIcon:!1,className:"p-2"})})]})}function Cn({selectedView:r,commandInput:s,setFilters:i,handleClose:a,filterGroups:l}){if(!r)return null;const o=(e=>{const t=l.find((t=>t.name===e));if(!t)return[];let n=t.options||[];if(!s.trim())return n;if(t.filterBy){const e=s.toLowerCase();return n.filter((n=>{if(void 0===n.value)return!1;return t.filterBy(n.value,e)}))}const r=s.toLowerCase();return n.filter((e=>String(e.value||"").toLowerCase().includes(r)))})(r);if(0===o.length)return e($t,{children:"No matching options"});const c=l.find((e=>e.name===r))?.placeholder||l.find((e=>e.name===r))?.name;return t(n,{children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:c})}),o.map((t=>{const n=l.find((e=>e.name===r));return e(Vt,{className:"group flex gap-2 items-center w-full hover:bg-muted",onSelect:()=>{i((e=>{const s=e.findIndex((e=>e.name===r)),i={value:t.value,label:t.label};if(s>=0){const t=[...e];return t[s]={...t[s],value:[...t[s].value,i]},t}return[...e,{name:r||"",placeholder:n?.placeholder||"",value:[i],type:n?.type||"select"}]})),a()},children:e(gn,{value:t.value||"",labelRenderer:t.labelRenderer||n?.labelRenderer,fallbackLabel:t.label})},t.value||`option-${Math.random()}`)}))]})}function _n({filters:n,setFilters:r,filterGroups:s}){const[i,a]=S.useState(!1),[l,o]=S.useState(null),[c,d]=S.useState(""),u=S.useRef(null),[h,m]=S.useState(),[p,f]=S.useState(""),g=()=>{a(!1),setTimeout((()=>{o(null),d(""),m(void 0)}),200)},x=new URL(window.location.href).searchParams;return D((()=>{try{const e=new URLSearchParams(x.toString());if(n.length>0){const t=n.map((e=>{const t=Array.isArray(e.value)?e.value.map((e=>encodeURIComponent(e.value||""))).join(","):encodeURIComponent(e.value||"");return`${encodeURIComponent(e.name)}:${t}`})).join(";");e.set("filters",t)}else e.delete("filters");const t=`${window.location.pathname}?${e.toString()}`;window.history.replaceState({},"",t)}catch(e){console.error("Failed to update URL with filters:",e)}}),[n]),D((()=>{const e=x.get("filters");if(e)try{const t=e.split(";").map((e=>{const[t,n]=e.split(":"),r=decodeURIComponent(t),i=n.split(",").map((e=>decodeURIComponent(e))),a=s.find((e=>e.name===r));console.log("group",a);const l=i.map((e=>{if("text"===a?.type)return{value:e,label:e};{const t=a?.options?.find((t=>t.value===e));let n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):a?.labelRenderer&&(n=String(a.labelRenderer(e))),{value:e,label:n}}}));return console.log("valuesWithLabels",l),{name:r,type:a?.type||"select",placeholder:a?.placeholder,value:l}}));r(t)}catch(e){console.error("Failed to parse filters from URL:",e)}}),[]),t("div",{className:"flex gap-2 flex-wrap justify-start w-full items-center",children:[e("div",{className:"flex gap-2 items-center",children:t(Lt,{_open:i,onOpenChange:e=>{a(e),e||setTimeout((()=>{o(null),d(""),f("")}),200)},children:[e(Ot,{asChild:!0,children:t(Ze,{variant:"ghost",role:"combobox","aria-expanded":i,size:"md",className:Ne("transition group flex gap-1.5"),children:[e(w,{className:"size-4 shrink-0 transition-all text-muted"}),"Filter"]})}),e(St,{className:"w-[300px] p-0",align:"start",children:t(Et,{children:["select"===s.find((e=>e.name===l))?.type?e(At,{placeholder:l?`Filter by ${l}`:"Filter...",className:"h-9 ring-0",value:c,onValueChange:e=>{d(e)},ref:u,autoFocus:!0}):null,e(Dt,{className:"max-h-[300px] overflow-y-auto",children:e(Ft,{children:l?(()=>{if(!l)return null;const t=s.find((e=>e.name===l))?.type;switch(t){case"date":return e(kn,{selectedView:l,selectedDate:h,setSelectedDate:m,setFilters:r,filters:n,handleClose:g,filterGroups:s});case"text":return e(wn,{selectedView:l,textValue:p,setTextValue:f,setFilters:r,handleClose:g,filterGroups:s});default:return e(Cn,{selectedView:l,commandInput:c,setFilters:r,handleClose:g,filterGroups:s})}})():(()=>{let t=s.map((e=>({...e,options:(e.options??[]).filter((t=>!n.some((n=>"date"===n.type?n.name===e.name:n.name===e.name&&n.value.some((e=>e.value===t.value))))))}))).filter((e=>(e.options??[]).length>0||"date"===e.type&&!n.some((t=>t.name===e.name))||"text"===e.type&&!n.some((t=>t.name===e.name))));return 0===t.length?e($t,{children:"No available filters"}):t.map(((t,n)=>e(Vt,{onSelect:()=>{return e=t.name,o(e),d(""),void u.current?.focus();var e},className:"group flex gap-2 items-center hover:bg-muted",children:e("span",{children:t.placeholder??t.name})},n)))})()})})]})})]})}),e(Nn,{filters:n,setFilters:r,filterGroups:s}),n.filter((e=>e.value?.length>0)).length>0&&e((()=>e("div",{className:"flex gap-2 items-center",children:e(Ze,{variant:"outline",size:"xs",className:"transition group",onClick:()=>r([]),children:"Clear All"})})),{})]})}var zn;!function(e){e.IS="is",e.IS_NOT="is_not",e.CONTAINS="contains",e.BEFORE="before",e.AFTER="after",e.IS_ANY_OF="is_any_of"}(zn||(zn={}));const In=$((({className:t,level:n=3,...r},s)=>e(`h${n}`,{ref:s,className:Ne({h1:"text-2xl font-medium tracking-tight",h2:"text-xl font-medium tracking-tight",h3:"text-lg font-medium",h4:"text-base font-medium",h5:"text-sm font-medium",h6:"text-xs font-medium"}[`h${n}`],"mb-2",t),...r})));In.displayName="Heading";const Ln=r("text-foreground",{variants:{size:{xl:"text-base md:text-lg leading-relaxed",lg:"text-base leading-relaxed",default:"text-sm leading-normal",sm:"text-sm leading-normal",xs:"text-xs leading-normal"},weight:{normal:"font-normal",medium:"font-medium",semibold:"font-semibold"}},defaultVariants:{size:"default",weight:"normal"}}),Tn=$((({className:t,size:n,weight:r,...s},i)=>e("p",{ref:i,className:Ne(Ln({size:n,weight:r,className:t})),...s})));function On({title:n,content:r,onConfirm:s,onCancel:i,isOpen:a}){const l=P(null);return t(ht,{isOpen:a,onClose:i,description:"Confirm Modal",children:[t("div",{className:"sm:flex sm:items-start p-2",children:[e("div",{className:"mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10",children:e(k,{className:"size-6 text-red-600","aria-hidden":"true"})}),t("div",{className:"mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left",children:[e(mt,{className:"leading-6",show:!0,children:n}),e("div",{className:"mt-2",children:e("div",{className:"prose text-sm text-gray-500",children:r})})]})]}),t(ft,{align:"right",children:[e(Ze,{variant:"destructive",onClick:s,children:"Confirm"}),e(Ze,{variant:"outline",onClick:i,ref:l,children:"Cancel"})]})]})}function Rn(){return E(Sn)}Tn.displayName="Text";const Sn=M((()=>{})),Mn="--tailwind-portal";function En({children:t}){const n=P(null),[r,s]=A(null);return D((()=>{if(n.current){const e=n.current.ownerDocument;let t=e.getElementById(Mn);t||(t=e.createElement("DIV"),t.id=Mn,e.body.appendChild(t)),s(t)}}),[n.current]),r?U(t,r):e("span",{ref:n})}const Pn={success:I,error:z,warning:_,info:C},An={success:"text-green-600",error:"text-red-600",warning:"text-yellow-600",info:"text-blue-600"};function Dn({data:n,onClose:r}){const[s,i]=A(!0);D((()=>{let e;return n.duration&&(e=setTimeout((()=>{i(!1)}),n.duration)),()=>{e&&clearTimeout(e)}}),[]);const a=Pn[n.status]||C,l=An[n.status]||"text-blue-600";return e("div",{"aria-live":"assertive",className:"pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-100",children:e("div",{className:"flex w-full flex-col items-center space-y-4 sm:items-end",children:e(re,{appear:!0,show:s,as:F,afterLeave:r,enter:"transform ease-out duration-700 transition",enterFrom:"translate-y-0 opacity-0 sm:translate-y-0 sm:translate-x-2",enterTo:"translate-y-2 opacity-100 sm:translate-x-0",leave:"transition ease-in duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e("div",{className:"pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5",children:e("div",{className:"p-4",children:t("div",{className:"flex items-start",children:[e("div",{className:"shrink-0",children:e(a,{className:`size-6 ${l}`,"aria-hidden":"true"})}),t("div",{className:"ml-3 w-0 flex-1 pt-0.5",children:[e("p",{className:"text-sm font-medium text-gray-900",children:n.title}),e("p",{className:"mt-1 text-sm text-gray-500",children:n.description})]}),e("div",{className:"ml-4 flex shrink-0",children:t("button",{type:"button",className:"inline-flex rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-hidden focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",onClick:()=>i(!1),children:[e("span",{className:"sr-only",children:"Close"}),e(f,{className:"size-5","aria-hidden":"true"})]})})]})})})})})})}function $n({children:r}){const[s,i]=A(null),a=e=>{i(e)};return t(n,{children:[e(Sn.Provider,{value:a,children:r}),s&&e(En,{children:e(Dn,{data:s,onClose:()=>a(null)})})]})}function Fn({idToDelete:t,title:n,content:r,setIdToDelete:s,deleteApi:i}){const a=Rn();return e(On,{title:n,content:r,isOpen:!!t,onConfirm:async()=>{if(t)return i(t).then((()=>{a({title:"Delete succeeded",status:"success"})})).catch((e=>{a({title:"Failed to delete",description:e.message??"An error occurred while deleting the object",status:"error"})})).finally((()=>{s(void 0)}))},onCancel:()=>{s(void 0)}})}function jn({className:t}){return e("hr",{className:s("w-full h-0.5 border-t-0 bg-border",t)})}function Vn({trigger:n,children:r}){return t(se,{as:"div",className:"relative",children:[e(ie,{as:"span",className:"-m-1.5 flex items-center p-1.5",children:n}),e(re,{as:F,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:e(ae,{className:"absolute right-0 z-10 mt-2.5 w-48 origin-top-right rounded-md bg-white dark:bg-slate-900 dark:border-slate-800 dark:border py-2 shadow-lg ring-1 ring-gray-900/5 dark:ring-slate-200/5 focus:outline-hidden",children:r})})]})}function Bn({children:t,href:n="#",onClick:r,closeOnClick:i=!0,isDisabled:a=!1}){return e(le,{disabled:a,children:({active:l,close:o})=>e("a",{href:n,onClick:e=>{e.preventDefault(),e.stopPropagation(),r&&r(e),i&&o()},className:s(l?"bg-gray-50 dark:bg-slate-800":"",a?"opacity-50 cursor-not-allowed":"","block px-3 py-1 text-sm leading-6 text-gray-900 dark:text-gray-200"),children:t})})}function Un({items:n,value:r,onChange:i}){return e(oe,{value:r,onChange:i,children:({open:i})=>t("div",{className:"relative",children:[t("div",{className:"inline-flex divide-x divide-indigo-700 rounded-md shadow-2xs",children:[t("div",{className:"inline-flex items-center gap-x-1.5 rounded-l-md bg-indigo-600 px-3 py-2 text-white shadow-2xs",children:[r.name&&e(d,{className:"-ml-0.5 size-5","aria-hidden":"true"}),e("p",{className:"text-sm font-semibold",children:r.name||""})]}),t(ce,{className:"inline-flex items-center rounded-l-none rounded-r-md bg-indigo-600 p-2 hover:bg-indigo-700 focus:outline-hidden focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2 focus:ring-offset-gray-50",children:[e("span",{className:"sr-only",children:"Change selection"}),e(L,{className:"size-5 text-white","aria-hidden":"true"})]})]}),e(re,{show:i,as:F,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e(de,{className:"absolute right-0 z-10 mt-2 w-72 origin-top-right divide-y divide-gray-200 overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden",children:n.map((n=>e(ue,{className:({active:e})=>s(e?"bg-indigo-600 text-white":"text-gray-900","cursor-default select-none p-4 text-sm"),value:n,children:({selected:r,active:i})=>t("div",{className:"flex flex-col",children:[t("div",{className:"flex justify-between",children:[e("p",{className:r?"font-semibold":"font-normal",children:n.name}),r?e("span",{className:i?"text-white":"text-indigo-600",children:e(d,{className:"size-5","aria-hidden":"true"})}):null]}),e("p",{className:s(i?"text-indigo-200":"text-gray-500","mt-2"),children:n.description})]})},n.id)))})})]})})}function Wn({size:r,className:i}){const a=function(e){switch(e){case"xs":return"size-2";case"sm":return"size-3";case"md":return"size-4";case"lg":return"size-5";case"xl":return"size-7";case"2xl":return"size-10";default:throw new Error("Unexpected size: "+e)}}(r||"md");return e(n,{children:t("svg",{className:s("animate-[spin_0.8s_linear_infinite] text-indigo-500",a,i),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})}const Gn={primary:"shadow-2xs bg-indigo-600 text-white hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600",secondary:"shadow-2xs bg-white text-gray-900 hover:bg-gray-50 ring-1 ring-inset ring-gray-300",soft:"shadow-2xs bg-indigo-50 text-indigo-600 hover:bg-indigo-100",ghost:"text-indigo-600 hover:bg-indigo-100 dark:text-indigo-400 dark:hover:bg-indigo-900",unstyled:""},Hn={primary:"text-white",secondary:"text-indigo-500",soft:"text-indigo-600",ghost:"text-indigo-600",unstyled:"text-gray-600"};function Yn({title:n,className:r,type:i="button",children:a,size:l,onClick:o,variant:c="primary",isLoading:d=!1,isDisabled:u=!1}){const h=function(e){switch(e){case"xs":return"rounded-xs px-2 py-1 text-xs gap-x-1";case"sm":return"rounded-xs px-2 py-1 text-sm gap-x-1";case"md":return"rounded-md px-2.5 py-1.5 text-sm gap-x-1.5";case"lg":return"rounded-md px-3 py-2 text-sm gap-x-1.5";case"xl":return"rounded-md px-3.5 py-2.5 text-sm gap-x-2";default:throw new Error("Unexpected size: "+e)}}(l||"md");return t("button",{title:n,disabled:u||d,onClick:o,type:i,className:s("whitespace-nowrap inline-flex items-center justify-center font-semibold hover:cursor-pointer",Gn[c],h,u&&"cursor-not-allowed text-gray-300!",r),children:[d&&e(Wn,{className:Hn[c],size:l}),a]})}function Kn({buttonLabel:n,title:r,children:s,onClick:i}){return t("div",{className:"text-center py-12",children:[e("svg",{className:"mx-auto h-12 w-12 text-gray-400 dark:text-gray-200",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:e("path",{vectorEffect:"non-scaling-stroke",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"})}),e("h3",{className:"mt-2 text-sm font-semibold text-gray-500",children:r}),e("p",{className:"mt-1 text-sm text-gray-500",children:s}),e("div",{className:"mt-6",children:t(Yn,{onClick:i,size:"lg",children:[e(T,{className:"-ml-0.5 mr-1.5 size-5","aria-hidden":"true"}),n]})})]})}function Zn({children:n,onUpload:r}){const s=P(null);return t("label",{style:{cursor:"pointer"},children:[n,e("input",{ref:s,type:"file",style:{display:"none"},onChange:()=>{s.current?.files&&r(function(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}(s.current.files))}})]})}function qn({onUpload:n}){const r=Xn({onUpload:n});return e("div",{...r,className:"flex items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600",children:t("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-full",children:[t("div",{className:"flex flex-col items-center justify-center pt-5 pb-6",children:[e("svg",{className:"w-8 h-8 mb-4 text-gray-500 dark:text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16",children:e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})}),t("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[e("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),e("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),e("input",{id:"dropzone-file",type:"file",className:"hidden"})]})})}function Xn({onUpload:e,dragOverClass:t="is-drag-over-on",dropEffect:n="copy"}){const r=P(null);return{onDrop:n=>{n.preventDefault(),delete r.current.__dragOver_cnt__,r.current?.classList.remove(t);const s=n.dataTransfer.items;if(s){const t=[],n=(e,t="")=>new Promise((r=>{if(e.isFile)e.file((e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])}));else if(e.isDirectory){const s=e.createReader(),i=[],a=()=>{s.readEntries((s=>{if(s.length){for(const r of s)i.push(n(r,t+e.name+"/"));a()}else Promise.all(i).then((e=>r(e.flat())))}))};a()}}));for(let e=0;e<s.length;e++){const r=s[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then((t=>{const n=t.flat();n.length&&e(n)}))}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{(function(e){let t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t})(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{(function(e){let t=e.__dragOver_cnt__;return!!t&&(e.__dragOver_cnt__=t-1,1===t)})(r.current)&&r.current?.classList.remove(t)},ref:r}}function Jn({description:n,required:r,label:i,className:a,direction:l="column",children:o}){return t("div",{className:s("flex w-full space-y-1",a,"row"===l?"flex-row justify-between":"flex-col"),children:[t("div",{className:"flex items-center gap-1",children:[t("label",{className:"text-sm font-medium mb-1",children:[i,r?e("span",{className:"text-destructive -mt-4 ml-1",children:"*"}):""]}),n&&e("div",{className:"mx-2 flex w-4 items-center",children:e(tn,{description:n,children:e(C,{className:"size-3 text-muted"})})})]}),o]})}const Qn="rounded-md text-sm flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",er={INPUT_UNSTYLED:"block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent",INPUT_NO_PADDING:Qn,INPUT:Qn+" py-1.5"};function tr({value:n=[],onChange:r,className:i,delimiters:a=", ",placeholder:l}){const[o,c]=A("");return t("div",{className:s(i,"w-full space-x-1 space-y-1 p-2",er.INPUT),children:[n&&n.length>0&&n.map(((t,s)=>e(ke,{variant:"secondary",onClick:()=>(e=>{n&&n.length>0&&(n.splice(e,1),r([...n]))})(s),style:{whiteSpace:"nowrap"},className:"cursor-pointer",children:t},s))),e("div",{children:e(_t,{clearable:!1,className:"placeholder:text-muted-foreground px-1",variant:"unstyled",type:"text",value:o,onBlur:e=>{const t=e.target.value;t&&t.trim()&&(r([...n,t.trim()]),c(""))},onKeyDown:e=>{const t=e.target.value,s=!t.trim(),i=e.key;"Enter"===i||a.indexOf(i)>-1?(e.preventDefault(),n&&!s&&(r([...n,t.trim()]),c(""))):"Backspace"===i&&s&&n&&n.length>0&&(n.pop(),r([...n]))},onChange:c,placeholder:n&&0!==n.length?"":l})})]})}function nr({underline:t="always",className:n,children:r,...i}){let a;return"always"===t?a="underline":"hover"===t&&(a="hover:underline"),e("a",{className:s("text-indigo-800 dark:text-indigo-300",n,a),...i,children:r})}function rr({className:t,children:n}){return e("ul",{className:`${t} space-y-1 flex flex-col items-start dark:px-2`,children:n})}const sr=$((function(t,n){const{current:r,children:i,className:a,href:l="#",onClick:o,...c}=t;return e("li",{className:s(a,r?"bg-gray-50 text-indigo-600":"text-gray-700 dark:dark:text-slate-300 hover:text-indigo-600 hover:bg-gray-50 dark:hover:bg-slate-800 dark:hover:text-slate-50 dark:border dark:border-transparent dark:hover:border-slate-50","w-full rounded-md p-2 pl-3 text-sm leading-6 font-semibold"),children:e("a",{ref:n,href:l,onClick:e=>{o?(e.preventDefault(),o(e)):"#"===l&&e.preventDefault()},className:"w-full flex items-center gap-x-3",...c,children:i})})}));function ir({icon:n,status:r,title:s,children:i,className:a}){let l,o,c,d;switch(r){case"error":l=e(z,{className:"size-5 text-destructive","aria-hidden":"true"}),o="",c="text-foreground",d="bg-destructive border border-destructive";break;case"warning":l=e(_,{className:"size-5 text-attention","aria-hidden":"true"}),o="",c="text-foreground",d="bg-attention border border-attention";break;case"success":l=e(I,{className:"size-5 text-success","aria-hidden":"true"}),o="",c="text-foreground",d="bg-success border border-success";break;case"info":l=e(C,{className:"size-5 text-info","aria-hidden":"true"}),o="",c="text-foreground",d="bg-info border border-info";break;case"default":l=e(C,{className:"size-5 text-muted","aria-hidden":"true"}),o="",c="text-foreground",d="bg-muted border border-muted";break;case"done":l=e(C,{className:"size-5 text-done","aria-hidden":"true"}),o="",c="text-foreground",d="bg-done border border-done"}return e("div",{className:`rounded-md p-4 ${d} ${a}`,children:t("div",{className:"flex",children:[e("div",{className:"shrink-0",children:n??l}),t("div",{className:"w-full ml-2 px-1",children:[s&&e("h3",{className:`text-sm font-medium mb-2 ${o}`,children:s}),e("div",{className:`text-sm ${c} break-words`,children:i})]})]})})}function ar({title:t,className:n,children:r}){return e(ir,{status:"error",title:t,className:n,children:e("pre",{children:r})})}function lr({title:t,className:n,children:r}){return e(ir,{status:"info",title:t,className:n,children:r})}function or({title:t,className:n,children:r}){return e(ir,{status:"warning",title:t,className:n,children:r})}function cr({title:t,className:n,children:r}){return e(ir,{status:"success",title:t,className:n,children:r})}function dr({title:t,className:n,children:r}){return e(ir,{status:"default",title:t,className:n,children:r})}function ur({className:n,children:r,isOpen:i,onClose:a,noCloseButton:l=!1,allowOverflow:o=!1,disableCloseOnClickOutside:c=!1}){return e(re,{show:i,as:F,children:t(he,{style:{zIndex:50},as:"div",className:"relative",onClose:c?()=>{}:e=>{e||a()},children:[e(me,{as:F,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",unmount:!0,children:e("div",{className:"fixed inset-0 bg-gray-500 dark:bg-slate-800 dark:opacity-75 opacity-75 transition-opacity"})}),e("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:e("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:e(me,{as:F,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:t(pe,{className:s("p-0! relative transform rounded-lg bg-white dark:bg-slate-900 text-left dark:text-slate-100 shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-md sm:p-6",o?"overflow-visible":"overflow-hidden",n),children:[!l&&e(hr,{onClose:a}),r]})})})})]})})}function hr({onClose:n}){return e("div",{className:"absolute right-0 top-0 hidden pr-4 pt-4 sm:block",children:t("button",{tabIndex:-1,type:"button",className:"rounded-md bg-white text-gray-400 dark:text-slate-200 dark:bg-slate-800 hover:brightness-95 focus:outline-hidden focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 hover:cursor-pointer",onClick:n,children:[e("span",{className:"sr-only",children:"Close"}),e(f,{className:"size-6","aria-hidden":"true"})]})})}function mr({children:t,showDivider:n=!1}){return e("div",{className:n?"border-b-solid border-b border-b-1":"",children:e(fe,{as:"h3",className:"py-4 pl-4 pr-8 text-base font-semibold leading-6 text-gray-900 dark:text-slate-50",children:t})})}function pr({children:t,className:n="justify-end",fill:r=!1}){return e("div",{className:s("w-full flex space-x-2 p-4 border-t-solid border-t-gray-100 dark:border-t-gray-800 border-t",n||"justify-end",r?"bg-gray-100 dark:bg-slate-800":""),children:t})}function fr({children:t,className:n=""}){return e("div",{className:s("p-4",n),children:t})}function gr(e){return null==e||isNaN(e)?"":e.toString()}rr.Item=sr;const xr=S.forwardRef((({value:t,onChange:n,className:r,noScroll:i=!1,noSpinners:a=!1,...l},o)=>{const[c,d]=S.useState(gr(t));return D((()=>{if(null==t||!isNaN(t)){const e=gr(t);d(e)}}),[t]),e("input",{onWheel:i?e=>{e.target.blur()}:l.onWheel,type:"number",value:c,onChange:e=>{const t=e.target.value;if(d(t),""===t)n&&n(void 0,t);else{const e=parseFloat(t);n&&n(e,t)}},className:s(r,er.INPUT,{"no-spinners":a},a&&"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"),ref:o,...l})}));class vr{renderOption(e){return this.labelOf(e)}findById(e,t){return e.find((e=>this.idOf(e)===t))}}function br({checkColor:t,cols:n="grid-cols-1",gap:r="gap-2",value:i,onChange:a,options:l,checkIcon:o=Nr,adapter:c}){const[d,u]=A(i),h=e=>{u(e),a(e)},m=d?c.idOf(d):void 0;return e("div",{className:s("grid",n,r),children:l.map((n=>{const r=c.idOf(n);return e(yr,{checkColor:t,isSelected:r===m,option:n,adapter:c,onSelect:h,CheckIcon:o},r)}))})}function yr({checkColor:n,CheckIcon:r,adapter:s,isSelected:i,option:a,onSelect:l}){const[o,c]=A(!1);return t("div",{className:"flex gap-1 cursor-pointer items-center",onClick:()=>l(a),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[e("div",{className:"",children:e(r,{size:24,isChecked:i,isHighlighted:o,color:n})}),e("div",{children:s.renderOption(a)})]})}function Nr({size:t,isChecked:n,isHighlighted:r,color:s="currentColor"}){const i=r?1:.6;return e("svg",n?{width:`${t}px`,height:`${t}px`,viewBox:"0 0 24 24",version:"1.1",children:e("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:e("g",{id:"ic_fluent_checkbox_checked_24_regular",fill:s,fillRule:"nonzero",opacity:i,children:e("path",{d:"M18.25,3 C19.7687831,3 21,4.23121694 21,5.75 L21,18.25 C21,19.7687831 19.7687831,21 18.25,21 L5.75,21 C4.23121694,21 3,19.7687831 3,18.25 L3,5.75 C3,4.23121694 4.23121694,3 5.75,3 L18.25,3 Z M18.25,4.5 L5.75,4.5 C5.05964406,4.5 4.5,5.05964406 4.5,5.75 L4.5,18.25 C4.5,18.9403559 5.05964406,19.5 5.75,19.5 L18.25,19.5 C18.9403559,19.5 19.5,18.9403559 19.5,18.25 L19.5,5.75 C19.5,5.05964406 18.9403559,4.5 18.25,4.5 Z M10,14.4393398 L16.4696699,7.96966991 C16.7625631,7.6767767 17.2374369,7.6767767 17.5303301,7.96966991 C17.7965966,8.23593648 17.8208027,8.65260016 17.6029482,8.94621165 L17.5303301,9.03033009 L10.5303301,16.0303301 C10.2640635,16.2965966 9.84739984,16.3208027 9.55378835,16.1029482 L9.46966991,16.0303301 L6.46966991,13.0303301 C6.1767767,12.7374369 6.1767767,12.2625631 6.46966991,11.9696699 C6.73593648,11.7034034 7.15260016,11.6791973 7.44621165,11.8970518 L7.53033009,11.9696699 L10,14.4393398 L16.4696699,7.96966991 L10,14.4393398 Z"})})})}:{width:`${t}px`,height:`${t}px`,viewBox:"0 0 24 24",version:"1.1",children:e("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:e("g",{id:"ic_fluent_checkbox_unchecked_24_regular",fill:s,fillRule:"nonzero",opacity:i,children:e("path",{d:"M5.75,3 L18.25,3 C19.7687831,3 21,4.23121694 21,5.75 L21,18.25 C21,19.7687831 19.7687831,21 18.25,21 L5.75,21 C4.23121694,21 3,19.7687831 3,18.25 L3,5.75 C3,4.23121694 4.23121694,3 5.75,3 Z M5.75,4.5 C5.05964406,4.5 4.5,5.05964406 4.5,5.75 L4.5,18.25 C4.5,18.9403559 5.05964406,19.5 5.75,19.5 L18.25,19.5 C18.9403559,19.5 19.5,18.9403559 19.5,18.25 L19.5,5.75 C19.5,5.05964406 18.9403559,4.5 18.25,4.5 L5.75,4.5 Z"})})})})}function wr({clearTitle:n,ClearIcon:r=f,showFilter:s,filterBy:i,isClearable:a,disabled:l,by:o,options:c,value:d,onChange:u,className:h,addNew:m,addNewLabel:p,placeholder:g,optionLabel:x=e=>String(e),label:v}){const[b,y]=A(),N=P(null),[w,k]=A();D((()=>{if(N.current){const e=new ResizeObserver((e=>{k(e[0].contentRect.width)}));return e.observe(N.current),()=>e.disconnect()}}),[]);const C=e=>{e.preventDefault(),e.stopPropagation(),a&&u(void 0)},_=e=>{y(e.target.value)};let z=c||[];if(void 0===s&&(s=z?.length>=10),s&&b){const e=b.toLowerCase(),t=function(e){return e?"string"==typeof e?t=>String(t[e]).toLowerCase():e:e=>String(e).toLowerCase()}(i);z=z.filter((n=>t(n).includes(e)))}const I=e=>{"Escape"!==e.key&&"Enter"!==e.key&&"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&e.stopPropagation()};return e(oe,{value:d||null,onChange:u,by:o,disabled:l,children:()=>e("div",{className:"overflow-y-visible "+h,children:t("div",{className:"relative",children:[t(ce,{ref:N,className:"relative w-full cursor-default rounded-md bg-white py-1.5 text-left text-gray-900 shadow-2xs ring-1 ring-inset ring-gray-300 focus:outline-hidden focus:ring-2 focus:ring-indigo-600 dark:ring-slate-600 dark:text-slate-50 dark:bg-slate-800 sm:text-sm sm:leading-6 hover:cursor-pointer",children:[v&&e("div",{className:"w-full text-gray-500 text-left px-2",children:v}),e("span",{className:"block truncate pl-3 pr-14",children:d?x(d):g}),a&&null!=d&&e("span",{className:"absolute inset-y-0 right-0 mr-5 flex items-center pr-2",onClick:C,children:e(r,{title:n,className:"size-5 text-gray-400 hover:text-red-500 cursor-pointer","aria-hidden":"true"})}),!l&&e("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:e(O,{className:"size-5 text-gray-400","aria-hidden":"true"})})]}),t(de,{anchor:"bottom",style:{width:w,zIndex:1e8},className:"absolute z-10 mt-1 overflow-auto rounded-md bg-white dark:ring-slate-600 dark:text-slate-50 dark:bg-slate-800 py-1 text-base shadow-lg ring-1 ring-gray-300 ring-opacity-5 focus:outline-hidden sm:text-sm",children:[s&&e("div",{className:"p-1",children:e("input",{type:"text",value:b||"",onKeyDown:I,onChange:_,className:"w-full p-1 border border-gray-300 rounded-md dark:bg-slate-700 dark:text-slate-50",placeholder:"Filter..."})}),e("div",{className:"overflow-y-auto max-h-60",children:z.map(((t,n)=>e(kr,{option:t,optionLabel:x,className:"hover:cursor-pointer"},n)))}),m&&e(Ie,{className:"font-semibold py-2 border-t",children:e(Yn,{variant:"secondary",onClick:m,children:p})})]})]})})})}function kr({option:r,optionLabel:i,onClick:a,className:l}){return e(ue,{className:({active:e})=>s(e?"bg-indigo-600 text-white dark:bg-indigo-800 dark:text-white":"text-gray-900 dark:text-slate-50","relative cursor-default select-none py-2 pl-3 pr-9",l),value:r,onClick:a,children:({selected:a,active:l})=>t(n,{children:[e("div",{className:s(a?"font-semibold":"font-inherit","block truncate"),children:i(r)}),a?e("div",{className:s(l?"text-white":"text-indigo-600","absolute inset-y-0 right-0 flex items-center pr-4"),children:e(d,{className:"size-5","aria-hidden":"true"})}):null]})})}function Cr(t,n){return{label:String(t),check:e(n?d:"div",{className:"size-4"}),reverse:!1,className:"flex-1 px-2 py-2 hover:bg-accent nowrap"}}function _r({value:t,options:n,onChange:r,className:i,optionLayout:a,by:l,noCheck:o}){const[c,d]=A(t),u=e=>{d(e),r(e)},h=j((()=>"string"==typeof l?(e,t)=>e[l]===t[l]:l||((e,t)=>e===t)),[l]);return e("div",{className:s("",i),children:n.map(((t,n)=>{const r=!!c&&h(c,t);let s;return a?(s=a(t,r),s=Object.assign(Cr(t,r),s)):s=Cr(t,r),e(zr,{option:t,onSelect:u,layout:s,noCheck:o},n)}))})}function zr({option:n,onSelect:r,layout:i,noCheck:a}){return t("div",{className:s("group flex items-center cursor-pointer gap-x-2 hover:bg-muted",i.reverse&&"flex-row-reverse",i.className),onClick:()=>r(n),children:[a?null:e("div",{className:"",children:i.check}),e("div",{className:"flex-1",children:i.label})]})}function Ir({onSelect:r,selected:i,options:a}){return t(ge,{value:i,onChange:r,children:[e(ge.Label,{className:"sr-only",children:"Server size"}),e("div",{className:"space-y-4",children:a.map((r=>e(ge.Option,{value:r,className:({active:e})=>s(e?"border-border ring-2 ring-ring":"border-border","relative block cursor-pointer rounded-lg border bg-accent px-6 py-4 shadow-2xs focus:outline-hidden sm:flex sm:justify-between"),children:({active:i,checked:a})=>t(n,{children:[e("span",{className:"flex items-center",children:t("span",{className:"flex flex-col text-sm",children:[e(ge.Label,{as:"span",className:"font-medium text-text",children:r.label}),r.description&&e(ge.Description,{as:"span",className:"text-muted-foreground",children:r.description})]})}),e("span",{className:s(i?"border":"border-2",a?"border-accent-foreground":"border-transparent","pointer-events-none absolute -inset-px rounded-lg"),"aria-hidden":"true"})]})},r.id)))})]})}function Lr({isOpen:n,title:r,onClose:s,children:i}){const[a,l]=A(768);return e(re,{show:n,as:F,children:t(he,{as:"div",className:"relative z-10",onClose:s,children:[e("div",{className:"fixed inset-0"}),e("div",{className:"fixed inset-0 overflow-hidden",children:e("div",{className:"absolute inset-0 overflow-hidden",children:e("div",{className:"pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10 sm:pl-16",children:e(me,{as:F,enter:"transform transition ease-in-out duration-500 sm:duration-700",enterFrom:"translate-x-full",enterTo:"translate-x-0",leave:"transform transition ease-in-out duration-500 sm:duration-700",leaveFrom:"translate-x-0",leaveTo:"translate-x-full",unmount:!0,children:e(pe,{className:"pointer-events-auto border-l",style:{width:`${a}px`},children:t("div",{className:"relative flex h-full",children:[e("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-indigo-500 transition-colors",onMouseDown:e=>{e.preventDefault();let t=!0;const n=e.pageX,r=a,s=e=>{if(t){const t=n-e.pageX,s=Math.max(r+t,480);l(s)}},i=()=>{t=!1,document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",i)}}),t("div",{className:"flex-1 flex flex-col overflow-y-scroll gap-4 bg-background py-6 shadow-xl",children:[e("div",{className:"px-4 sm:px-6",children:t("div",{className:"flex items-start justify-between",children:[e(fe,{className:"w-full text-base font-semibold leading-6",children:e("div",{className:"text-2xl",children:r??""})}),e("div",{className:"ml-3 flex h-7 items-center",children:e(Tr,{onClose:s})})]})}),e("div",{className:"px-4 sm:px-6",children:i})]})]})})})})})})]})})}function Tr({onClose:t}){return e(Ze,{alt:"Close panel",variant:"ghost",onClick:t,children:e(f,{className:"size-6","aria-hidden":"true"})})}const Or={sm:["h-5 w-8","size-3","translate-x-4"],md:["h-6 w-11","size-4","translate-x-6"],lg:["h-8 w-16","size-6","translate-x-9"]};function Rr({value:n,onChange:r,size:s="md",children:i,className:a}){const l=Or[s];return t(xe,{checked:n,onChange:()=>r(!n),className:`flex items-center ${a} hover:cursor-pointer`,children:[e("div",{className:`${n?"bg-primary":"bg-muted"} relative inline-flex ${l[0]} items-center rounded-full`,children:e("span",{className:`${n?l[2]:"translate-x-1"} inline-block ${l[1]} transform rounded-full bg-white transition`})}),i&&e("span",{className:"px-2",children:i})]})}function Sr({className:t,children:n,...r}){return e("table",{className:s("\ndivide-y divide-border\n[&>tbody]:divide-y [&>tbody]:divide-border\n[&_th]:text-left [&_th]:px-3 [&_th]:py-3.5 [&_th]:text-sm [&_th]:font-normal [&_th]:text-muted-foreground\n[&_td]:px-3 [&_td]:py-4 [&_td]:text-sm\n",t),...r,children:n})}function Mr({columns:t}){return e("tr",{className:"hover:bg-muted",children:Array(t).fill(0).map(((t,n)=>e("td",{children:e("div",{className:"animate-pulse rounded-xs h-5 bg-gray-200 dark:bg-gray-600"})},n)))})}function Er({isLoading:t=!1,columns:n,rows:r=3,children:s}){return e("tbody",{children:t?Array(r).fill(0).map(((t,r)=>e(Mr,{columns:n},r))):s})}function Pr({className:t,children:n,...r}){return e("tr",{className:s("hover:bg-muted hover:cursor-pointer",t),...r,children:n})}function Ar(){return E(Dr)}const Dr=M({});function $r(e,t){const n="function"==typeof t?t():t;let r=null;const s=[];for(const t of e){const e={...t};e.current=!1,s.push(e),e.name===n&&(r=e)}return r||(r=s[0]),r.current=!0,s}function Fr({current:t,onSelect:n,tabs:r,children:s,navigate:i}){const[a,l]=A([]);D((()=>{l($r(r,t))}),[t,r]);const o={tabs:a,select:e=>{n&&!1===n(e)||(e.href?i?i(e.href):window.location.href=e.href:l([...$r(a,e.name)]))}};return e(Dr.Provider,{value:o,children:e("div",{className:"flex flex-col h-full",children:s})})}function jr({actions:n,className:r}){const{tabs:i,select:a}=Ar();return t("div",{className:"border-b flex items-start justify-between",children:[e("nav",{className:"flex space-x-4 px-4","aria-label":"Tabs",children:i.map((t=>{const n=t.disabled?"cursor-not-allowed":"cursor-pointer";return e("a",{href:t.href||"#"+t.name,onClick:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),!t.disabled&&a(t)})(e,t),className:s(t.current?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-50":"border-transparent text-gray-500 dark:text-slate-300 hover:border-slate-400 hover:text-gray-700 dark:hover:border-slate-200 dark:hover:text-gray-200 ",r,"whitespace-nowrap border-b-2 py-2 px-1 text-sm font-medium",n),"aria-current":t.current?"page":void 0,children:t.label},t.name)}))}),e("div",{className:"flex gap-x-1",children:n})]})}function Vr({}){const{tabs:t}=Ar(),n=t.find((e=>e.current))?.content;if(!n)return null;if(V(n))return e("div",{className:"h-full overflow-y-auto flex-1",children:n});return e("div",{className:"h-full overflow-y-auto flex-1",children:e(n,{})})}const Br=S.forwardRef((({unstyled:t,value:n,onChange:r,className:i,...a},l)=>{const[o,c]=A(n||"");return e("textarea",{ref:l,...a,className:s("w-full",t?er.INPUT_UNSTYLED:er.INPUT,i),value:o,onChange:e=>{const t=e.target.value;c(t),r&&r(t)}})}));class Ur{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(const t of this.watchers)t(e)}}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter((t=>t!==e))}}}function Wr(e){const t=S.createContext(void 0);return e.Context=t,t.Provider}class Gr{consume=void 0;_current;constructor(e){this._current=e}set current(e){e!==this._current&&(this._current=e,this.consume?.(e))}get current(){return this._current}withConsumer(e){return this.consume=e,e&&e(this.current),this}}function Hr(e){const t=e.Context;if(!t)throw new Error("Context not defined for "+e.name);return E(t)}function Yr(e){const[t,n]=A(e.value);return D((()=>e.watch((e=>{n("function"==typeof e?()=>e:e)}))),[e]),t}function Kr(e,t){return D((()=>(e.value=t,()=>{e.value=void 0})),[e,t]),t}function Zr(e,t){D((()=>e.watch(t)),[e,t])}function qr(e){const[t,n]=A(e.current);return D((()=>(e.withConsumer(n),()=>{e.withConsumer(void 0)})),[e]),t}function Xr(e,t){D((()=>(e.withConsumer(t),()=>{e.withConsumer(void 0)})),[e,t])}function Jr(e,t){D((()=>(e.current=t,()=>{e.current=void 0})),[e,t])}class Qr{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(const t of this.watchers)t(e)}}addWatcher(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter((t=>t!==e))}}}function es(e){const[t,n]=A(e.value);return D((()=>e.addWatcher((e=>{n("function"==typeof e?()=>e:e)}))),[e]),t}function ts(e,t){const n=P(null);return D((()=>{const r=r=>{n.current&&!n.current.contains(r.target)&&(t&&t(r)||e(r))};return window.setTimeout((()=>{document.addEventListener("click",r)}),0),()=>{document.removeEventListener("click",r)}}),[]),n}function ns(){const[e,t]=A(null);return[e,async e=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(e),t(e),!0}catch(e){return console.warn("Copy failed",e),t(null),!1}}]}function rs(e){D((()=>{const t=window.matchMedia("(prefers-color-scheme: dark)"),n=t=>e(t.matches);return t.addEventListener("change",n),e(t.matches),()=>t.removeEventListener("change",n)}),[])}function ss(e,t){const[n,r]=A(e);return D((()=>{const n=setTimeout((()=>{r(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n}function is(e,t,n){const r=[],s=new EventSource(e);return s.addEventListener("message",(e=>{const n=JSON.parse(e.data);n&&(r.push(n),t(r.join("")))})),s.addEventListener("close",(e=>{s.close();const t=JSON.parse(e.data);n(t)})),()=>{s.close()}}function as(e,t,n){D((()=>{"function"==typeof e?e().then((e=>is(e,t,n))):is(e,t,n)}),[e])}function ls(e,t){Array.isArray(t)&&(t={deps:t});const n=t||{},[r,s]=A(null),[i,a]=A(!1),[l,o]=A(n.defaultValue),c=()=>(n.start&&n.start(),a(!0),e().then((e=>{o(e),n.onSuccess&&n.onSuccess(e)})).catch((e=>{s(e),n.onError&&n.onError(e)})).finally((()=>{a(!1),n.end&&n.end()})));return D((()=>{n.condition&&!n.condition()||c()}),n.deps),{data:l,isLoading:i,error:r,setData:o,refetch:c}}function os(e,t){return!t||Array.isArray(t)?t={deps:[]}:t&&(t.deps=[]),ls(e,t)}function cs(e=!1){const[t,n]=A(e);return{isOn:t,isOff:!t,set:e=>n(e),on:()=>n(!0),off:()=>n(!1),toggle:()=>n(!t)}}function ds(e,t,n={}){D((()=>{const r=new IntersectionObserver((e=>{const r=e[0].isIntersecting;n.leave?r||t(e[0]):r&&t(e[0])}),{threshold:n.threshold||1});return e.current&&r.observe(e.current),()=>{e.current&&r.unobserve(e.current)}}),n.deps?n.deps.concat(e):[e])}function us(){const e=P(!0);return D((t=>(t&&e.current&&t(),e.current=!1,()=>{e.current=!0})),[]),e.current}const hs="undefined"!=typeof window?B:D;class ms{state;constructor(e){this.state=e}get(){return this.state[0]}set(e){this.state[1](e)}}function ps(e){const t=A(e);return new ms(t)}function fs(...e){return a(i(e))}export{mn as AnimateChangeInHeight,be as Avatar,ke as Badge,sn as Breadcrumbs,Ze as Button,nt as Card,at as CardContent,it as CardDescription,lt as CardFooter,rt as CardHeader,st as CardTitle,Ie as Center,fn as Checkbox,Be as ComboBox,Et as Command,Pt as CommandDialog,$t as CommandEmpty,Ft as CommandGroup,At as CommandInput,Vt as CommandItem,Dt as CommandList,jt as CommandSeparator,Bt as CommandShortcut,On as ConfirmModal,qe as CopyButton,Ae as DOMPopup,vn as DateCombobox,dr as DefaultBox,Fn as DeleteModal,gt as Dialog,bt as DialogClose,Nt as DialogContent,wt as DialogDescription,yt as DialogOverlay,vt as DialogPortal,kt as DialogTitle,xt as DialogTrigger,jn as Divider,ze as DotBadge,qn as DropZone,Vn as Dropdown,Un as DropdownList,Kn as EmptyCollection,ar as ErrorBox,Zn as FileUploadInput,_n as FilterBar,zn as FilterOperator,Jn as FormItem,In as Heading,lr as InfoBox,_t as Input,tr as InputList,rn as Label,nr as Link,kr as ListOption,Bn as MenuItem,rr as MenuList,ir as MessageBox,ur as Modal,fr as ModalBody,ut as ModalContextProvider,pr as ModalFooter,mr as ModalTitle,tt as ModeToggle,xr as NumberInput,$e as OptionAdapter,Lt as Popover,Rt as PopoverAnchor,Mt as PopoverClose,St as PopoverContent,Ot as PopoverTrigger,De as Popup,Me as PopupController,En as Portal,Ur as Property,br as RadioGroup,vr as RadioOptionAdapter,Mr as RowSkeleton,wr as SelectBox,_r as SelectList,Ir as SelectStack,xn as SelectionCombobox,zt as Separator,Qr as SharedState,ms as SharedValue,Lr as SidePanel,Gr as Slot,Wn as Spinner,Fe as StringOptionAdapter,je as StringOptionAdapterWithCreate,er as Styles,cr as SuccessBox,ye as SvgAvatar,Rr as Switch,Er as TBody,Pr as TR,Sr as Table,Fr as Tabs,jr as TabsBar,qt as TabsContent,Dr as TabsContext,Kt as TabsList,Vr as TabsPanel,Zt as TabsTrigger,Tn as Text,bn as TextCombobox,Br as Textarea,Je as ThemeProvider,Sn as ToastContext,$n as ToastProvider,Jt as Tooltip,en as TooltipContent,Xt as TooltipProvider,Qt as TooltipTrigger,ht as VModal,pt as VModalBody,ft as VModalFooter,mt as VModalTitle,Ut as VSelectBox,Gt as VTabs,Ht as VTabsBar,Yt as VTabsPanel,tn as VTooltip,or as WarningBox,Ke as buttonVariants,fs as cn,Oe as computePosition,Wr as createCompositeStateProvider,Ve as getDefaultComboBoxLayout,ts as useClickOutside,He as useComboboxCtrl,Hr as useCompositeState,ns as useCopyToClipboard,rs as useDarkMode,ss as useDebounce,Jr as useDefineSlot,Xn as useDropZone,as as useEventSource,ls as useFetch,os as useFetchOnce,cs as useFlag,Yr as useGetCompositeStateProperty,ds as useIntersectionObserver,us as useIsFirstRendering,dt as useIsInModal,Pe as usePopupController,hs as useSafeLayoutEffect,Kr as useSetCompositeStateProperty,ps as useSharedValue,qr as useSlot,Ar as useTabs,Rn as useToast,Zr as useWatchCompositeStateProperty,es as useWatchSharedState,Xr as useWatchSlot};
|
|
2
2
|
//# sourceMappingURL=vertesia-ui-core.js.map
|