ikon-react-components-lib 1.0.2 → 1.0.4
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("lucide-react"),Jn=require("@radix-ui/react-accordion"),Xn=require("clsx"),Qn=require("tailwind-merge"),Zn=require("@radix-ui/react-alert-dialog"),G=require("class-variance-authority"),es=require("@radix-ui/react-aspect-ratio"),ts=require("@radix-ui/react-avatar"),as=require("@radix-ui/react-checkbox"),rs=require("@radix-ui/react-dialog"),ns=require("@radix-ui/react-dropdown-menu"),ss=require("@radix-ui/react-hover-card"),os=require("@radix-ui/react-label"),is=require("@radix-ui/react-navigation-menu"),ls=require("@radix-ui/react-popover"),cs=require("@radix-ui/react-progress"),ds=require("@radix-ui/react-radio-group"),us=require("@radix-ui/react-scroll-area"),ms=require("@radix-ui/react-select"),fs=require("@radix-ui/react-separator"),xs=require("@radix-ui/react-slider"),Ut=require("@radix-ui/react-slot"),ps=require("@radix-ui/react-switch"),gs=require("@radix-ui/react-tabs"),hs=require("@radix-ui/react-toggle"),bs=require("@radix-ui/react-toggle-group"),vs=require("@radix-ui/react-tooltip"),m=require("react"),kt=require("react-day-picker"),Fe=require("cmdk"),pa=require("sonner");require("react-dom");const ke=require("vaul"),Ue=require("react-hook-form"),ga=require("input-otp"),B=require("@tanstack/react-table"),De=require("echarts"),ot=require("motion/react"),js=require("zxcvbn"),ws=require("countries-list"),Ns=require("country-flag-icons/react/3x2"),qe=require("date-fns"),W=require("react-big-calendar");require("react-big-calendar/lib/css/react-big-calendar.css");const ys=require("date-fns/locale"),xe=require("react-router-dom"),ha=require("axios"),Vt=require("js-cookie"),Cs=require("jwt-decode"),ze=require("@tanstack/react-query"),ba=require("react-cropper"),_=require("@assistant-ui/react"),ks=require("motion/react-m"),It=require("@assistant-ui/react-markdown"),Is=require("remark-gfm"),Ss=require("@assistant-ui/react-ai-sdk"),sa=require("uuid");function F(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(a,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return a.default=t,Object.freeze(a)}const As=F(g),Ke=F(Jn),je=F(Zn),Ts=F(es),qt=F(ts),oa=F(as),L=F(rs),q=F(ns),ct=F(ss),Ps=F(os),Ie=F(is),Ye=F(ls),ia=F(cs),St=F(ds),He=F(us),H=F(ms),Ds=F(fs),rt=F(xs),we=F(Ut),la=F(ps),xt=F(gs),Rs=F(hs),va=F(bs),Be=F(vs),k=F(m),_s=F(Ns),At=F(ks);function i(...t){return Qn.twMerge(Xn.clsx(t))}function zs({...t}){return e.jsx(Ke.Root,{"data-slot":"accordion",...t})}function Ms({className:t,...a}){return e.jsx(Ke.Item,{"data-slot":"accordion-item",className:i("border-b last:border-b-0",t),...a})}function Fs({className:t,children:a,...r}){return e.jsx(Ke.Header,{className:"flex",children:e.jsxs(Ke.Trigger,{"data-slot":"accordion-trigger",className:i("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",t),...r,children:[a,e.jsx(g.ChevronDownIcon,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function Es({className:t,children:a,...r}){return e.jsx(Ke.Content,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...r,children:e.jsx("div",{className:i("pt-0 pb-4",t),children:a})})}function Os(t,a,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t?.(s),r===!1||!s.defaultPrevented)return a?.(s)}}function Ls(t,a=[]){let r=[];function n(o,l){const c=k.createContext(l),d=r.length;r=[...r,l];const u=h=>{const{scope:w,children:C,...v}=h,N=w?.[t]?.[d]||c,b=k.useMemo(()=>v,Object.values(v));return e.jsx(N.Provider,{value:b,children:C})};u.displayName=o+"Provider";function f(h,w){const C=w?.[t]?.[d]||c,v=k.useContext(C);if(v)return v;if(l!==void 0)return l;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[u,f]}const s=()=>{const o=r.map(l=>k.createContext(l));return function(c){const d=c?.[t]||o;return k.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[n,Bs(s,...a)]}function Bs(...t){const a=t[0];if(t.length===1)return a;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const l=n.reduce((c,{useScope:d,scopeName:u})=>{const h=d(o)[`__scope${u}`];return{...c,...h}},{});return k.useMemo(()=>({[`__scope${a.scopeName}`]:l}),[l])}};return r.scopeName=a.scopeName,r}var Je=globalThis?.document?k.useLayoutEffect:()=>{},Us=k[" useInsertionEffect ".trim().toString()]||Je;function Vs({prop:t,defaultProp:a,onChange:r=()=>{},caller:n}){const[s,o,l]=qs({defaultProp:a,onChange:r}),c=t!==void 0,d=c?t:s;{const f=k.useRef(t!==void 0);k.useEffect(()=>{const h=f.current;h!==c&&console.warn(`${n} is changing from ${h?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,n])}const u=k.useCallback(f=>{if(c){const h=Ws(f)?f(t):f;h!==t&&l.current?.(h)}else o(f)},[c,t,o,l]);return[d,u]}function qs({defaultProp:t,onChange:a}){const[r,n]=k.useState(t),s=k.useRef(r),o=k.useRef(a);return Us(()=>{o.current=a},[a]),k.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}function Ws(t){return typeof t=="function"}function ca(t,a){if(typeof t=="function")return t(a);t!=null&&(t.current=a)}function Gs(...t){return a=>{let r=!1;const n=t.map(s=>{const o=ca(s,a);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<n.length;s++){const o=n[s];typeof o=="function"?o():ca(t[s],null)}}}}function ja(...t){return k.useCallback(Gs(...t),t)}var $s=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wt=$s.reduce((t,a)=>{const r=Ut.createSlot(`Primitive.${a}`),n=k.forwardRef((s,o)=>{const{asChild:l,...c}=s,d=l?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(d,{...c,ref:o})});return n.displayName=`Primitive.${a}`,{...t,[a]:n}},{});function Hs(t,a){return k.useReducer((r,n)=>a[r][n]??r,t)}var wa=t=>{const{present:a,children:r}=t,n=Ks(a),s=typeof r=="function"?r({present:n.isPresent}):k.Children.only(r),o=ja(n.ref,Ys(s));return typeof r=="function"||n.isPresent?k.cloneElement(s,{ref:o}):null};wa.displayName="Presence";function Ks(t){const[a,r]=k.useState(),n=k.useRef(null),s=k.useRef(t),o=k.useRef("none"),l=t?"mounted":"unmounted",[c,d]=Hs(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const u=nt(n.current);o.current=c==="mounted"?u:"none"},[c]),Je(()=>{const u=n.current,f=s.current;if(f!==t){const w=o.current,C=nt(u);t?d("MOUNT"):C==="none"||u?.display==="none"?d("UNMOUNT"):d(f&&w!==C?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,d]),Je(()=>{if(a){let u;const f=a.ownerDocument.defaultView??window,h=C=>{const N=nt(n.current).includes(CSS.escape(C.animationName));if(C.target===a&&N&&(d("ANIMATION_END"),!s.current)){const b=a.style.animationFillMode;a.style.animationFillMode="forwards",u=f.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=b)})}},w=C=>{C.target===a&&(o.current=nt(n.current))};return a.addEventListener("animationstart",w),a.addEventListener("animationcancel",h),a.addEventListener("animationend",h),()=>{f.clearTimeout(u),a.removeEventListener("animationstart",w),a.removeEventListener("animationcancel",h),a.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[a,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:k.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function nt(t){return t?.animationName||"none"}function Ys(t){let a=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?t.ref:(a=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Js=k[" useId ".trim().toString()]||(()=>{}),Xs=0;function Qs(t){const[a,r]=k.useState(Js());return Je(()=>{r(n=>n??String(Xs++))},[t]),t||(a?`radix-${a}`:"")}var pt="Collapsible",[Zs]=Ls(pt),[eo,Gt]=Zs(pt),Na=k.forwardRef((t,a)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:l,...c}=t,[d,u]=Vs({prop:n,defaultProp:s??!1,onChange:l,caller:pt});return e.jsx(eo,{scope:r,disabled:o,contentId:Qs(),open:d,onOpenToggle:k.useCallback(()=>u(f=>!f),[u]),children:e.jsx(Wt.div,{"data-state":Ht(d),"data-disabled":o?"":void 0,...c,ref:a})})});Na.displayName=pt;var ya="CollapsibleTrigger",Ca=k.forwardRef((t,a)=>{const{__scopeCollapsible:r,...n}=t,s=Gt(ya,r);return e.jsx(Wt.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Ht(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:a,onClick:Os(t.onClick,s.onOpenToggle)})});Ca.displayName=ya;var $t="CollapsibleContent",ka=k.forwardRef((t,a)=>{const{forceMount:r,...n}=t,s=Gt($t,t.__scopeCollapsible);return e.jsx(wa,{present:r||s.open,children:({present:o})=>e.jsx(to,{...n,ref:a,present:o})})});ka.displayName=$t;var to=k.forwardRef((t,a)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=t,l=Gt($t,r),[c,d]=k.useState(n),u=k.useRef(null),f=ja(a,u),h=k.useRef(0),w=h.current,C=k.useRef(0),v=C.current,N=l.open||c,b=k.useRef(N),y=k.useRef(void 0);return k.useEffect(()=>{const x=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(x)},[]),Je(()=>{const x=u.current;if(x){y.current=y.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const I=x.getBoundingClientRect();h.current=I.height,C.current=I.width,b.current||(x.style.transitionDuration=y.current.transitionDuration,x.style.animationName=y.current.animationName),d(n)}},[l.open,n]),e.jsx(Wt.div,{"data-state":Ht(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!N,...o,ref:f,style:{"--radix-collapsible-content-height":w?`${w}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:N&&s})});function Ht(t){return t?"open":"closed"}var ao=Na;const dt=G.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",dashed:"border border-dashed bg-background shadow-sm hover:bg-accent hover:text-accent-foreground ",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function R({className:t,variant:a="default",size:r="default",asChild:n=!1,...s}){const o=n?we.Root:"button";return e.jsx(o,{"data-slot":"button","data-variant":a,"data-size":r,className:i(dt({variant:a,size:r,className:t})),...s})}function Ia({...t}){return e.jsx(je.Root,{"data-slot":"alert-dialog",...t})}function ro({...t}){return e.jsx(je.Trigger,{"data-slot":"alert-dialog-trigger",...t})}function Sa({...t}){return e.jsx(je.Portal,{"data-slot":"alert-dialog-portal",...t})}function Aa({className:t,...a}){return e.jsx(je.Overlay,{"data-slot":"alert-dialog-overlay",className:i("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function Ta({className:t,size:a="default",...r}){return e.jsxs(Sa,{children:[e.jsx(Aa,{}),e.jsx(je.Content,{"data-slot":"alert-dialog-content","data-size":a,className:i("bg-background 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 group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg",t),...r})]})}function Pa({className:t,...a}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:i("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...a})}function Da({className:t,...a}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:i("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...a})}function Ra({className:t,...a}){return e.jsx(je.Title,{"data-slot":"alert-dialog-title",className:i("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...a})}function _a({className:t,...a}){return e.jsx(je.Description,{"data-slot":"alert-dialog-description",className:i("text-muted-foreground text-sm",t),...a})}function no({className:t,...a}){return e.jsx("div",{"data-slot":"alert-dialog-media",className:i("bg-muted mb-2 inline-flex size-16 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",t),...a})}function Tt({className:t,variant:a="default",size:r="default",...n}){return e.jsx(R,{variant:a,size:r,asChild:!0,children:e.jsx(je.Action,{"data-slot":"alert-dialog-action",className:i(t),...n})})}function za({className:t,variant:a="outline",size:r="default",...n}){return e.jsx(R,{variant:a,size:r,asChild:!0,children:e.jsx(je.Cancel,{"data-slot":"alert-dialog-cancel",className:i(t),...n})})}const so=G.cva("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function oo({className:t,variant:a,...r}){return e.jsx("div",{"data-slot":"alert",role:"alert",className:i(so({variant:a}),t),...r})}function io({className:t,...a}){return e.jsx("div",{"data-slot":"alert-title",className:i("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...a})}function lo({className:t,...a}){return e.jsx("div",{"data-slot":"alert-description",className:i("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...a})}function Ma({className:t,size:a="default",...r}){return e.jsx(qt.Root,{"data-slot":"avatar","data-size":a,className:i("group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",t),...r})}function Fa({className:t,...a}){return e.jsx(qt.Image,{"data-slot":"avatar-image",className:i("aspect-square size-full",t),...a})}function Ea({className:t,...a}){return e.jsx(qt.Fallback,{"data-slot":"avatar-fallback",className:i("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs",t),...a})}function co({className:t,...a}){return e.jsx("span",{"data-slot":"avatar-badge",className:i("bg-primary text-primary-foreground ring-background absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full ring-2 select-none","group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden","group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2","group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",t),...a})}function uo({className:t,...a}){return e.jsx("div",{"data-slot":"avatar-group",className:i("*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2",t),...a})}function mo({className:t,...a}){return e.jsx("div",{"data-slot":"avatar-group-count",className:i("bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",t),...a})}const Oa=G.cva("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function it({className:t,variant:a="default",asChild:r=!1,...n}){const s=r?we.Root:"span";return e.jsx(s,{"data-slot":"badge","data-variant":a,className:i(Oa({variant:a}),t),...n})}function La({className:t,classNames:a,showOutsideDays:r=!0,captionLayout:n="label",buttonVariant:s="ghost",formatters:o,components:l,...c}){const d=kt.getDefaultClassNames();return e.jsx(kt.DayPicker,{showOutsideDays:r,className:i("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:n,formatters:{formatMonthDropdown:u=>u.toLocaleString("default",{month:"short"}),...o},classNames:{root:i("w-fit",d.root),months:i("flex gap-4 flex-col md:flex-row relative",d.months),month:i("flex flex-col w-full gap-4",d.month),nav:i("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",d.nav),button_previous:i(dt({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",d.button_previous),button_next:i(dt({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",d.button_next),month_caption:i("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",d.month_caption),dropdowns:i("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",d.dropdowns),dropdown_root:i("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",d.dropdown_root),dropdown:i("absolute bg-popover inset-0 opacity-0",d.dropdown),caption_label:i("select-none font-medium",n==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:i("flex",d.weekdays),weekday:i("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",d.weekday),week:i("flex w-full mt-2",d.week),week_number_header:i("select-none w-(--cell-size)",d.week_number_header),week_number:i("text-[0.8rem] select-none text-muted-foreground",d.week_number),day:i("relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",c.showWeekNumber?"[&:nth-child(2)[data-selected=true]_button]:rounded-l-md":"[&:first-child[data-selected=true]_button]:rounded-l-md",d.day),range_start:i("rounded-l-md bg-accent",d.range_start),range_middle:i("rounded-none",d.range_middle),range_end:i("rounded-r-md bg-accent",d.range_end),today:i("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:i("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:i("text-muted-foreground opacity-50",d.disabled),hidden:i("invisible",d.hidden),...a},components:{Root:({className:u,rootRef:f,...h})=>e.jsx("div",{"data-slot":"calendar",ref:f,className:i(u),...h}),Chevron:({className:u,orientation:f,...h})=>f==="left"?e.jsx(g.ChevronLeftIcon,{className:i("size-4",u),...h}):f==="right"?e.jsx(g.ChevronRightIcon,{className:i("size-4",u),...h}):e.jsx(g.ChevronDownIcon,{className:i("size-4",u),...h}),DayButton:Ba,WeekNumber:({children:u,...f})=>e.jsx("td",{...f,children:e.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:u})}),...l},...c})}function Ba({className:t,day:a,modifiers:r,...n}){const s=kt.getDefaultClassNames(),o=k.useRef(null);return k.useEffect(()=>{r.focused&&o.current?.focus()},[r.focused]),e.jsx(R,{ref:o,variant:"ghost",size:"icon","data-day":a.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:i("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",s.day,t),...n})}function ut({className:t,...a}){return e.jsx("div",{"data-slot":"card",className:i("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...a})}function fo({className:t,...a}){return e.jsx("div",{"data-slot":"card-header",className:i("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function xo({className:t,...a}){return e.jsx("div",{"data-slot":"card-title",className:i("leading-none font-semibold",t),...a})}function po({className:t,...a}){return e.jsx("div",{"data-slot":"card-description",className:i("text-muted-foreground text-sm",t),...a})}function go({className:t,...a}){return e.jsx("div",{"data-slot":"card-action",className:i("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...a})}function Ua({className:t,...a}){return e.jsx("div",{"data-slot":"card-content",className:i("px-6",t),...a})}function ho({className:t,...a}){return e.jsx("div",{"data-slot":"card-footer",className:i("flex items-center px-6 [.border-t]:pt-6",t),...a})}function Xe({className:t,...a}){return e.jsx(oa.Root,{"data-slot":"checkbox",className:i("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e.jsx(oa.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:e.jsx(g.CheckIcon,{className:"size-3.5"})})})}function gt({...t}){return e.jsx(L.Root,{"data-slot":"dialog",...t})}function Va({...t}){return e.jsx(L.Trigger,{"data-slot":"dialog-trigger",...t})}function qa({...t}){return e.jsx(L.Portal,{"data-slot":"dialog-portal",...t})}function bo({...t}){return e.jsx(L.Close,{"data-slot":"dialog-close",...t})}function Wa({className:t,...a}){return e.jsx(L.Overlay,{"data-slot":"dialog-overlay",className:i("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function ht({className:t,children:a,showCloseButton:r=!0,...n}){return e.jsxs(qa,{"data-slot":"dialog-portal",children:[e.jsx(Wa,{}),e.jsxs(L.Content,{"data-slot":"dialog-content",className:i("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",t),...n,children:[a,r&&e.jsxs(L.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(g.XIcon,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Kt({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-header",className:i("flex flex-col gap-2 text-center sm:text-left",t),...a})}function Ga({className:t,showCloseButton:a=!1,children:r,...n}){return e.jsxs("div",{"data-slot":"dialog-footer",className:i("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...n,children:[r,a&&e.jsx(L.Close,{asChild:!0,children:e.jsx(R,{variant:"outline",children:"Close"})})]})}function bt({className:t,...a}){return e.jsx(L.Title,{"data-slot":"dialog-title",className:i("text-lg leading-none font-semibold",t),...a})}function $a({className:t,...a}){return e.jsx(L.Description,{"data-slot":"dialog-description",className:i("text-muted-foreground text-sm",t),...a})}function Y({className:t,...a}){return e.jsx(Fe.Command,{"data-slot":"command",className:i("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...a})}function vo({title:t="Command Palette",description:a="Search for a command to run...",children:r,className:n,showCloseButton:s=!0,...o}){return e.jsxs(gt,{...o,children:[e.jsxs(Kt,{className:"sr-only",children:[e.jsx(bt,{children:t}),e.jsx($a,{children:a})]}),e.jsx(ht,{className:i("overflow-hidden p-0",n),showCloseButton:s,children:e.jsx(Y,{className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:r})})]})}function ne({className:t,...a}){return e.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[e.jsx(g.SearchIcon,{className:"size-4 shrink-0 opacity-50"}),e.jsx(Fe.Command.Input,{"data-slot":"command-input",className:i("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...a})]})}function se({className:t,...a}){return e.jsx(Fe.Command.List,{"data-slot":"command-list",className:i("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...a})}function oe({...t}){return e.jsx(Fe.Command.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function ee({className:t,...a}){return e.jsx(Fe.Command.Group,{"data-slot":"command-group",className:i("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...a})}function Ha({className:t,...a}){return e.jsx(Fe.Command.Separator,{"data-slot":"command-separator",className:i("bg-border -mx-1 h-px",t),...a})}function K({className:t,...a}){return e.jsx(Fe.Command.Item,{"data-slot":"command-item",className:i("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...a})}function jo({className:t,...a}){return e.jsx("span",{"data-slot":"command-shortcut",className:i("text-muted-foreground ml-auto text-xs tracking-widest",t),...a})}function Se({...t}){return e.jsx(q.Root,{"data-slot":"dropdown-menu",...t})}function Ka({...t}){return e.jsx(q.Portal,{"data-slot":"dropdown-menu-portal",...t})}function Ae({...t}){return e.jsx(q.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function Te({className:t,sideOffset:a=4,...r}){return e.jsx(q.Portal,{children:e.jsx(q.Content,{"data-slot":"dropdown-menu-content",sideOffset:a,className:i("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...r})})}function Yt({...t}){return e.jsx(q.Group,{"data-slot":"dropdown-menu-group",...t})}function ie({className:t,inset:a,variant:r="default",...n}){return e.jsx(q.Item,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":r,className:i("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n})}function wo({className:t,children:a,checked:r,...n}){return e.jsxs(q.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:i("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),checked:r,...n,children:[e.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e.jsx(q.ItemIndicator,{children:e.jsx(g.CheckIcon,{className:"size-4"})})}),a]})}function No({...t}){return e.jsx(q.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...t})}function yo({className:t,children:a,...r}){return e.jsxs(q.RadioItem,{"data-slot":"dropdown-menu-radio-item",className:i("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[e.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e.jsx(q.ItemIndicator,{children:e.jsx(g.CircleIcon,{className:"size-2 fill-current"})})}),a]})}function Jt({className:t,inset:a,...r}){return e.jsx(q.Label,{"data-slot":"dropdown-menu-label","data-inset":a,className:i("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...r})}function vt({className:t,...a}){return e.jsx(q.Separator,{"data-slot":"dropdown-menu-separator",className:i("bg-border -mx-1 my-1 h-px",t),...a})}function Co({className:t,...a}){return e.jsx("span",{"data-slot":"dropdown-menu-shortcut",className:i("text-muted-foreground ml-auto text-xs tracking-widest",t),...a})}function Ya({...t}){return e.jsx(q.Sub,{"data-slot":"dropdown-menu-sub",...t})}function Ja({className:t,inset:a,children:r,...n}){return e.jsxs(q.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":a,className:i("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[r,e.jsx(g.ChevronRightIcon,{className:"ml-auto size-4"})]})}function Xa({className:t,...a}){return e.jsx(q.SubContent,{"data-slot":"dropdown-menu-sub-content",className:i("bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),...a})}function ko({...t}){return e.jsx(ct.Root,{"data-slot":"hover-card",...t})}function Io({...t}){return e.jsx(ct.Trigger,{"data-slot":"hover-card-trigger",...t})}function So({className:t,align:a="center",sideOffset:r=4,...n}){return e.jsx(ct.Portal,{"data-slot":"hover-card-portal",children:e.jsx(ct.Content,{"data-slot":"hover-card-content",align:a,sideOffset:r,className:i("bg-popover text-popover-foreground 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 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...n})})}function $({className:t,type:a,...r}){return e.jsx("input",{type:a,"data-slot":"input",className:i("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...r})}function be({className:t,...a}){return e.jsx(Ps.Root,{"data-slot":"label",className:i("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...a})}function Ao({className:t,children:a,viewport:r=!0,...n}){return e.jsxs(Ie.Root,{"data-slot":"navigation-menu","data-viewport":r,className:i("group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",t),...n,children:[a,r&&e.jsx(Za,{})]})}function To({className:t,...a}){return e.jsx(Ie.List,{"data-slot":"navigation-menu-list",className:i("group flex flex-1 list-none items-center justify-center gap-1",t),...a})}function Po({className:t,...a}){return e.jsx(Ie.Item,{"data-slot":"navigation-menu-item",className:i("relative",t),...a})}const Qa=G.cva("group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1");function Do({className:t,children:a,...r}){return e.jsxs(Ie.Trigger,{"data-slot":"navigation-menu-trigger",className:i(Qa(),"group",t),...r,children:[a," ",e.jsx(g.ChevronDownIcon,{className:"relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180","aria-hidden":"true"})]})}function Ro({className:t,...a}){return e.jsx(Ie.Content,{"data-slot":"navigation-menu-content",className:i("data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto","group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none",t),...a})}function Za({className:t,...a}){return e.jsx("div",{className:i("absolute top-full left-0 isolate z-50 flex justify-center"),children:e.jsx(Ie.Viewport,{"data-slot":"navigation-menu-viewport",className:i("origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]",t),...a})})}function _o({className:t,...a}){return e.jsx(Ie.Link,{"data-slot":"navigation-menu-link",className:i("data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",t),...a})}function zo({className:t,...a}){return e.jsx(Ie.Indicator,{"data-slot":"navigation-menu-indicator",className:i("data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",t),...a,children:e.jsx("div",{className:"bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md"})})}function J({...t}){return e.jsx(Ye.Root,{"data-slot":"popover",...t})}function X({...t}){return e.jsx(Ye.Trigger,{"data-slot":"popover-trigger",...t})}function Q({className:t,align:a="center",sideOffset:r=4,...n}){return e.jsx(Ye.Portal,{children:e.jsx(Ye.Content,{"data-slot":"popover-content",align:a,sideOffset:r,className:i("bg-popover text-popover-foreground 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...n})})}function Mo({...t}){return e.jsx(Ye.Anchor,{"data-slot":"popover-anchor",...t})}function Fo({className:t,...a}){return e.jsx("div",{"data-slot":"popover-header",className:i("flex flex-col gap-1 text-sm",t),...a})}function Eo({className:t,...a}){return e.jsx("div",{"data-slot":"popover-title",className:i("font-medium",t),...a})}function Oo({className:t,...a}){return e.jsx("p",{"data-slot":"popover-description",className:i("text-muted-foreground",t),...a})}function jt({className:t,value:a,...r}){return e.jsx(ia.Root,{"data-slot":"progress",className:i("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",t),...r,children:e.jsx(ia.Indicator,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(a||0)}%)`}})})}function Lo({className:t,...a}){return e.jsx(St.Root,{"data-slot":"radio-group",className:i("grid gap-3",t),...a})}function Bo({className:t,...a}){return e.jsx(St.Item,{"data-slot":"radio-group-item",className:i("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e.jsx(St.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e.jsx(g.CircleIcon,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}function Uo({className:t,children:a,...r}){return e.jsxs(He.Root,{"data-slot":"scroll-area",className:i("relative",t),...r,children:[e.jsx(He.Viewport,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:a}),e.jsx(er,{}),e.jsx(He.Corner,{})]})}function er({className:t,orientation:a="vertical",...r}){return e.jsx(He.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:a,className:i("flex touch-none p-px transition-colors select-none",a==="vertical"&&"h-full w-2.5 border-l border-l-transparent",a==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",t),...r,children:e.jsx(He.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function tr({...t}){return e.jsx(H.Root,{"data-slot":"select",...t})}function Vo({...t}){return e.jsx(H.Group,{"data-slot":"select-group",...t})}function ar({...t}){return e.jsx(H.Value,{"data-slot":"select-value",...t})}function rr({className:t,size:a="default",children:r,...n}){return e.jsxs(H.Trigger,{"data-slot":"select-trigger","data-size":a,className:i("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[r,e.jsx(H.Icon,{asChild:!0,children:e.jsx(g.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function nr({className:t,children:a,position:r="item-aligned",align:n="center",...s}){return e.jsx(H.Portal,{children:e.jsxs(H.Content,{"data-slot":"select-content",className:i("bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,align:n,...s,children:[e.jsx(or,{}),e.jsx(H.Viewport,{className:i("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),e.jsx(ir,{})]})})}function qo({className:t,...a}){return e.jsx(H.Label,{"data-slot":"select-label",className:i("text-muted-foreground px-2 py-1.5 text-xs",t),...a})}function sr({className:t,children:a,...r}){return e.jsxs(H.Item,{"data-slot":"select-item",className:i("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[e.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(H.ItemIndicator,{children:e.jsx(g.CheckIcon,{className:"size-4"})})}),e.jsx(H.ItemText,{children:a})]})}function Wo({className:t,...a}){return e.jsx(H.Separator,{"data-slot":"select-separator",className:i("bg-border pointer-events-none -mx-1 my-1 h-px",t),...a})}function or({className:t,...a}){return e.jsx(H.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:i("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(g.ChevronUpIcon,{className:"size-4"})})}function ir({className:t,...a}){return e.jsx(H.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:i("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(g.ChevronDownIcon,{className:"size-4"})})}function wt({className:t,orientation:a="horizontal",decorative:r=!0,...n}){return e.jsx(Ds.Root,{"data-slot":"separator",decorative:r,orientation:a,className:i("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...n})}function Xt({...t}){return e.jsx(L.Root,{"data-slot":"sheet",...t})}function lr({...t}){return e.jsx(L.Trigger,{"data-slot":"sheet-trigger",...t})}function Go({...t}){return e.jsx(L.Close,{"data-slot":"sheet-close",...t})}function $o({...t}){return e.jsx(L.Portal,{"data-slot":"sheet-portal",...t})}function Ho({className:t,...a}){return e.jsx(L.Overlay,{"data-slot":"sheet-overlay",className:i("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function Qt({className:t,children:a,side:r="right",showCloseButton:n=!0,...s}){return e.jsxs($o,{children:[e.jsx(Ho,{}),e.jsxs(L.Content,{"data-slot":"sheet-content",className:i("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",r==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",r==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",r==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...s,children:[a,n&&e.jsxs(L.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(g.XIcon,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function cr({className:t,...a}){return e.jsx("div",{"data-slot":"sheet-header",className:i("flex flex-col gap-1.5 p-4",t),...a})}function Ko({className:t,...a}){return e.jsx("div",{"data-slot":"sheet-footer",className:i("mt-auto flex flex-col gap-2 p-4",t),...a})}function Zt({className:t,...a}){return e.jsx(L.Title,{"data-slot":"sheet-title",className:i("text-foreground font-semibold",t),...a})}function dr({className:t,...a}){return e.jsx(L.Description,{"data-slot":"sheet-description",className:i("text-muted-foreground text-sm",t),...a})}const Ct=768;function Nt(){const[t,a]=k.useState(void 0);return k.useEffect(()=>{const r=window.matchMedia(`(max-width: ${Ct-1}px)`),n=()=>{a(window.innerWidth<Ct)};return r.addEventListener("change",n),a(window.innerWidth<Ct),()=>r.removeEventListener("change",n)},[]),!!t}function _e({className:t,...a}){return e.jsx("div",{"data-slot":"skeleton",className:i("bg-accent animate-pulse rounded-md",t),...a})}function ye({delayDuration:t=0,...a}){return e.jsx(Be.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function te({...t}){return e.jsx(Be.Root,{"data-slot":"tooltip",...t})}function ae({...t}){return e.jsx(Be.Trigger,{"data-slot":"tooltip-trigger",...t})}function re({className:t,sideOffset:a=0,children:r,...n}){return e.jsx(Be.Portal,{children:e.jsxs(Be.Content,{"data-slot":"tooltip-content",sideOffset:a,className:i("bg-foreground text-background 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...n,children:[r,e.jsx(Be.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Yo="sidebar_state",Jo=3600*24*7,Xo="16rem",Qo="18rem",Zo="3rem",ei="b",ur=k.createContext(null);function Qe(){const t=k.useContext(ur);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function mr({defaultOpen:t=!0,open:a,onOpenChange:r,className:n,style:s,children:o,...l}){const c=Nt(),[d,u]=k.useState(!1),[f,h]=k.useState(t),w=a??f,C=k.useCallback(y=>{const x=typeof y=="function"?y(w):y;r?r(x):h(x),document.cookie=`${Yo}=${x}; path=/; max-age=${Jo}`},[r,w]),v=k.useCallback(()=>c?u(y=>!y):C(y=>!y),[c,C,u]);k.useEffect(()=>{const y=x=>{x.key===ei&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),v())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[v]);const N=w?"expanded":"collapsed",b=k.useMemo(()=>({state:N,open:w,setOpen:C,isMobile:c,openMobile:d,setOpenMobile:u,toggleSidebar:v}),[N,w,C,c,d,u,v]);return e.jsx(ur.Provider,{value:b,children:e.jsx(ye,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Xo,"--sidebar-width-icon":Zo,...s},className:i("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...l,children:o})})})}function fr({side:t="left",variant:a="sidebar",collapsible:r="offcanvas",className:n,children:s,...o}){const{isMobile:l,state:c,openMobile:d,setOpenMobile:u}=Qe();return r==="none"?e.jsx("div",{"data-slot":"sidebar",className:i("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),...o,children:s}):l?e.jsx(Xt,{open:d,onOpenChange:u,...o,children:e.jsxs(Qt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":Qo},side:t,children:[e.jsxs(cr,{className:"sr-only",children:[e.jsx(Zt,{children:"Sidebar"}),e.jsx(dr,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":c,"data-collapsible":c==="collapsed"?r:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:i("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",a==="floating"||a==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container",className:i("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"||a==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...o,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function xr({className:t,onClick:a,...r}){const{toggleSidebar:n}=Qe();return e.jsxs(R,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:i("size-7",t),onClick:s=>{a?.(s),n()},...r,children:[e.jsx(g.PanelLeftIcon,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function pr({className:t,...a}){const{toggleSidebar:r}=Qe();return e.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:i("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...a})}function gr({className:t,...a}){return e.jsx("main",{"data-slot":"sidebar-inset",className:i("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...a})}function ti({className:t,...a}){return e.jsx($,{"data-slot":"sidebar-input","data-sidebar":"input",className:i("bg-background h-8 w-full shadow-none",t),...a})}function hr({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:i("flex flex-col gap-2 p-2",t),...a})}function br({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:i("flex flex-col gap-2 p-2",t),...a})}function ai({className:t,...a}){return e.jsx(wt,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:i("bg-sidebar-border mx-2 w-auto",t),...a})}function vr({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:i("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function jr({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:i("relative flex w-full min-w-0 flex-col p-2",t),...a})}function ri({className:t,asChild:a=!1,...r}){const n=a?we.Root:"div";return e.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:i("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...r})}function ni({className:t,asChild:a=!1,...r}){const n=a?we.Root:"button";return e.jsx(n,{"data-slot":"sidebar-group-action","data-sidebar":"group-action",className:i("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 md:after:hidden","group-data-[collapsible=icon]:hidden",t),...r})}function si({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:i("w-full text-sm",t),...a})}function wr({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:i("flex w-full min-w-0 flex-col gap-1",t),...a})}function Pt({className:t,...a}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:i("group/menu-item relative",t),...a})}const oi=G.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Dt({asChild:t=!1,isActive:a=!1,variant:r="default",size:n="default",tooltip:s,className:o,...l}){const c=t?we.Root:"button",{isMobile:d,state:u}=Qe(),f=e.jsx(c,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":a,className:i(oi({variant:r,size:n}),o),...l});return s?(typeof s=="string"&&(s={children:s}),e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,children:f}),e.jsx(re,{side:"right",align:"center",hidden:u!=="collapsed"||d,...s})]})):f}function ii({className:t,asChild:a=!1,showOnHover:r=!1,...n}){const s=a?we.Root:"button";return e.jsx(s,{"data-slot":"sidebar-menu-action","data-sidebar":"menu-action",className:i("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 md:after:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",t),...n})}function li({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:i("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...a})}function ci({className:t,showIcon:a=!1,...r}){const n=k.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return e.jsxs("div",{"data-slot":"sidebar-menu-skeleton","data-sidebar":"menu-skeleton",className:i("flex h-8 items-center gap-2 rounded-md px-2",t),...r,children:[a&&e.jsx(_e,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),e.jsx(_e,{className:"h-4 max-w-(--skeleton-width) flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})}function Nr({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:i("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...a})}function yr({className:t,...a}){return e.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:i("group/menu-sub-item relative",t),...a})}function Cr({asChild:t=!1,size:a="md",isActive:r=!1,className:n,...s}){const o=t?we.Root:"a";return e.jsx(o,{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":r,className:i("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"text-xs",a==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",n),...s})}function di({className:t,defaultValue:a,value:r,min:n=0,max:s=100,...o}){const l=k.useMemo(()=>Array.isArray(r)?r:Array.isArray(a)?a:[n,s],[r,a,n,s]);return e.jsxs(rt.Root,{"data-slot":"slider",defaultValue:a,value:r,min:n,max:s,className:i("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",t),...o,children:[e.jsx(rt.Track,{"data-slot":"slider-track",className:i("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:e.jsx(rt.Range,{"data-slot":"slider-range",className:i("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:l.length},(c,d)=>e.jsx(rt.Thumb,{"data-slot":"slider-thumb",className:"border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},d))]})}const kr=k.createContext(void 0),Ir=({children:t})=>{const a=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",[r,n]=k.useState(()=>typeof window>"u"?"system":localStorage.getItem("theme")||"system"),[s,o]=k.useState(()=>r==="system"?a():r),l=k.useCallback(d=>{const u=document.documentElement;u.classList.remove("dark","blue-dark");let f;d==="system"?f=a():f=d,f==="dark"&&u.classList.add("dark"),f==="blue-dark"&&u.classList.add("blue-dark"),o(f)},[]);k.useEffect(()=>{l(r),localStorage.setItem("theme",r)},[r,l]),k.useEffect(()=>{if(r!=="system")return;const d=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>{l("system")};return d.addEventListener("change",u),()=>d.removeEventListener("change",u)},[r,l]);const c=k.useMemo(()=>({theme:r,setTheme:n,resolvedTheme:s}),[r,s]);return e.jsx(kr.Provider,{value:c,children:t})},Sr=()=>{const t=k.useContext(kr);if(!t)throw new Error("useTheme must be used within ThemeProvider");return t},ui=({...t})=>{const{theme:a="system"}=Sr();return e.jsx(pa.Toaster,{theme:a,className:"toaster group",icons:{success:e.jsx(g.CircleCheckIcon,{className:"size-4"}),info:e.jsx(g.InfoIcon,{className:"size-4"}),warning:e.jsx(g.TriangleAlertIcon,{className:"size-4"}),error:e.jsx(g.OctagonXIcon,{className:"size-4"}),loading:e.jsx(g.Loader2Icon,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...t})};function mi({className:t,size:a="default",...r}){return e.jsx(la.Root,{"data-slot":"switch","data-size":a,className:i("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",t),...r,children:e.jsx(la.Thumb,{"data-slot":"switch-thumb",className:i("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function Ar({className:t,...a}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:i("w-full caption-bottom text-sm",t),...a})})}function Tr({className:t,...a}){return e.jsx("thead",{"data-slot":"table-header",className:i("[&_tr]:border-b",t),...a})}function Pr({className:t,...a}){return e.jsx("tbody",{"data-slot":"table-body",className:i("[&_tr:last-child]:border-0",t),...a})}function Dr({className:t,...a}){return e.jsx("tfoot",{"data-slot":"table-footer",className:i("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",t),...a})}function Oe({className:t,...a}){return e.jsx("tr",{"data-slot":"table-row",className:i("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...a})}function Rt({className:t,...a}){return e.jsx("th",{"data-slot":"table-head",className:i("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...a})}function We({className:t,...a}){return e.jsx("td",{"data-slot":"table-cell",className:i("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...a})}function fi({className:t,...a}){return e.jsx("caption",{"data-slot":"table-caption",className:i("text-muted-foreground mt-4 text-sm",t),...a})}function Rr({className:t,orientation:a="horizontal",...r}){return e.jsx(xt.Root,{"data-slot":"tabs","data-orientation":a,orientation:a,className:i("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",t),...r})}const _r=G.cva("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function zr({className:t,variant:a="default",...r}){return e.jsx(xt.List,{"data-slot":"tabs-list","data-variant":a,className:i(_r({variant:a}),t),...r})}function Mr({className:t,...a}){return e.jsx(xt.Trigger,{"data-slot":"tabs-trigger",className:i("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",t),...a})}function _t({className:t,...a}){return e.jsx(xt.Content,{"data-slot":"tabs-content",className:i("flex-1 outline-none",t),...a})}function Fr({className:t,...a}){return e.jsx("textarea",{"data-slot":"textarea",className:i("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...a})}function zt({...t}){return e.jsx(Ts.Root,{"data-slot":"aspect-ratio",...t})}function Er({...t}){return e.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...t})}function Or({className:t,...a}){return e.jsx("ol",{"data-slot":"breadcrumb-list",className:i("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",t),...a})}function Le({className:t,...a}){return e.jsx("li",{"data-slot":"breadcrumb-item",className:i("inline-flex items-center gap-1.5",t),...a})}function Mt({asChild:t,className:a,...r}){const n=t?we.Root:"a";return e.jsx(n,{"data-slot":"breadcrumb-link",className:i("hover:text-foreground transition-colors",a),...r})}function Ge({className:t,...a}){return e.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:i("text-foreground font-normal",t),...a})}function lt({children:t,className:a,...r}){return e.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:i("[&>svg]:size-3.5",a),...r,children:t??e.jsx(g.ChevronRight,{})})}function Ft({className:t,...a}){return e.jsxs("span",{"data-slot":"breadcrumb-ellipsis",role:"presentation","aria-hidden":"true",className:i("flex size-9 items-center justify-center",t),...a,children:[e.jsx(g.MoreHorizontal,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"More"})]})}function Lr({...t}){return e.jsx(ao,{"data-slot":"collapsible",...t})}function Br({...t}){return e.jsx(Ca,{"data-slot":"collapsible-trigger",...t})}function Ur({...t}){return e.jsx(ka,{"data-slot":"collapsible-content",...t})}function Vr({...t}){return e.jsx(ke.Drawer.Root,{"data-slot":"drawer",...t})}function qr({...t}){return e.jsx(ke.Drawer.Trigger,{"data-slot":"drawer-trigger",...t})}function Wr({...t}){return e.jsx(ke.Drawer.Portal,{"data-slot":"drawer-portal",...t})}function Gr({...t}){return e.jsx(ke.Drawer.Close,{"data-slot":"drawer-close",...t})}function $r({className:t,...a}){return e.jsx(ke.Drawer.Overlay,{"data-slot":"drawer-overlay",className:i("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function Hr({className:t,children:a,...r}){return e.jsxs(Wr,{"data-slot":"drawer-portal",children:[e.jsx($r,{}),e.jsxs(ke.Drawer.Content,{"data-slot":"drawer-content",className:i("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",t),...r,children:[e.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),a]})]})}function Kr({className:t,...a}){return e.jsx("div",{"data-slot":"drawer-header",className:i("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",t),...a})}function Yr({className:t,...a}){return e.jsx("div",{"data-slot":"drawer-footer",className:i("mt-auto flex flex-col gap-2 p-4",t),...a})}function Jr({className:t,...a}){return e.jsx(ke.Drawer.Title,{"data-slot":"drawer-title",className:i("text-foreground font-semibold",t),...a})}function Xr({className:t,...a}){return e.jsx(ke.Drawer.Description,{"data-slot":"drawer-description",className:i("text-muted-foreground text-sm",t),...a})}const Qr=Ue.FormProvider,Zr=k.createContext({}),ce=({...t})=>e.jsx(Zr.Provider,{value:{name:t.name},children:e.jsx(Ue.Controller,{...t})}),Ze=()=>{const t=k.useContext(Zr),a=k.useContext(en),{getFieldState:r}=Ue.useFormContext(),n=Ue.useFormState({name:t.name}),s=r(t.name,n);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:o}=a;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},en=k.createContext({});function de({className:t,...a}){const r=k.useId();return e.jsx(en.Provider,{value:{id:r},children:e.jsx("div",{"data-slot":"form-item",className:i("grid gap-2",t),...a})})}function pe({className:t,...a}){const{error:r,formItemId:n}=Ze();return e.jsx(be,{"data-slot":"form-label","data-error":!!r,className:i("data-[error=true]:text-destructive",t),htmlFor:n,...a})}function ue({...t}){const{error:a,formItemId:r,formDescriptionId:n,formMessageId:s}=Ze();return e.jsx(we.Root,{"data-slot":"form-control",id:r,"aria-describedby":a?`${n} ${s}`:`${n}`,"aria-invalid":!!a,...t})}function ge({className:t,...a}){const{formDescriptionId:r}=Ze();return e.jsx("p",{"data-slot":"form-description",id:r,className:i("text-muted-foreground text-sm",t),...a})}function me({className:t,...a}){const{error:r,formMessageId:n}=Ze(),s=r?String(r?.message??""):a.children;return s?e.jsx("p",{"data-slot":"form-message",id:n,className:i("text-destructive text-sm",t),...a,children:s}):null}function tn({className:t,containerClassName:a,...r}){return e.jsx(ga.OTPInput,{"data-slot":"input-otp",containerClassName:i("flex items-center gap-2 has-disabled:opacity-50",a),className:i("disabled:cursor-not-allowed",t),...r})}function an({className:t,...a}){return e.jsx("div",{"data-slot":"input-otp-group",className:i("flex items-center",t),...a})}function $e({index:t,className:a,...r}){const n=k.useContext(ga.OTPInputContext),{char:s,hasFakeCaret:o,isActive:l}=n?.slots[t]??{};return e.jsxs("div",{"data-slot":"input-otp-slot","data-active":l,className:i("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",a),...r,children:[s,o&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function xi({...t}){return e.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e.jsx(g.MinusIcon,{})})}const ea=G.cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function pi({className:t,variant:a,size:r,...n}){return e.jsx(Rs.Root,{"data-slot":"toggle",className:i(ea({variant:a,size:r,className:t})),...n})}const rn=k.createContext({size:"default",variant:"default",spacing:0});function Re({className:t,variant:a,size:r,spacing:n=0,children:s,...o}){return e.jsx(va.Root,{"data-slot":"toggle-group","data-variant":a,"data-size":r,"data-spacing":n,style:{"--gap":n},className:i("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",t),...o,children:e.jsx(rn.Provider,{value:{variant:a,size:r,spacing:n},children:s})})}function U({className:t,children:a,variant:r,size:n,...s}){const o=k.useContext(rn);return e.jsx(va.Item,{"data-slot":"toggle-group-item","data-variant":o.variant||r,"data-size":o.size||n,"data-spacing":o.spacing,className:i(ea({variant:o.variant||r,size:o.size||n}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",t),...s,children:a})}function Ce({tooltipContent:t,children:a}){return e.jsx(ye,{children:e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,children:a}),e.jsx(re,{children:t})]})})}function et({children:t,variant:a,asChild:r=!1,size:n,...s}){return e.jsx(R,{variant:a,size:n,...s,asChild:r,children:t})}function gi({children:t,variant:a,asChild:r=!1,size:n,tooltipContent:s,...o}){return e.jsx(Ce,{tooltipContent:s,children:e.jsx(et,{variant:a,size:n,...o,asChild:r,children:t})})}function tt({children:t,variant:a,asChild:r=!1,size:n,...s}){return e.jsx(R,{variant:a||"outline",size:n||"sm",...s,asChild:r,children:t})}function nn({children:t,variant:a,size:r,asChild:n=!1,tooltipContent:s,...o}){return e.jsx(Ce,{tooltipContent:s,children:e.jsx(tt,{variant:a,size:r,...o,asChild:n,children:t})})}function sn({children:t,variant:a,size:r,asChild:n=!1,...s}){return e.jsx(R,{variant:a||"outline",size:r||"icon",...s,asChild:n,children:t})}function Ne({children:t,tooltipContent:a,asChild:r=!1,variant:n,size:s,...o}){return e.jsx(Ce,{tooltipContent:a,children:e.jsx(sn,{variant:n,size:s,...o,asChild:r,children:t})})}function Et({actionMenus:t,extraActionParams:a}){const r=n=>(n=n.filter(s=>s?.visibility===void 0||s.visibility===!0||s.visibility&&s.visibility(...a?.arguments||[])),n.length===0?e.jsx(ie,{className:"text-center",children:"No action available."}):n.map((s,o)=>{if(s.type==="label")return e.jsx(Jt,{children:String(s.label)},o);if(s.type==="separator")return e.jsx(vt,{},o);if(s.type==="group"&&s.items)return e.jsx(Yt,{children:r(s.items)},o);if(s.items)return e.jsxs(Ya,{children:[e.jsx(Ja,{children:String(s.label)}),e.jsx(Ka,{children:e.jsx(Xa,{children:r(s.items)})})]},o);let l="";return typeof s.label=="function"?l=s.label(...a?.arguments||[]):l=s.label,e.jsxs(ie,{disabled:s.disabled,onClick:()=>s.onClick&&s.onClick(...a?.arguments||[]),children:[s.icon&&e.jsx(s.icon,{}),l]},o)}));return e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(Ne,{variant:"ghost",tooltipContent:"Actions",className:"h-8 w-8 p-0 border-0 bg-transparent text-foreground keross:text-white elevation-0 shadow-none hover:bg-transparent",children:e.jsx(g.MoreHorizontal,{})})}),e.jsx(Te,{className:"w-56",align:"end",children:r(t)})]})}const on=({title:t,description:a,fontSize:r="text-base",cancelText:n="",confirmText:s="",thirdOptionText:o="",onCancel:l,onConfirm:c,onThird:d})=>e.jsx(Ia,{open:!0,children:e.jsxs(Ta,{children:[e.jsxs(Pa,{children:[e.jsx(Ra,{className:r,children:t}),e.jsx(_a,{className:r,children:a})]}),e.jsxs(Da,{children:[n!=""&&e.jsx(za,{onClick:()=>{l&&l()},children:n}),o!=""&&e.jsx(Tt,{className:"bg-blue-500",color:"black",onClick:()=>{d&&d()},children:o}),s!=""&&e.jsx(Tt,{onClick:()=>{c&&c()},children:s})]})]})}),ln=m.createContext(void 0),hi=()=>{const t=m.useContext(ln);if(!t)throw new Error("useDialog must be used within a DialogProvider");return t},cn=({children:t})=>{const[a,r]=m.useState(null),n=o=>r(o),s=()=>r(null);return e.jsxs(ln.Provider,{value:{openDialog:n,closeDialog:s},children:[t,a&&e.jsx(on,{title:a.title,description:a.description,fontSize:a.fontSize||"text-base",cancelText:a.cancelText||"",confirmText:a.confirmText||"",thirdOptionText:a.thirdOptionText||"",onConfirm:()=>{a.onConfirm&&a.onConfirm(),s()},onCancel:()=>{a.onCancel&&a.onCancel(),s()},onThird:()=>{a.onThird&&a.onThird(),s()}})]})};function bi({placeholder:t,items:a,disabled:r,onSelect:n,defaultValue:s}){const[o,l]=m.useState(s??"");return e.jsxs(J,{children:[e.jsx(X,{asChild:!0,className:"w-full",children:e.jsxs(R,{variant:"outline",role:"combobox",className:i("justify-between",!o&&"text-muted-foreground","bg-secondary"),disabled:r===!0||typeof r=="function"&&r(),children:[o?a.find(c=>c.value===o)?.label||o:t,e.jsx(g.ChevronsUpDown,{className:"opacity-50"})]})}),e.jsx(Q,{className:"p-0",align:"start",children:e.jsxs(Y,{children:[e.jsx(ne,{placeholder:"Search..."}),e.jsxs(se,{children:[e.jsx(oe,{children:"No items found."}),e.jsx(ee,{children:a.map(c=>e.jsxs(K,{value:c.value,disabled:c.disabled===!0||typeof c.disabled=="function"&&c.disabled(c),onSelect:d=>{const u=a.find(f=>f.value.toLowerCase()===d.toLowerCase())?.value??d;l(u),n?.(u)},children:[c?.label||c.value,e.jsx(g.Check,{className:i("ml-auto",c.value===o?"opacity-100":"opacity-0")})]},c.value))})]})]})})]})}const ve=t=>t?.columnDef?.title||t?.columnDef?.header&&typeof t.columnDef.header=="string"&&t?.columnDef?.header||t.id;function dn({table:t}){return e.jsxs(J,{children:[e.jsx(Ce,{tooltipContent:"Column View",children:e.jsx(X,{asChild:!0,children:e.jsxs(tt,{children:[e.jsx(g.Settings2,{}),"View"]})})}),e.jsx(Q,{className:"w-[220px] p-0",align:"end",children:e.jsxs(Y,{children:[e.jsx(ne,{placeholder:"Search..."}),e.jsxs(se,{children:[e.jsx(oe,{children:"No results found."}),e.jsx(ee,{children:t.getAllColumns().filter(a=>typeof a.accessorFn<"u"&&a.getCanHide()).map(a=>{const r=a.getIsVisible();return e.jsxs(K,{onSelect:()=>{a.toggleVisibility(!r)},disabled:a.getIsGrouped(),children:[e.jsx("div",{className:i("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white",r?"bg-black dark:bg-white text-white dark:text-black":"opacity-50 [&_svg]:invisible"),children:e.jsx(g.Check,{})}),e.jsx("span",{className:"overflow-hidden text-ellipsis",title:ve(a),children:ve(a)})]},a.id)})})]})]})})]})}function un({column:t}){const a=t?.getFacetedUniqueValues(),r=new Set(t?.getFilterValue()),n=k.useMemo(()=>Array.from(t.getFacetedUniqueValues().keys()).sort().slice(0,5e3),[t.getFacetedUniqueValues()]);return e.jsxs(J,{children:[e.jsx(X,{asChild:!0,children:e.jsxs(nn,{variant:"dashed",tooltipContent:ve(t),children:[r?.size>0?e.jsx(g.X,{}):e.jsx(g.Plus,{}),ve(t),r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(wt,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(it,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:r.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:r.size>2?e.jsxs(it,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):n.filter(s=>r.has(s)).map(s=>e.jsx(it,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:s},s))})]})]})}),e.jsx(Q,{className:"max-w-[250px] p-0",align:"start",children:e.jsxs(Y,{children:[e.jsx(ne,{placeholder:ve(t)}),e.jsxs(se,{children:[e.jsx(oe,{children:"No results found."}),e.jsx(ee,{children:n.map(s=>{const o=r.has(s);return e.jsxs(K,{onSelect:()=>{o?r.delete(s):r.add(s);const l=Array.from(r);t?.setFilterValue(l.length?l:void 0)},children:[e.jsx("div",{className:i("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white",o?"bg-black dark:bg-white text-white dark:text-black":"opacity-50 [&_svg]:invisible"),children:e.jsx(g.Check,{})}),e.jsx("span",{className:"overflow-hidden text-ellipsis",title:s,children:s}),a?.get(s)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:a.get(s)})]},s)})})]}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ha,{}),e.jsx(ee,{children:e.jsx(K,{onSelect:()=>t?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})})]})}function mn({table:t}){const[a,r]=m.useState([]);return e.jsxs("div",{className:"flex-grow flex gap-3 items-center overflow-hidden",children:[e.jsxs(J,{children:[e.jsx(Ce,{tooltipContent:"Filter",children:e.jsx(X,{asChild:!0,children:e.jsxs(tt,{children:[e.jsx(g.Filter,{}),"Filter"]})})}),e.jsx(Q,{className:"w-[220px] p-0",align:"start",children:e.jsxs(Y,{children:[e.jsx(ne,{placeholder:"Search..."}),e.jsxs(se,{children:[e.jsx(oe,{children:"No results found."}),e.jsx(ee,{children:t.getAllColumns().filter(n=>typeof n.accessorFn<"u"&&n.getCanHide()).map(n=>{const s=new Set(a),o=s.has(n.id);return e.jsxs(K,{onSelect:()=>{o?s.delete(n.id):s.add(n.id),r([...s])},children:[e.jsx("div",{className:i("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white",o?"bg-black dark:bg-white text-white dark:text-black":"opacity-50 [&_svg]:invisible"),children:e.jsx(g.Check,{})}),e.jsx("span",{className:"overflow-hidden text-ellipsis",title:ve(n),children:ve(n)})]},n.id)})})]})]})})]}),e.jsx("div",{className:"flex-grow flex gap-3 items-center overflow-auto",children:a.map(n=>{const s=t.getColumn(n);if(s)return e.jsx(un,{column:s},n)})})]})}const fn=async t=>new Promise((a,r)=>{const n=new FileReader;n.onload=()=>{const o=n.result.split(",")[1];a({message:"File processed successfully",fileName:t.name,size:t.size,type:t.type,lastModified:t.lastModified,base64:o})},n.onerror=()=>r(n.error),n.readAsDataURL(t)});function vi(t){const a=atob(t.base64),r=new Array(a.length).fill(0).map((o,l)=>a.charCodeAt(l)),n=new Uint8Array(r),s=new Blob([n],{type:t.type});return URL.createObjectURL(s)}function ji({label:t="Upload File",isDrag:a=!1,onFileSelect:r}){const[n,s]=m.useState(!1),o=async f=>{if(!f)return;const h=await fn(f);await r(h)},l=f=>{if(!a)return;f.preventDefault(),s(!1);const h=f.dataTransfer.files?.[0];h&&o(h)},c=f=>{a&&(f.preventDefault(),s(!0))},d=()=>{a&&s(!1)},u=f=>{const h=f.target.files?.[0];h&&o(h)};return e.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[e.jsx("label",{className:"text-sm font-medium",children:t}),e.jsx("input",{type:"file",id:"fileInput",className:"hidden",onChange:u}),a?e.jsx("div",{className:`border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("lucide-react"),Zn=require("@radix-ui/react-accordion"),es=require("clsx"),ts=require("tailwind-merge"),as=require("@radix-ui/react-alert-dialog"),H=require("class-variance-authority"),rs=require("@radix-ui/react-aspect-ratio"),ns=require("@radix-ui/react-avatar"),ss=require("@radix-ui/react-checkbox"),os=require("@radix-ui/react-dialog"),is=require("@radix-ui/react-dropdown-menu"),ls=require("@radix-ui/react-hover-card"),ds=require("@radix-ui/react-label"),cs=require("@radix-ui/react-navigation-menu"),us=require("@radix-ui/react-popover"),ms=require("@radix-ui/react-progress"),xs=require("@radix-ui/react-radio-group"),fs=require("@radix-ui/react-scroll-area"),gs=require("@radix-ui/react-select"),ps=require("@radix-ui/react-separator"),hs=require("@radix-ui/react-slider"),$t=require("@radix-ui/react-slot"),bs=require("@radix-ui/react-switch"),vs=require("@radix-ui/react-tabs"),js=require("@radix-ui/react-toggle"),ws=require("@radix-ui/react-toggle-group"),Ns=require("@radix-ui/react-tooltip"),m=require("react"),Tt=require("react-day-picker"),Be=require("cmdk"),ba=require("sonner");require("react-dom");const Ae=require("vaul"),$e=require("react-hook-form"),va=require("input-otp"),L=require("@tanstack/react-table"),ae=require("react-router-dom"),ys=require("use-debounce"),Me=require("echarts"),ct=require("motion/react"),Cs=require("zxcvbn"),Ss=require("countries-list"),ks=require("country-flag-icons/react/3x2"),qe=require("date-fns"),W=require("react-big-calendar");require("react-big-calendar/lib/css/react-big-calendar.css");const Is=require("date-fns/locale"),be=require("react-router"),ja=require("axios"),qt=require("js-cookie"),Ts=require("jwt-decode"),Oe=require("@tanstack/react-query"),wa=require("react-cropper"),z=require("@assistant-ui/react"),Ds=require("motion/react-m"),Dt=require("@assistant-ui/react-markdown"),Ps=require("remark-gfm"),As=require("@assistant-ui/react-ai-sdk"),la=require("uuid");function B(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(a,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return a.default=t,Object.freeze(a)}const Rs=B(f),Xe=B(Zn),Ce=B(as),zs=B(rs),Wt=B(ns),da=B(ss),G=B(os),q=B(is),xt=B(ls),_s=B(ds),Re=B(cs),Qe=B(us),ca=B(ms),Pt=B(xs),Ye=B(fs),Y=B(gs),Fs=B(ps),it=B(hs),Se=B($t),ua=B(bs),bt=B(vs),Ms=B(js),Na=B(ws),Ge=B(Ns),k=B(m),Es=B(ks),At=B(Ds);function l(...t){return ts.twMerge(es.clsx(t))}function Ls({...t}){return e.jsx(Xe.Root,{"data-slot":"accordion",...t})}function Os({className:t,...a}){return e.jsx(Xe.Item,{"data-slot":"accordion-item",className:l("border-b last:border-b-0",t),...a})}function Bs({className:t,children:a,...r}){return e.jsx(Xe.Header,{className:"flex",children:e.jsxs(Xe.Trigger,{"data-slot":"accordion-trigger",className:l("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",t),...r,children:[a,e.jsx(f.ChevronDownIcon,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function Us({className:t,children:a,...r}){return e.jsx(Xe.Content,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...r,children:e.jsx("div",{className:l("pt-0 pb-4",t),children:a})})}function Vs(t,a,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t?.(s),r===!1||!s.defaultPrevented)return a?.(s)}}function Gs(t,a=[]){let r=[];function n(o,i){const c=k.createContext(i),u=r.length;r=[...r,i];const d=p=>{const{scope:w,children:N,...v}=p,y=w?.[t]?.[u]||c,b=k.useMemo(()=>v,Object.values(v));return e.jsx(y.Provider,{value:b,children:N})};d.displayName=o+"Provider";function x(p,w){const N=w?.[t]?.[u]||c,v=k.useContext(N);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[d,x]}const s=()=>{const o=r.map(i=>k.createContext(i));return function(c){const u=c?.[t]||o;return k.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return s.scopeName=t,[n,$s(s,...a)]}function $s(...t){const a=t[0];if(t.length===1)return a;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=n.reduce((c,{useScope:u,scopeName:d})=>{const p=u(o)[`__scope${d}`];return{...c,...p}},{});return k.useMemo(()=>({[`__scope${a.scopeName}`]:i}),[i])}};return r.scopeName=a.scopeName,r}var Je=globalThis?.document?k.useLayoutEffect:()=>{},qs=k[" useInsertionEffect ".trim().toString()]||Je;function Ws({prop:t,defaultProp:a,onChange:r=()=>{},caller:n}){const[s,o,i]=Hs({defaultProp:a,onChange:r}),c=t!==void 0,u=c?t:s;{const x=k.useRef(t!==void 0);k.useEffect(()=>{const p=x.current;p!==c&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=c},[c,n])}const d=k.useCallback(x=>{if(c){const p=Ks(x)?x(t):x;p!==t&&i.current?.(p)}else o(x)},[c,t,o,i]);return[u,d]}function Hs({defaultProp:t,onChange:a}){const[r,n]=k.useState(t),s=k.useRef(r),o=k.useRef(a);return qs(()=>{o.current=a},[a]),k.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}function Ks(t){return typeof t=="function"}function ma(t,a){if(typeof t=="function")return t(a);t!=null&&(t.current=a)}function Ys(...t){return a=>{let r=!1;const n=t.map(s=>{const o=ma(s,a);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<n.length;s++){const o=n[s];typeof o=="function"?o():ma(t[s],null)}}}}function ya(...t){return k.useCallback(Ys(...t),t)}var Xs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ht=Xs.reduce((t,a)=>{const r=$t.createSlot(`Primitive.${a}`),n=k.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(u,{...c,ref:o})});return n.displayName=`Primitive.${a}`,{...t,[a]:n}},{});function Qs(t,a){return k.useReducer((r,n)=>a[r][n]??r,t)}var Ca=t=>{const{present:a,children:r}=t,n=Js(a),s=typeof r=="function"?r({present:n.isPresent}):k.Children.only(r),o=ya(n.ref,Zs(s));return typeof r=="function"||n.isPresent?k.cloneElement(s,{ref:o}):null};Ca.displayName="Presence";function Js(t){const[a,r]=k.useState(),n=k.useRef(null),s=k.useRef(t),o=k.useRef("none"),i=t?"mounted":"unmounted",[c,u]=Qs(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const d=lt(n.current);o.current=c==="mounted"?d:"none"},[c]),Je(()=>{const d=n.current,x=s.current;if(x!==t){const w=o.current,N=lt(d);t?u("MOUNT"):N==="none"||d?.display==="none"?u("UNMOUNT"):u(x&&w!==N?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,u]),Je(()=>{if(a){let d;const x=a.ownerDocument.defaultView??window,p=N=>{const y=lt(n.current).includes(CSS.escape(N.animationName));if(N.target===a&&y&&(u("ANIMATION_END"),!s.current)){const b=a.style.animationFillMode;a.style.animationFillMode="forwards",d=x.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=b)})}},w=N=>{N.target===a&&(o.current=lt(n.current))};return a.addEventListener("animationstart",w),a.addEventListener("animationcancel",p),a.addEventListener("animationend",p),()=>{x.clearTimeout(d),a.removeEventListener("animationstart",w),a.removeEventListener("animationcancel",p),a.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[a,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:k.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function lt(t){return t?.animationName||"none"}function Zs(t){let a=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?t.ref:(a=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var eo=k[" useId ".trim().toString()]||(()=>{}),to=0;function ao(t){const[a,r]=k.useState(eo());return Je(()=>{r(n=>n??String(to++))},[t]),t||(a?`radix-${a}`:"")}var vt="Collapsible",[ro]=Gs(vt),[no,Kt]=ro(vt),Sa=k.forwardRef((t,a)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:i,...c}=t,[u,d]=Ws({prop:n,defaultProp:s??!1,onChange:i,caller:vt});return e.jsx(no,{scope:r,disabled:o,contentId:ao(),open:u,onOpenToggle:k.useCallback(()=>d(x=>!x),[d]),children:e.jsx(Ht.div,{"data-state":Xt(u),"data-disabled":o?"":void 0,...c,ref:a})})});Sa.displayName=vt;var ka="CollapsibleTrigger",Ia=k.forwardRef((t,a)=>{const{__scopeCollapsible:r,...n}=t,s=Kt(ka,r);return e.jsx(Ht.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Xt(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:a,onClick:Vs(t.onClick,s.onOpenToggle)})});Ia.displayName=ka;var Yt="CollapsibleContent",Ta=k.forwardRef((t,a)=>{const{forceMount:r,...n}=t,s=Kt(Yt,t.__scopeCollapsible);return e.jsx(Ca,{present:r||s.open,children:({present:o})=>e.jsx(so,{...n,ref:a,present:o})})});Ta.displayName=Yt;var so=k.forwardRef((t,a)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=t,i=Kt(Yt,r),[c,u]=k.useState(n),d=k.useRef(null),x=ya(a,d),p=k.useRef(0),w=p.current,N=k.useRef(0),v=N.current,y=i.open||c,b=k.useRef(y),C=k.useRef(void 0);return k.useEffect(()=>{const g=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(g)},[]),Je(()=>{const g=d.current;if(g){C.current=C.current||{transitionDuration:g.style.transitionDuration,animationName:g.style.animationName},g.style.transitionDuration="0s",g.style.animationName="none";const S=g.getBoundingClientRect();p.current=S.height,N.current=S.width,b.current||(g.style.transitionDuration=C.current.transitionDuration,g.style.animationName=C.current.animationName),u(n)}},[i.open,n]),e.jsx(Ht.div,{"data-state":Xt(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...o,ref:x,style:{"--radix-collapsible-content-height":w?`${w}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:y&&s})});function Xt(t){return t?"open":"closed"}var oo=Sa;const ft=H.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",dashed:"border border-dashed bg-background shadow-sm hover:bg-accent hover:text-accent-foreground ",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function R({className:t,variant:a="default",size:r="default",asChild:n=!1,...s}){const o=n?Se.Root:"button";return e.jsx(o,{"data-slot":"button","data-variant":a,"data-size":r,className:l(ft({variant:a,size:r,className:t})),...s})}function Da({...t}){return e.jsx(Ce.Root,{"data-slot":"alert-dialog",...t})}function io({...t}){return e.jsx(Ce.Trigger,{"data-slot":"alert-dialog-trigger",...t})}function Pa({...t}){return e.jsx(Ce.Portal,{"data-slot":"alert-dialog-portal",...t})}function Aa({className:t,...a}){return e.jsx(Ce.Overlay,{"data-slot":"alert-dialog-overlay",className:l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function Ra({className:t,size:a="default",...r}){return e.jsxs(Pa,{children:[e.jsx(Aa,{}),e.jsx(Ce.Content,{"data-slot":"alert-dialog-content","data-size":a,className:l("bg-background 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 group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg",t),...r})]})}function za({className:t,...a}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:l("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...a})}function _a({className:t,...a}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:l("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...a})}function Fa({className:t,...a}){return e.jsx(Ce.Title,{"data-slot":"alert-dialog-title",className:l("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...a})}function Ma({className:t,...a}){return e.jsx(Ce.Description,{"data-slot":"alert-dialog-description",className:l("text-muted-foreground text-sm",t),...a})}function lo({className:t,...a}){return e.jsx("div",{"data-slot":"alert-dialog-media",className:l("bg-muted mb-2 inline-flex size-16 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",t),...a})}function Rt({className:t,variant:a="default",size:r="default",...n}){return e.jsx(R,{variant:a,size:r,asChild:!0,children:e.jsx(Ce.Action,{"data-slot":"alert-dialog-action",className:l(t),...n})})}function Ea({className:t,variant:a="outline",size:r="default",...n}){return e.jsx(R,{variant:a,size:r,asChild:!0,children:e.jsx(Ce.Cancel,{"data-slot":"alert-dialog-cancel",className:l(t),...n})})}const co=H.cva("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function uo({className:t,variant:a,...r}){return e.jsx("div",{"data-slot":"alert",role:"alert",className:l(co({variant:a}),t),...r})}function mo({className:t,...a}){return e.jsx("div",{"data-slot":"alert-title",className:l("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...a})}function xo({className:t,...a}){return e.jsx("div",{"data-slot":"alert-description",className:l("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...a})}function La({className:t,size:a="default",...r}){return e.jsx(Wt.Root,{"data-slot":"avatar","data-size":a,className:l("group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",t),...r})}function Oa({className:t,...a}){return e.jsx(Wt.Image,{"data-slot":"avatar-image",className:l("aspect-square size-full",t),...a})}function Ba({className:t,...a}){return e.jsx(Wt.Fallback,{"data-slot":"avatar-fallback",className:l("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs",t),...a})}function fo({className:t,...a}){return e.jsx("span",{"data-slot":"avatar-badge",className:l("bg-primary text-primary-foreground ring-background absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full ring-2 select-none","group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden","group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2","group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",t),...a})}function go({className:t,...a}){return e.jsx("div",{"data-slot":"avatar-group",className:l("*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2",t),...a})}function po({className:t,...a}){return e.jsx("div",{"data-slot":"avatar-group-count",className:l("bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",t),...a})}const Ua=H.cva("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function ut({className:t,variant:a="default",asChild:r=!1,...n}){const s=r?Se.Root:"span";return e.jsx(s,{"data-slot":"badge","data-variant":a,className:l(Ua({variant:a}),t),...n})}function Va({className:t,classNames:a,showOutsideDays:r=!0,captionLayout:n="label",buttonVariant:s="ghost",formatters:o,components:i,...c}){const u=Tt.getDefaultClassNames();return e.jsx(Tt.DayPicker,{showOutsideDays:r,className:l("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:n,formatters:{formatMonthDropdown:d=>d.toLocaleString("default",{month:"short"}),...o},classNames:{root:l("w-fit",u.root),months:l("flex gap-4 flex-col md:flex-row relative",u.months),month:l("flex flex-col w-full gap-4",u.month),nav:l("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",u.nav),button_previous:l(ft({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",u.button_previous),button_next:l(ft({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",u.button_next),month_caption:l("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",u.month_caption),dropdowns:l("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",u.dropdowns),dropdown_root:l("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",u.dropdown_root),dropdown:l("absolute bg-popover inset-0 opacity-0",u.dropdown),caption_label:l("select-none font-medium",n==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",u.caption_label),table:"w-full border-collapse",weekdays:l("flex",u.weekdays),weekday:l("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",u.weekday),week:l("flex w-full mt-2",u.week),week_number_header:l("select-none w-(--cell-size)",u.week_number_header),week_number:l("text-[0.8rem] select-none text-muted-foreground",u.week_number),day:l("relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",c.showWeekNumber?"[&:nth-child(2)[data-selected=true]_button]:rounded-l-md":"[&:first-child[data-selected=true]_button]:rounded-l-md",u.day),range_start:l("rounded-l-md bg-accent",u.range_start),range_middle:l("rounded-none",u.range_middle),range_end:l("rounded-r-md bg-accent",u.range_end),today:l("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",u.today),outside:l("text-muted-foreground aria-selected:text-muted-foreground",u.outside),disabled:l("text-muted-foreground opacity-50",u.disabled),hidden:l("invisible",u.hidden),...a},components:{Root:({className:d,rootRef:x,...p})=>e.jsx("div",{"data-slot":"calendar",ref:x,className:l(d),...p}),Chevron:({className:d,orientation:x,...p})=>x==="left"?e.jsx(f.ChevronLeftIcon,{className:l("size-4",d),...p}):x==="right"?e.jsx(f.ChevronRightIcon,{className:l("size-4",d),...p}):e.jsx(f.ChevronDownIcon,{className:l("size-4",d),...p}),DayButton:Ga,WeekNumber:({children:d,...x})=>e.jsx("td",{...x,children:e.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:d})}),...i},...c})}function Ga({className:t,day:a,modifiers:r,...n}){const s=Tt.getDefaultClassNames(),o=k.useRef(null);return k.useEffect(()=>{r.focused&&o.current?.focus()},[r.focused]),e.jsx(R,{ref:o,variant:"ghost",size:"icon","data-day":a.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:l("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",s.day,t),...n})}function gt({className:t,...a}){return e.jsx("div",{"data-slot":"card",className:l("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...a})}function ho({className:t,...a}){return e.jsx("div",{"data-slot":"card-header",className:l("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function bo({className:t,...a}){return e.jsx("div",{"data-slot":"card-title",className:l("leading-none font-semibold",t),...a})}function vo({className:t,...a}){return e.jsx("div",{"data-slot":"card-description",className:l("text-muted-foreground text-sm",t),...a})}function jo({className:t,...a}){return e.jsx("div",{"data-slot":"card-action",className:l("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...a})}function $a({className:t,...a}){return e.jsx("div",{"data-slot":"card-content",className:l("px-6",t),...a})}function wo({className:t,...a}){return e.jsx("div",{"data-slot":"card-footer",className:l("flex items-center px-6 [.border-t]:pt-6",t),...a})}function Ze({className:t,...a}){return e.jsx(da.Root,{"data-slot":"checkbox",className:l("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e.jsx(da.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:e.jsx(f.CheckIcon,{className:"size-3.5"})})})}function jt({...t}){return e.jsx(G.Root,{"data-slot":"dialog",...t})}function qa({...t}){return e.jsx(G.Trigger,{"data-slot":"dialog-trigger",...t})}function Wa({...t}){return e.jsx(G.Portal,{"data-slot":"dialog-portal",...t})}function No({...t}){return e.jsx(G.Close,{"data-slot":"dialog-close",...t})}function Ha({className:t,...a}){return e.jsx(G.Overlay,{"data-slot":"dialog-overlay",className:l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function wt({className:t,children:a,showCloseButton:r=!0,...n}){return e.jsxs(Wa,{"data-slot":"dialog-portal",children:[e.jsx(Ha,{}),e.jsxs(G.Content,{"data-slot":"dialog-content",className:l("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",t),...n,children:[a,r&&e.jsxs(G.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(f.XIcon,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Qt({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-header",className:l("flex flex-col gap-2 text-center sm:text-left",t),...a})}function Ka({className:t,showCloseButton:a=!1,children:r,...n}){return e.jsxs("div",{"data-slot":"dialog-footer",className:l("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...n,children:[r,a&&e.jsx(G.Close,{asChild:!0,children:e.jsx(R,{variant:"outline",children:"Close"})})]})}function Nt({className:t,...a}){return e.jsx(G.Title,{"data-slot":"dialog-title",className:l("text-lg leading-none font-semibold",t),...a})}function Ya({className:t,...a}){return e.jsx(G.Description,{"data-slot":"dialog-description",className:l("text-muted-foreground text-sm",t),...a})}function Q({className:t,...a}){return e.jsx(Be.Command,{"data-slot":"command",className:l("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...a})}function yo({title:t="Command Palette",description:a="Search for a command to run...",children:r,className:n,showCloseButton:s=!0,...o}){return e.jsxs(jt,{...o,children:[e.jsxs(Qt,{className:"sr-only",children:[e.jsx(Nt,{children:t}),e.jsx(Ya,{children:a})]}),e.jsx(wt,{className:l("overflow-hidden p-0",n),showCloseButton:s,children:e.jsx(Q,{className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:r})})]})}function ie({className:t,...a}){return e.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[e.jsx(f.SearchIcon,{className:"size-4 shrink-0 opacity-50"}),e.jsx(Be.Command.Input,{"data-slot":"command-input",className:l("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...a})]})}function le({className:t,...a}){return e.jsx(Be.Command.List,{"data-slot":"command-list",className:l("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...a})}function de({...t}){return e.jsx(Be.Command.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function re({className:t,...a}){return e.jsx(Be.Command.Group,{"data-slot":"command-group",className:l("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...a})}function Xa({className:t,...a}){return e.jsx(Be.Command.Separator,{"data-slot":"command-separator",className:l("bg-border -mx-1 h-px",t),...a})}function X({className:t,...a}){return e.jsx(Be.Command.Item,{"data-slot":"command-item",className:l("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...a})}function Co({className:t,...a}){return e.jsx("span",{"data-slot":"command-shortcut",className:l("text-muted-foreground ml-auto text-xs tracking-widest",t),...a})}function ze({...t}){return e.jsx(q.Root,{"data-slot":"dropdown-menu",...t})}function Qa({...t}){return e.jsx(q.Portal,{"data-slot":"dropdown-menu-portal",...t})}function _e({...t}){return e.jsx(q.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function Fe({className:t,sideOffset:a=4,...r}){return e.jsx(q.Portal,{children:e.jsx(q.Content,{"data-slot":"dropdown-menu-content",sideOffset:a,className:l("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...r})})}function Jt({...t}){return e.jsx(q.Group,{"data-slot":"dropdown-menu-group",...t})}function ue({className:t,inset:a,variant:r="default",...n}){return e.jsx(q.Item,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":r,className:l("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n})}function So({className:t,children:a,checked:r,...n}){return e.jsxs(q.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:l("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),checked:r,...n,children:[e.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e.jsx(q.ItemIndicator,{children:e.jsx(f.CheckIcon,{className:"size-4"})})}),a]})}function ko({...t}){return e.jsx(q.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...t})}function Io({className:t,children:a,...r}){return e.jsxs(q.RadioItem,{"data-slot":"dropdown-menu-radio-item",className:l("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[e.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e.jsx(q.ItemIndicator,{children:e.jsx(f.CircleIcon,{className:"size-2 fill-current"})})}),a]})}function Zt({className:t,inset:a,...r}){return e.jsx(q.Label,{"data-slot":"dropdown-menu-label","data-inset":a,className:l("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...r})}function yt({className:t,...a}){return e.jsx(q.Separator,{"data-slot":"dropdown-menu-separator",className:l("bg-border -mx-1 my-1 h-px",t),...a})}function To({className:t,...a}){return e.jsx("span",{"data-slot":"dropdown-menu-shortcut",className:l("text-muted-foreground ml-auto text-xs tracking-widest",t),...a})}function Ja({...t}){return e.jsx(q.Sub,{"data-slot":"dropdown-menu-sub",...t})}function Za({className:t,inset:a,children:r,...n}){return e.jsxs(q.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":a,className:l("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[r,e.jsx(f.ChevronRightIcon,{className:"ml-auto size-4"})]})}function er({className:t,...a}){return e.jsx(q.SubContent,{"data-slot":"dropdown-menu-sub-content",className:l("bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),...a})}function Do({...t}){return e.jsx(xt.Root,{"data-slot":"hover-card",...t})}function Po({...t}){return e.jsx(xt.Trigger,{"data-slot":"hover-card-trigger",...t})}function Ao({className:t,align:a="center",sideOffset:r=4,...n}){return e.jsx(xt.Portal,{"data-slot":"hover-card-portal",children:e.jsx(xt.Content,{"data-slot":"hover-card-content",align:a,sideOffset:r,className:l("bg-popover text-popover-foreground 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 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...n})})}function K({className:t,type:a,...r}){return e.jsx("input",{type:a,"data-slot":"input",className:l("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...r})}function Ne({className:t,...a}){return e.jsx(_s.Root,{"data-slot":"label",className:l("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...a})}function Ro({className:t,children:a,viewport:r=!0,...n}){return e.jsxs(Re.Root,{"data-slot":"navigation-menu","data-viewport":r,className:l("group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",t),...n,children:[a,r&&e.jsx(ar,{})]})}function zo({className:t,...a}){return e.jsx(Re.List,{"data-slot":"navigation-menu-list",className:l("group flex flex-1 list-none items-center justify-center gap-1",t),...a})}function _o({className:t,...a}){return e.jsx(Re.Item,{"data-slot":"navigation-menu-item",className:l("relative",t),...a})}const tr=H.cva("group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1");function Fo({className:t,children:a,...r}){return e.jsxs(Re.Trigger,{"data-slot":"navigation-menu-trigger",className:l(tr(),"group",t),...r,children:[a," ",e.jsx(f.ChevronDownIcon,{className:"relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180","aria-hidden":"true"})]})}function Mo({className:t,...a}){return e.jsx(Re.Content,{"data-slot":"navigation-menu-content",className:l("data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto","group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none",t),...a})}function ar({className:t,...a}){return e.jsx("div",{className:l("absolute top-full left-0 isolate z-50 flex justify-center"),children:e.jsx(Re.Viewport,{"data-slot":"navigation-menu-viewport",className:l("origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]",t),...a})})}function Eo({className:t,...a}){return e.jsx(Re.Link,{"data-slot":"navigation-menu-link",className:l("data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",t),...a})}function Lo({className:t,...a}){return e.jsx(Re.Indicator,{"data-slot":"navigation-menu-indicator",className:l("data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",t),...a,children:e.jsx("div",{className:"bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md"})})}function J({...t}){return e.jsx(Qe.Root,{"data-slot":"popover",...t})}function Z({...t}){return e.jsx(Qe.Trigger,{"data-slot":"popover-trigger",...t})}function ee({className:t,align:a="center",sideOffset:r=4,...n}){return e.jsx(Qe.Portal,{children:e.jsx(Qe.Content,{"data-slot":"popover-content",align:a,sideOffset:r,className:l("bg-popover text-popover-foreground 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...n})})}function Oo({...t}){return e.jsx(Qe.Anchor,{"data-slot":"popover-anchor",...t})}function Bo({className:t,...a}){return e.jsx("div",{"data-slot":"popover-header",className:l("flex flex-col gap-1 text-sm",t),...a})}function Uo({className:t,...a}){return e.jsx("div",{"data-slot":"popover-title",className:l("font-medium",t),...a})}function Vo({className:t,...a}){return e.jsx("p",{"data-slot":"popover-description",className:l("text-muted-foreground",t),...a})}function Ct({className:t,value:a,...r}){return e.jsx(ca.Root,{"data-slot":"progress",className:l("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",t),...r,children:e.jsx(ca.Indicator,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(a||0)}%)`}})})}function Go({className:t,...a}){return e.jsx(Pt.Root,{"data-slot":"radio-group",className:l("grid gap-3",t),...a})}function $o({className:t,...a}){return e.jsx(Pt.Item,{"data-slot":"radio-group-item",className:l("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e.jsx(Pt.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e.jsx(f.CircleIcon,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}function qo({className:t,children:a,...r}){return e.jsxs(Ye.Root,{"data-slot":"scroll-area",className:l("relative",t),...r,children:[e.jsx(Ye.Viewport,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:a}),e.jsx(rr,{}),e.jsx(Ye.Corner,{})]})}function rr({className:t,orientation:a="vertical",...r}){return e.jsx(Ye.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:a,className:l("flex touch-none p-px transition-colors select-none",a==="vertical"&&"h-full w-2.5 border-l border-l-transparent",a==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",t),...r,children:e.jsx(Ye.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function nr({...t}){return e.jsx(Y.Root,{"data-slot":"select",...t})}function Wo({...t}){return e.jsx(Y.Group,{"data-slot":"select-group",...t})}function sr({...t}){return e.jsx(Y.Value,{"data-slot":"select-value",...t})}function or({className:t,size:a="default",children:r,...n}){return e.jsxs(Y.Trigger,{"data-slot":"select-trigger","data-size":a,className:l("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[r,e.jsx(Y.Icon,{asChild:!0,children:e.jsx(f.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function ir({className:t,children:a,position:r="item-aligned",align:n="center",...s}){return e.jsx(Y.Portal,{children:e.jsxs(Y.Content,{"data-slot":"select-content",className:l("bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,align:n,...s,children:[e.jsx(dr,{}),e.jsx(Y.Viewport,{className:l("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),e.jsx(cr,{})]})})}function Ho({className:t,...a}){return e.jsx(Y.Label,{"data-slot":"select-label",className:l("text-muted-foreground px-2 py-1.5 text-xs",t),...a})}function lr({className:t,children:a,...r}){return e.jsxs(Y.Item,{"data-slot":"select-item",className:l("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[e.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(Y.ItemIndicator,{children:e.jsx(f.CheckIcon,{className:"size-4"})})}),e.jsx(Y.ItemText,{children:a})]})}function Ko({className:t,...a}){return e.jsx(Y.Separator,{"data-slot":"select-separator",className:l("bg-border pointer-events-none -mx-1 my-1 h-px",t),...a})}function dr({className:t,...a}){return e.jsx(Y.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:l("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(f.ChevronUpIcon,{className:"size-4"})})}function cr({className:t,...a}){return e.jsx(Y.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:l("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(f.ChevronDownIcon,{className:"size-4"})})}function St({className:t,orientation:a="horizontal",decorative:r=!0,...n}){return e.jsx(Fs.Root,{"data-slot":"separator",decorative:r,orientation:a,className:l("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...n})}function ea({...t}){return e.jsx(G.Root,{"data-slot":"sheet",...t})}function ur({...t}){return e.jsx(G.Trigger,{"data-slot":"sheet-trigger",...t})}function Yo({...t}){return e.jsx(G.Close,{"data-slot":"sheet-close",...t})}function Xo({...t}){return e.jsx(G.Portal,{"data-slot":"sheet-portal",...t})}function Qo({className:t,...a}){return e.jsx(G.Overlay,{"data-slot":"sheet-overlay",className:l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function ta({className:t,children:a,side:r="right",showCloseButton:n=!0,...s}){return e.jsxs(Xo,{children:[e.jsx(Qo,{}),e.jsxs(G.Content,{"data-slot":"sheet-content",className:l("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",r==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",r==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",r==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...s,children:[a,n&&e.jsxs(G.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(f.XIcon,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function mr({className:t,...a}){return e.jsx("div",{"data-slot":"sheet-header",className:l("flex flex-col gap-1.5 p-4",t),...a})}function Jo({className:t,...a}){return e.jsx("div",{"data-slot":"sheet-footer",className:l("mt-auto flex flex-col gap-2 p-4",t),...a})}function aa({className:t,...a}){return e.jsx(G.Title,{"data-slot":"sheet-title",className:l("text-foreground font-semibold",t),...a})}function xr({className:t,...a}){return e.jsx(G.Description,{"data-slot":"sheet-description",className:l("text-muted-foreground text-sm",t),...a})}const It=768;function kt(){const[t,a]=k.useState(void 0);return k.useEffect(()=>{const r=window.matchMedia(`(max-width: ${It-1}px)`),n=()=>{a(window.innerWidth<It)};return r.addEventListener("change",n),a(window.innerWidth<It),()=>r.removeEventListener("change",n)},[]),!!t}function Le({className:t,...a}){return e.jsx("div",{"data-slot":"skeleton",className:l("bg-accent animate-pulse rounded-md",t),...a})}function Te({delayDuration:t=0,...a}){return e.jsx(Ge.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function ne({...t}){return e.jsx(Ge.Root,{"data-slot":"tooltip",...t})}function se({...t}){return e.jsx(Ge.Trigger,{"data-slot":"tooltip-trigger",...t})}function oe({className:t,sideOffset:a=0,children:r,...n}){return e.jsx(Ge.Portal,{children:e.jsxs(Ge.Content,{"data-slot":"tooltip-content",sideOffset:a,className:l("bg-foreground text-background 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...n,children:[r,e.jsx(Ge.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Zo="sidebar_state",ei=3600*24*7,ti="16rem",ai="18rem",ri="3rem",ni="b",fr=k.createContext(null);function et(){const t=k.useContext(fr);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function gr({defaultOpen:t=!0,open:a,onOpenChange:r,className:n,style:s,children:o,...i}){const c=kt(),[u,d]=k.useState(!1),[x,p]=k.useState(t),w=a??x,N=k.useCallback(C=>{const g=typeof C=="function"?C(w):C;r?r(g):p(g),document.cookie=`${Zo}=${g}; path=/; max-age=${ei}`},[r,w]),v=k.useCallback(()=>c?d(C=>!C):N(C=>!C),[c,N,d]);k.useEffect(()=>{const C=g=>{g.key===ni&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),v())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[v]);const y=w?"expanded":"collapsed",b=k.useMemo(()=>({state:y,open:w,setOpen:N,isMobile:c,openMobile:u,setOpenMobile:d,toggleSidebar:v}),[y,w,N,c,u,d,v]);return e.jsx(fr.Provider,{value:b,children:e.jsx(Te,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":ti,"--sidebar-width-icon":ri,...s},className:l("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...i,children:o})})})}function pr({side:t="left",variant:a="sidebar",collapsible:r="offcanvas",className:n,children:s,...o}){const{isMobile:i,state:c,openMobile:u,setOpenMobile:d}=et();return r==="none"?e.jsx("div",{"data-slot":"sidebar",className:l("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),...o,children:s}):i?e.jsx(ea,{open:u,onOpenChange:d,...o,children:e.jsxs(ta,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":ai},side:t,children:[e.jsxs(mr,{className:"sr-only",children:[e.jsx(aa,{children:"Sidebar"}),e.jsx(xr,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":c,"data-collapsible":c==="collapsed"?r:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:l("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",a==="floating"||a==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container",className:l("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"||a==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...o,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function hr({className:t,onClick:a,...r}){const{toggleSidebar:n}=et();return e.jsxs(R,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:l("size-7",t),onClick:s=>{a?.(s),n()},...r,children:[e.jsx(f.PanelLeftIcon,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function br({className:t,...a}){const{toggleSidebar:r}=et();return e.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:l("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...a})}function vr({className:t,...a}){return e.jsx("main",{"data-slot":"sidebar-inset",className:l("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...a})}function si({className:t,...a}){return e.jsx(K,{"data-slot":"sidebar-input","data-sidebar":"input",className:l("bg-background h-8 w-full shadow-none",t),...a})}function jr({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:l("flex flex-col gap-2 p-2",t),...a})}function wr({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:l("flex flex-col gap-2 p-2",t),...a})}function oi({className:t,...a}){return e.jsx(St,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:l("bg-sidebar-border mx-2 w-auto",t),...a})}function Nr({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:l("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function yr({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:l("relative flex w-full min-w-0 flex-col p-2",t),...a})}function ii({className:t,asChild:a=!1,...r}){const n=a?Se.Root:"div";return e.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:l("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...r})}function li({className:t,asChild:a=!1,...r}){const n=a?Se.Root:"button";return e.jsx(n,{"data-slot":"sidebar-group-action","data-sidebar":"group-action",className:l("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 md:after:hidden","group-data-[collapsible=icon]:hidden",t),...r})}function di({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:l("w-full text-sm",t),...a})}function Cr({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:l("flex w-full min-w-0 flex-col gap-1",t),...a})}function zt({className:t,...a}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:l("group/menu-item relative",t),...a})}const ci=H.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function _t({asChild:t=!1,isActive:a=!1,variant:r="default",size:n="default",tooltip:s,className:o,...i}){const c=t?Se.Root:"button",{isMobile:u,state:d}=et(),x=e.jsx(c,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":a,className:l(ci({variant:r,size:n}),o),...i});return s?(typeof s=="string"&&(s={children:s}),e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:x}),e.jsx(oe,{side:"right",align:"center",hidden:d!=="collapsed"||u,...s})]})):x}function ui({className:t,asChild:a=!1,showOnHover:r=!1,...n}){const s=a?Se.Root:"button";return e.jsx(s,{"data-slot":"sidebar-menu-action","data-sidebar":"menu-action",className:l("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 md:after:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",t),...n})}function mi({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:l("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...a})}function xi({className:t,showIcon:a=!1,...r}){const n=k.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return e.jsxs("div",{"data-slot":"sidebar-menu-skeleton","data-sidebar":"menu-skeleton",className:l("flex h-8 items-center gap-2 rounded-md px-2",t),...r,children:[a&&e.jsx(Le,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),e.jsx(Le,{className:"h-4 max-w-(--skeleton-width) flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})}function Sr({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:l("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...a})}function kr({className:t,...a}){return e.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:l("group/menu-sub-item relative",t),...a})}function Ir({asChild:t=!1,size:a="md",isActive:r=!1,className:n,...s}){const o=t?Se.Root:"a";return e.jsx(o,{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":r,className:l("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"text-xs",a==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",n),...s})}function fi({className:t,defaultValue:a,value:r,min:n=0,max:s=100,...o}){const i=k.useMemo(()=>Array.isArray(r)?r:Array.isArray(a)?a:[n,s],[r,a,n,s]);return e.jsxs(it.Root,{"data-slot":"slider",defaultValue:a,value:r,min:n,max:s,className:l("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",t),...o,children:[e.jsx(it.Track,{"data-slot":"slider-track",className:l("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:e.jsx(it.Range,{"data-slot":"slider-range",className:l("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:i.length},(c,u)=>e.jsx(it.Thumb,{"data-slot":"slider-thumb",className:"border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},u))]})}const Tr=k.createContext(void 0),Dr=({children:t})=>{const a=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",[r,n]=k.useState(()=>typeof window>"u"?"system":localStorage.getItem("theme")||"system"),[s,o]=k.useState(()=>r==="system"?a():r),i=k.useCallback(u=>{const d=document.documentElement;d.classList.remove("dark","blue-dark");let x;u==="system"?x=a():x=u,x==="dark"&&d.classList.add("dark"),x==="blue-dark"&&d.classList.add("blue-dark"),o(x)},[]);k.useEffect(()=>{i(r),localStorage.setItem("theme",r)},[r,i]),k.useEffect(()=>{if(r!=="system")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),d=()=>{i("system")};return u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[r,i]);const c=k.useMemo(()=>({theme:r,setTheme:n,resolvedTheme:s}),[r,s]);return e.jsx(Tr.Provider,{value:c,children:t})},Pr=()=>{const t=k.useContext(Tr);if(!t)throw new Error("useTheme must be used within ThemeProvider");return t},gi=({...t})=>{const{theme:a="system"}=Pr();return e.jsx(ba.Toaster,{theme:a,className:"toaster group",icons:{success:e.jsx(f.CircleCheckIcon,{className:"size-4"}),info:e.jsx(f.InfoIcon,{className:"size-4"}),warning:e.jsx(f.TriangleAlertIcon,{className:"size-4"}),error:e.jsx(f.OctagonXIcon,{className:"size-4"}),loading:e.jsx(f.Loader2Icon,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...t})};function pi({className:t,size:a="default",...r}){return e.jsx(ua.Root,{"data-slot":"switch","data-size":a,className:l("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",t),...r,children:e.jsx(ua.Thumb,{"data-slot":"switch-thumb",className:l("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function Ar({className:t,...a}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",t),...a})})}function Rr({className:t,...a}){return e.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",t),...a})}function zr({className:t,...a}){return e.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",t),...a})}function _r({className:t,...a}){return e.jsx("tfoot",{"data-slot":"table-footer",className:l("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",t),...a})}function Ue({className:t,...a}){return e.jsx("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...a})}function Ft({className:t,...a}){return e.jsx("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...a})}function We({className:t,...a}){return e.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...a})}function hi({className:t,...a}){return e.jsx("caption",{"data-slot":"table-caption",className:l("text-muted-foreground mt-4 text-sm",t),...a})}function Fr({className:t,orientation:a="horizontal",...r}){return e.jsx(bt.Root,{"data-slot":"tabs","data-orientation":a,orientation:a,className:l("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",t),...r})}const Mr=H.cva("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Er({className:t,variant:a="default",...r}){return e.jsx(bt.List,{"data-slot":"tabs-list","data-variant":a,className:l(Mr({variant:a}),t),...r})}function Lr({className:t,...a}){return e.jsx(bt.Trigger,{"data-slot":"tabs-trigger",className:l("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",t),...a})}function Mt({className:t,...a}){return e.jsx(bt.Content,{"data-slot":"tabs-content",className:l("flex-1 outline-none",t),...a})}function Or({className:t,...a}){return e.jsx("textarea",{"data-slot":"textarea",className:l("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...a})}function Et({...t}){return e.jsx(zs.Root,{"data-slot":"aspect-ratio",...t})}function Br({...t}){return e.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...t})}function Ur({className:t,...a}){return e.jsx("ol",{"data-slot":"breadcrumb-list",className:l("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",t),...a})}function Ve({className:t,...a}){return e.jsx("li",{"data-slot":"breadcrumb-item",className:l("inline-flex items-center gap-1.5",t),...a})}function Lt({asChild:t,className:a,...r}){const n=t?Se.Root:"a";return e.jsx(n,{"data-slot":"breadcrumb-link",className:l("hover:text-foreground transition-colors",a),...r})}function He({className:t,...a}){return e.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l("text-foreground font-normal",t),...a})}function mt({children:t,className:a,...r}){return e.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:l("[&>svg]:size-3.5",a),...r,children:t??e.jsx(f.ChevronRight,{})})}function Ot({className:t,...a}){return e.jsxs("span",{"data-slot":"breadcrumb-ellipsis",role:"presentation","aria-hidden":"true",className:l("flex size-9 items-center justify-center",t),...a,children:[e.jsx(f.MoreHorizontal,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"More"})]})}function Vr({...t}){return e.jsx(oo,{"data-slot":"collapsible",...t})}function Gr({...t}){return e.jsx(Ia,{"data-slot":"collapsible-trigger",...t})}function $r({...t}){return e.jsx(Ta,{"data-slot":"collapsible-content",...t})}function qr({...t}){return e.jsx(Ae.Drawer.Root,{"data-slot":"drawer",...t})}function Wr({...t}){return e.jsx(Ae.Drawer.Trigger,{"data-slot":"drawer-trigger",...t})}function Hr({...t}){return e.jsx(Ae.Drawer.Portal,{"data-slot":"drawer-portal",...t})}function Kr({...t}){return e.jsx(Ae.Drawer.Close,{"data-slot":"drawer-close",...t})}function Yr({className:t,...a}){return e.jsx(Ae.Drawer.Overlay,{"data-slot":"drawer-overlay",className:l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function Xr({className:t,children:a,...r}){return e.jsxs(Hr,{"data-slot":"drawer-portal",children:[e.jsx(Yr,{}),e.jsxs(Ae.Drawer.Content,{"data-slot":"drawer-content",className:l("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",t),...r,children:[e.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),a]})]})}function Qr({className:t,...a}){return e.jsx("div",{"data-slot":"drawer-header",className:l("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",t),...a})}function Jr({className:t,...a}){return e.jsx("div",{"data-slot":"drawer-footer",className:l("mt-auto flex flex-col gap-2 p-4",t),...a})}function Zr({className:t,...a}){return e.jsx(Ae.Drawer.Title,{"data-slot":"drawer-title",className:l("text-foreground font-semibold",t),...a})}function en({className:t,...a}){return e.jsx(Ae.Drawer.Description,{"data-slot":"drawer-description",className:l("text-muted-foreground text-sm",t),...a})}const tn=$e.FormProvider,an=k.createContext({}),xe=({...t})=>e.jsx(an.Provider,{value:{name:t.name},children:e.jsx($e.Controller,{...t})}),tt=()=>{const t=k.useContext(an),a=k.useContext(rn),{getFieldState:r}=$e.useFormContext(),n=$e.useFormState({name:t.name}),s=r(t.name,n);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:o}=a;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},rn=k.createContext({});function fe({className:t,...a}){const r=k.useId();return e.jsx(rn.Provider,{value:{id:r},children:e.jsx("div",{"data-slot":"form-item",className:l("grid gap-2",t),...a})})}function ve({className:t,...a}){const{error:r,formItemId:n}=tt();return e.jsx(Ne,{"data-slot":"form-label","data-error":!!r,className:l("data-[error=true]:text-destructive",t),htmlFor:n,...a})}function ge({...t}){const{error:a,formItemId:r,formDescriptionId:n,formMessageId:s}=tt();return e.jsx(Se.Root,{"data-slot":"form-control",id:r,"aria-describedby":a?`${n} ${s}`:`${n}`,"aria-invalid":!!a,...t})}function je({className:t,...a}){const{formDescriptionId:r}=tt();return e.jsx("p",{"data-slot":"form-description",id:r,className:l("text-muted-foreground text-sm",t),...a})}function pe({className:t,...a}){const{error:r,formMessageId:n}=tt(),s=r?String(r?.message??""):a.children;return s?e.jsx("p",{"data-slot":"form-message",id:n,className:l("text-destructive text-sm",t),...a,children:s}):null}function nn({className:t,containerClassName:a,...r}){return e.jsx(va.OTPInput,{"data-slot":"input-otp",containerClassName:l("flex items-center gap-2 has-disabled:opacity-50",a),className:l("disabled:cursor-not-allowed",t),...r})}function sn({className:t,...a}){return e.jsx("div",{"data-slot":"input-otp-group",className:l("flex items-center",t),...a})}function Ke({index:t,className:a,...r}){const n=k.useContext(va.OTPInputContext),{char:s,hasFakeCaret:o,isActive:i}=n?.slots[t]??{};return e.jsxs("div",{"data-slot":"input-otp-slot","data-active":i,className:l("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",a),...r,children:[s,o&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function bi({...t}){return e.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e.jsx(f.MinusIcon,{})})}const ra=H.cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function vi({className:t,variant:a,size:r,...n}){return e.jsx(Ms.Root,{"data-slot":"toggle",className:l(ra({variant:a,size:r,className:t})),...n})}const on=k.createContext({size:"default",variant:"default",spacing:0});function Ee({className:t,variant:a,size:r,spacing:n=0,children:s,...o}){return e.jsx(Na.Root,{"data-slot":"toggle-group","data-variant":a,"data-size":r,"data-spacing":n,style:{"--gap":n},className:l("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",t),...o,children:e.jsx(on.Provider,{value:{variant:a,size:r,spacing:n},children:s})})}function $({className:t,children:a,variant:r,size:n,...s}){const o=k.useContext(on);return e.jsx(Na.Item,{"data-slot":"toggle-group-item","data-variant":o.variant||r,"data-size":o.size||n,"data-spacing":o.spacing,className:l(ra({variant:o.variant||r,size:o.size||n}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",t),...s,children:a})}function De({tooltipContent:t,children:a}){return e.jsx(Te,{children:e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:a}),e.jsx(oe,{children:t})]})})}function at({children:t,variant:a,asChild:r=!1,size:n,...s}){return e.jsx(R,{variant:a,size:n,...s,asChild:r,children:t})}function ji({children:t,variant:a,asChild:r=!1,size:n,tooltipContent:s,...o}){return e.jsx(De,{tooltipContent:s,children:e.jsx(at,{variant:a,size:n,...o,asChild:r,children:t})})}function rt({children:t,variant:a,asChild:r=!1,size:n,...s}){return e.jsx(R,{variant:a||"outline",size:n||"sm",...s,asChild:r,children:t})}function ln({children:t,variant:a,size:r,asChild:n=!1,tooltipContent:s,...o}){return e.jsx(De,{tooltipContent:s,children:e.jsx(rt,{variant:a,size:r,...o,asChild:n,children:t})})}function dn({children:t,variant:a,size:r,asChild:n=!1,...s}){return e.jsx(R,{variant:a||"outline",size:r||"icon",...s,asChild:n,children:t})}function Ie({children:t,tooltipContent:a,asChild:r=!1,variant:n,size:s,...o}){return e.jsx(De,{tooltipContent:a,children:e.jsx(dn,{variant:n,size:s,...o,asChild:r,children:t})})}function Bt({actionMenus:t,extraActionParams:a}){const r=n=>(n=n.filter(s=>s?.visibility===void 0||s.visibility===!0||s.visibility&&s.visibility(...a?.arguments||[])),n.length===0?e.jsx(ue,{className:"text-center",children:"No action available."}):n.map((s,o)=>{if(s.type==="label")return e.jsx(Zt,{children:String(s.label)},o);if(s.type==="separator")return e.jsx(yt,{},o);if(s.type==="group"&&s.items)return e.jsx(Jt,{children:r(s.items)},o);if(s.items)return e.jsxs(Ja,{children:[e.jsx(Za,{children:String(s.label)}),e.jsx(Qa,{children:e.jsx(er,{children:r(s.items)})})]},o);let i="";return typeof s.label=="function"?i=s.label(...a?.arguments||[]):i=s.label,e.jsxs(ue,{disabled:s.disabled,onClick:()=>s.onClick&&s.onClick(...a?.arguments||[]),children:[s.icon&&e.jsx(s.icon,{}),i]},o)}));return e.jsxs(ze,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(Ie,{variant:"ghost",tooltipContent:"Actions",className:"h-8 w-8 p-0 border-0 bg-transparent text-foreground keross:text-white elevation-0 shadow-none hover:bg-transparent",children:e.jsx(f.MoreHorizontal,{})})}),e.jsx(Fe,{className:"w-56",align:"end",children:r(t)})]})}const cn=({title:t,description:a,fontSize:r="text-base",cancelText:n="",confirmText:s="",thirdOptionText:o="",onCancel:i,onConfirm:c,onThird:u})=>e.jsx(Da,{open:!0,children:e.jsxs(Ra,{children:[e.jsxs(za,{children:[e.jsx(Fa,{className:r,children:t}),e.jsx(Ma,{className:r,children:a})]}),e.jsxs(_a,{children:[n!=""&&e.jsx(Ea,{onClick:()=>{i&&i()},children:n}),o!=""&&e.jsx(Rt,{className:"bg-blue-500",color:"black",onClick:()=>{u&&u()},children:o}),s!=""&&e.jsx(Rt,{onClick:()=>{c&&c()},children:s})]})]})}),un=m.createContext(void 0),wi=()=>{const t=m.useContext(un);if(!t)throw new Error("useDialog must be used within a DialogProvider");return t},mn=({children:t})=>{const[a,r]=m.useState(null),n=o=>r(o),s=()=>r(null);return e.jsxs(un.Provider,{value:{openDialog:n,closeDialog:s},children:[t,a&&e.jsx(cn,{title:a.title,description:a.description,fontSize:a.fontSize||"text-base",cancelText:a.cancelText||"",confirmText:a.confirmText||"",thirdOptionText:a.thirdOptionText||"",onConfirm:()=>{a.onConfirm&&a.onConfirm(),s()},onCancel:()=>{a.onCancel&&a.onCancel(),s()},onThird:()=>{a.onThird&&a.onThird(),s()}})]})};function Ni({placeholder:t,items:a,disabled:r,onSelect:n,defaultValue:s}){const[o,i]=m.useState(s??"");return e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,className:"w-full",children:e.jsxs(R,{variant:"outline",role:"combobox",className:l("justify-between",!o&&"text-muted-foreground","bg-secondary"),disabled:r===!0||typeof r=="function"&&r(),children:[o?a.find(c=>c.value===o)?.label||o:t,e.jsx(f.ChevronsUpDown,{className:"opacity-50"})]})}),e.jsx(ee,{className:"p-0",align:"start",children:e.jsxs(Q,{children:[e.jsx(ie,{placeholder:"Search..."}),e.jsxs(le,{children:[e.jsx(de,{children:"No items found."}),e.jsx(re,{children:a.map(c=>e.jsxs(X,{value:c.value,disabled:c.disabled===!0||typeof c.disabled=="function"&&c.disabled(c),onSelect:u=>{const d=a.find(x=>x.value.toLowerCase()===u.toLowerCase())?.value??u;i(d),n?.(d)},children:[c?.label||c.value,e.jsx(f.Check,{className:l("ml-auto",c.value===o?"opacity-100":"opacity-0")})]},c.value))})]})]})})]})}const ye=t=>t?.columnDef?.title||t?.columnDef?.header&&typeof t.columnDef.header=="string"&&t?.columnDef?.header||t.id;function xn({table:t}){return e.jsxs(J,{children:[e.jsx(De,{tooltipContent:"Column View",children:e.jsx(Z,{asChild:!0,children:e.jsxs(rt,{children:[e.jsx(f.Settings2,{}),"View"]})})}),e.jsx(ee,{className:"w-[220px] p-0",align:"end",children:e.jsxs(Q,{children:[e.jsx(ie,{placeholder:"Search..."}),e.jsxs(le,{children:[e.jsx(de,{children:"No results found."}),e.jsx(re,{children:t.getAllColumns().filter(a=>typeof a.accessorFn<"u"&&a.getCanHide()).map(a=>{const r=a.getIsVisible();return e.jsxs(X,{onSelect:()=>{a.toggleVisibility(!r)},disabled:a.getIsGrouped(),children:[e.jsx("div",{className:l("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white",r?"bg-black dark:bg-white text-white dark:text-black":"opacity-50 [&_svg]:invisible"),children:e.jsx(f.Check,{})}),e.jsx("span",{className:"overflow-hidden text-ellipsis",title:ye(a),children:ye(a)})]},a.id)})})]})]})})]})}function fn({column:t}){const a=t?.getFacetedUniqueValues(),r=new Set(t?.getFilterValue()),n=k.useMemo(()=>Array.from(t.getFacetedUniqueValues().keys()).sort().slice(0,5e3),[t.getFacetedUniqueValues()]);return e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsxs(ln,{variant:"dashed",tooltipContent:ye(t),children:[r?.size>0?e.jsx(f.X,{}):e.jsx(f.Plus,{}),ye(t),r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(St,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(ut,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:r.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:r.size>2?e.jsxs(ut,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):n.filter(s=>r.has(s)).map(s=>e.jsx(ut,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:s},s))})]})]})}),e.jsx(ee,{className:"max-w-[250px] p-0",align:"start",children:e.jsxs(Q,{children:[e.jsx(ie,{placeholder:ye(t)}),e.jsxs(le,{children:[e.jsx(de,{children:"No results found."}),e.jsx(re,{children:n.map(s=>{const o=r.has(s);return e.jsxs(X,{onSelect:()=>{o?r.delete(s):r.add(s);const i=Array.from(r);t?.setFilterValue(i.length?i:void 0)},children:[e.jsx("div",{className:l("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white",o?"bg-black dark:bg-white text-white dark:text-black":"opacity-50 [&_svg]:invisible"),children:e.jsx(f.Check,{})}),e.jsx("span",{className:"overflow-hidden text-ellipsis",title:s,children:s}),a?.get(s)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:a.get(s)})]},s)})})]}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Xa,{}),e.jsx(re,{children:e.jsx(X,{onSelect:()=>t?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})})]})}function gn({table:t}){const[a,r]=m.useState([]);return e.jsxs("div",{className:"flex-grow flex gap-3 items-center overflow-hidden",children:[e.jsxs(J,{children:[e.jsx(De,{tooltipContent:"Filter",children:e.jsx(Z,{asChild:!0,children:e.jsxs(rt,{children:[e.jsx(f.Filter,{}),"Filter"]})})}),e.jsx(ee,{className:"w-[220px] p-0",align:"start",children:e.jsxs(Q,{children:[e.jsx(ie,{placeholder:"Search..."}),e.jsxs(le,{children:[e.jsx(de,{children:"No results found."}),e.jsx(re,{children:t.getAllColumns().filter(n=>typeof n.accessorFn<"u"&&n.getCanHide()).map(n=>{const s=new Set(a),o=s.has(n.id);return e.jsxs(X,{onSelect:()=>{o?s.delete(n.id):s.add(n.id),r([...s])},children:[e.jsx("div",{className:l("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white",o?"bg-black dark:bg-white text-white dark:text-black":"opacity-50 [&_svg]:invisible"),children:e.jsx(f.Check,{})}),e.jsx("span",{className:"overflow-hidden text-ellipsis",title:ye(n),children:ye(n)})]},n.id)})})]})]})})]}),e.jsx("div",{className:"flex-grow flex gap-3 items-center overflow-auto",children:a.map(n=>{const s=t.getColumn(n);if(s)return e.jsx(fn,{column:s},n)})})]})}const pn=async t=>new Promise((a,r)=>{const n=new FileReader;n.onload=()=>{const o=n.result.split(",")[1];a({message:"File processed successfully",fileName:t.name,size:t.size,type:t.type,lastModified:t.lastModified,base64:o})},n.onerror=()=>r(n.error),n.readAsDataURL(t)});function yi(t){const a=atob(t.base64),r=new Array(a.length).fill(0).map((o,i)=>a.charCodeAt(i)),n=new Uint8Array(r),s=new Blob([n],{type:t.type});return URL.createObjectURL(s)}function Ci({label:t="Upload File",isDrag:a=!1,onFileSelect:r}){const[n,s]=m.useState(!1),o=async x=>{if(!x)return;const p=await pn(x);await r(p)},i=x=>{if(!a)return;x.preventDefault(),s(!1);const p=x.dataTransfer.files?.[0];p&&o(p)},c=x=>{a&&(x.preventDefault(),s(!0))},u=()=>{a&&s(!1)},d=x=>{const p=x.target.files?.[0];p&&o(p)};return e.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[e.jsx("label",{className:"text-sm font-medium",children:t}),e.jsx("input",{type:"file",id:"fileInput",className:"hidden",onChange:d}),a?e.jsx("div",{className:`border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition
|
|
2
2
|
${n?"border-blue-600 bg-blue-50":"border-gray-300"}
|
|
3
|
-
`,onDragOver:c,onDragLeave:d,onDrop:l,onClick:()=>document.getElementById("fileInput")?.click(),children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(g.UploadCloud,{className:"w-10 h-10 text-blue-600"}),e.jsxs("p",{className:"text-gray-600",children:["Drag & drop your file here or"," ",e.jsx("span",{className:"text-blue-600 underline",children:"browse"})]})]})}):e.jsxs("div",{className:"border rounded-lg p-4 flex flex-col items-center gap-2 cursor-pointer text-center",onClick:()=>document.getElementById("fileInput")?.click(),children:[e.jsx(g.FileUp,{className:"w-8 h-8 text-blue-600"}),e.jsx("span",{className:"text-blue-600 underline",children:"Browse File"})]})]})}const wi=[15,20,30,40,50,100];function xn({table:t,extraParams:a}){return e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between ",children:[e.jsx("small",{className:"flex-1 px-2 text-gray-600 dark:text-gray-400",children:(a?.numberOfRows==null||a?.numberOfRows)&&a?.checkBoxColumn?e.jsxs(e.Fragment,{children:[t.getFilteredSelectedRowModel().rows.length," of"," ",t.getFilteredRowModel().rows.length," row(s) selected."]}):e.jsxs(e.Fragment,{children:["Total ",t.getFilteredRowModel().rows.length," no(s) of rows."]})}),(a?.pagination==null||a.pagination)&&e.jsxs("div",{className:"flex items-start md:items-center gap-3 flex-col md:flex-row ",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("small",{className:"text-gray-600 dark:text-gray-400",children:"Rows per page"}),(a?.rowsPerPage==null||a.rowsPerPage)&&e.jsxs(tr,{value:`${t.getState().pagination.pageSize}`,onValueChange:r=>{t.setPageSize(Number(r))},children:[e.jsx(rr,{className:"w-[70px] h-8",children:e.jsx(ar,{placeholder:t.getState().pagination.pageSize})}),e.jsx(nr,{side:"top",children:(a?.pageSizeArray||wi).map(r=>e.jsx(sr,{value:`${r}`,children:r},r))})]})]}),e.jsxs(e.Fragment,{children:[e.jsxs("small",{className:"flex w-[100px] items-center justify-center text-gray-600 dark:text-gray-400",children:["Page ",t.getState().pagination.pageIndex+1," of"," ",t.getPageCount()]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ne,{tooltipContent:"Go to first page",size:"icon-sm",className:"dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),children:e.jsx(g.ChevronsLeft,{})}),e.jsx(Ne,{tooltipContent:"Go to previous page",size:"icon-sm",className:"dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),children:e.jsx(g.ChevronLeft,{})}),e.jsx(Ne,{tooltipContent:"Go to next page",size:"icon-sm",className:"dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),children:e.jsx(g.ChevronRight,{})}),e.jsx(Ne,{tooltipContent:"Go to last page",size:"icon-sm",className:"dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground",onClick:()=>t.setPageIndex(t.getPageCount()-1),disabled:!t.getCanNextPage(),children:e.jsx(g.ChevronsRight,{})})]})]})]})]})}function pn({className:t,...a}){return e.jsxs("div",{className:"relative w-auto flex items-center",children:[e.jsx(g.Search,{className:"absolute left-2 mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx($,{className:G.cx("pl-8 h-8",t),...a})]})}function gn({table:t,extraParams:a}){return e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex-grow flex items-center justify-between gap-3 overflow-hidden",children:[(a?.defaultTools==null||a?.defaultTools==!0||Array.isArray(a?.defaultTools)&&a?.defaultTools?.includes("search"))&&e.jsx(pn,{placeholder:"Search ...",onChange:r=>t.setGlobalFilter(r.target.value),className:"max-w-sm"}),(a?.defaultTools==null||a?.defaultTools==!0||Array.isArray(a?.defaultTools)&&a?.defaultTools?.includes("filter"))&&e.jsx(mn,{table:t})]}),e.jsxs("div",{className:"flex gap-3",children:[a?.extraTools?.map((r,n)=>e.jsx(m.Fragment,{children:r},n)),(a?.defaultTools==null||a?.defaultTools==!0||Array.isArray(a?.defaultTools)&&a?.defaultTools?.includes("columnFilter"))&&e.jsx(dn,{table:t})]})]})}const Ni=m.forwardRef(({columns:t,data:a,extraParams:r,onTableReady:n},s)=>{const[o,l]=m.useState([]),[c,d]=m.useState(""),[u,f]=m.useState([]),[h,w]=m.useState({pageIndex:r?.pageIndex||0,pageSize:r?.pageSize||15}),[C,v]=m.useState({}),[N,b]=m.useState([]),[y,x]=m.useState({}),[I,j]=m.useState({});t=t.map(T=>(T?.filterFn||(T.filterFn="arrIncludesSome"),T)),m.useEffect(()=>{r?.checkBoxColumnCallback&&r.checkBoxColumnCallback(p.getFilteredSelectedRowModel().rows)},[I]),r?.checkBoxColumn&&t.splice(0,0,{id:"checkBoxColumn",header:({table:T})=>e.jsx(Xe,{checked:T.getIsAllPageRowsSelected()||T.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:P=>T.toggleAllPageRowsSelected(!!P),"aria-label":"Select all"}),cell:({row:T})=>e.jsx(e.Fragment,{children:e.jsx(Xe,{checked:T.getIsSelected(),onCheckedChange:P=>T.toggleSelected(!!P),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1}),(r?.actionMenu||r?.groupActionMenu)&&t.push({id:"DTActions",accessorKey:"Actions",header:()=>e.jsx("div",{className:"text-center",children:"Action"}),size:20,headerClassName:"text-center",cell:({row:T})=>T.getIsGrouped()?r?.groupActionMenu?e.jsx("div",{className:"text-end",children:e.jsx(Et,{actionMenus:r.groupActionMenu.items,extraActionParams:{arguments:[T.original,...r.groupActionMenu.extraArguments||[]]}})}):null:r?.actionMenu?e.jsx("div",{className:"text-center",children:e.jsx(Et,{actionMenus:r.actionMenu.items,extraActionParams:{arguments:[T.original,...r.actionMenu.extraArguments||[]]}})}):null,enableSorting:!1,enableHiding:!1}),m.useEffect(()=>{r?.onPaginationChange?.(h)},[h]);const p=B.useReactTable({data:a,columns:t,state:{sorting:o,globalFilter:c,columnFilters:u,columnVisibility:C,rowSelection:I,grouping:N,expanded:y,pagination:h},onPaginationChange:w,onSortingChange:l,onExpandedChange:x,onColumnFiltersChange:f,onColumnVisibilityChange:v,onGroupingChange:b,onGlobalFilterChange:d,onRowSelectionChange:j,getCoreRowModel:B.getCoreRowModel(),getPaginationRowModel:B.getPaginationRowModel(),getSortedRowModel:B.getSortedRowModel(),getFilteredRowModel:B.getFilteredRowModel(),getGroupedRowModel:B.getGroupedRowModel(),getExpandedRowModel:B.getExpandedRowModel(),getFacetedRowModel:B.getFacetedRowModel(),getFacetedUniqueValues:B.getFacetedUniqueValues(),getFacetedMinMaxValues:B.getFacetedMinMaxValues(),manualPagination:r?.pagination==null||r?.pagination==!0?void 0:!0});m.useImperativeHandle(s,()=>p);const[S,A]=m.useState([]),D=(T,P)=>{const V={id:P.id,title:ve(P.column)};T.dataTransfer.setData("headerObj",JSON.stringify(V)),T.dataTransfer.effectAllowed="move"},M=T=>{T.preventDefault();const P=JSON.parse(T.dataTransfer.getData("headerObj"));if(!S.find(V=>V.id==P.id)){A(z=>[...z,P]);const V=p.getColumn(P.id);V&&V.getToggleGroupingHandler()()}},O=T=>{T.preventDefault()},he=T=>{const P=S.filter(z=>z.id!==T);A(()=>[...P]);const V=p.getColumn(T);V&&V.getToggleGroupingHandler()()},[Ee,Pe]=m.useState(!1);return m.useEffect(()=>{Ee||Pe(!0),r?.defaultGroups&&p.setGrouping(r?.defaultGroups)},[]),m.useEffect(()=>{n&&n(p)},[n,p]),Ee&&e.jsxs("div",{className:"w-full h-full flex flex-col gap-3 justify-between",children:[e.jsxs("div",{className:"flex-grow flex flex-col gap-3 overflow-hidden",children:[(r?.defaultTools==null||r.defaultTools||r.extraTools)&&e.jsx(gn,{table:p,extraParams:r}),e.jsxs("div",{className:"flex-grow flex flex-col overflow-hidden",children:[(r?.grouping==null||r.grouping)&&e.jsx("div",{className:"w-full border-t min-h-10 px-2 py-1 flex gap-3 items-center text-sm bg-card-new",onDrop:M,onDragOver:O,children:S.length===0?"Drag a column header here to group its column":S.map((T,P)=>e.jsxs("div",{className:"rounded-md px-2 py-1 bg-muted text-muted-foreground flex gap-3 items-center",children:[T.title,e.jsx("span",{onClick:()=>he(T.id),children:e.jsx(g.X,{size:15})})]},T.id))}),e.jsx("div",{className:"flex-grow overflow-hidden",children:e.jsxs(Ar,{className:"border-t whitespace-nowrap bg-card-new",children:[(r?.header==null||r.header)&&e.jsx(Tr,{className:"sticky top-0 z-10 border-t bg-card-new",children:p.getHeaderGroups().map(T=>e.jsx(Oe,{className:G.cx(""),children:T.headers.map(P=>P.column.getIsGrouped()?P.column.getGroupedIndex()<S.length-1?null:e.jsx(Rt,{colSpan:S.length,className:G.cx("w-36 ","text-left")},P.id):e.jsx(Rt,{...r?.grouping==null||r.grouping?{onDragStart:V=>D(V,P),draggable:!0}:{},className:G.cx("text-left"),children:P.isPlaceholder?null:(r?.sorting==null||r.sorting)&&P.column.getCanSort()?e.jsxs("div",{onClick:P.column.getToggleSortingHandler(),className:G.cx("-mx-2 inline-flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1 hover:bg-muted"),children:[e.jsx("div",{children:B.flexRender(P.column.columnDef.header,P.getContext())}),P.column.getCanSort()?e.jsxs("div",{className:"-space-y-2",children:[e.jsx(g.ChevronUp,{className:G.cx("size-3.5 text-foreground",P.column.getIsSorted()==="desc"?"opacity-30":""),"aria-hidden":"true"}),e.jsx(g.ChevronDown,{className:G.cx("size-3.5 text-foreground",P.column.getIsSorted()==="asc"?"opacity-30":""),"aria-hidden":"true"})]}):null]}):B.flexRender(P.column.columnDef.header,P.getContext())},P.id))},T.id))}),e.jsx(Pr,{children:p.getRowModel().rows.length?p.getRowModel().rows.map(T=>T.getIsGrouped()?e.jsx(Oe,{children:T.getVisibleCells().map(P=>P.column.getIndex()<T.depth?null:e.jsx(We,{colSpan:P.column.getIndex()==T.depth?T.depth+1:void 0,className:P.column.getIndex()==T.depth?"w-36":"",children:P.getIsGrouped()?e.jsxs(R,{variant:"link",onClick:T.getToggleExpandedHandler(),className:"text-right text-foreground",style:{marginLeft:T.depth+"rem"},children:[T.getIsExpanded()?e.jsx(g.ChevronDown,{}):e.jsx(g.ChevronRight,{})," ",B.flexRender(P.column.columnDef.cell,P.getContext())," ","(",T.subRows.length,")"]}):P.column.id=="DTActions"?B.flexRender(P.column.columnDef.cell,P.getContext()):P.getIsAggregated()?B.flexRender(P.column.columnDef.aggregatedCell??P.column.columnDef.cell,P.getContext()):P.getIsPlaceholder()?null:B.flexRender(P.column.columnDef.cell,P.getContext())},P.id))},T.id):e.jsx(Oe,{className:G.cx(T.getIsSelected()?"bg-accent/10":""),...r?.checkBoxColumn&&{onClick:()=>T.toggleSelected(!T.getIsSelected())},children:T.getVisibleCells().map((P,V)=>e.jsxs(We,{className:G.cx(T.getIsSelected()?"relative":"",!(r?.actionMenu||r?.groupActionMenu)&&"py-2"),children:[V===0&&T.getIsSelected()&&e.jsx("div",{className:"absolute inset-y-0 left-0 w-0.5 bg-primary"}),P.getIsPlaceholder()?null:B.flexRender(P.column.columnDef.cell,P.getContext())]},P.id))},T.id)):e.jsx(Oe,{children:e.jsx(We,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})}),r?.footer&&e.jsx(Dr,{className:"sticky bottom-0 bg-background text-foreground",children:p.getFooterGroups().map(T=>e.jsx(Oe,{children:T.headers.map(P=>e.jsx(We,{children:P.isPlaceholder?null:e.jsx("div",{className:"flex items-center",children:B.flexRender(P.column.columnDef.footer,P.getContext())})}))}))})]})})]})]}),(r?.paginationBar==null||r.paginationBar)&&e.jsx(xn,{table:p,extraParams:r})]})});function yi(t){(t==null||typeof t!="object")&&(t={});const a={...t};return(a.toolbox===void 0||a.toolbox===null||typeof a.toolbox!="object")&&(a.toolbox={}),(a.toolbox.feature===void 0||a.toolbox.feature===null||typeof a.toolbox.feature!="object")&&(a.toolbox.feature={}),a}const Ci=m.forwardRef(({parentDivProps:t={},option:a={},style:r={},settings:n={},loading:s=!0,theme:o,isConfigurable:l=!1,resizeKey:c,onClick:d=()=>{},onConfigure:u=()=>{}},f)=>{const h=m.useRef(null),w=m.useRef(null),C=yi(a);return l&&(C.toolbox.feature={...C.toolbox.feature,myConfigureChartTool:{show:!0,title:"Configure Chart",icon:"image://data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXNldHRpbmdzLTIiPjxwYXRoIGQ9Ik0yMCA3aC05Ii8+PHBhdGggZD0iTTE0IDE3SDUiLz48Y2lyY2xlIGN4PSIxNyIgY3k9IjE3IiByPSIzIi8+PGNpcmNsZSBjeD0iNyIgY3k9IjciIHI9IjMiLz48L3N2Zz4=",onclick:()=>u?.()}}),m.useImperativeHandle(f,()=>({getChartObject:()=>h.current?De.getInstanceByDom(h.current):null,setOption:(v,N)=>{if(!h.current)return;De.getInstanceByDom(h.current)?.setOption(v,N)},resize:(v=0)=>{if(!h.current)return;const N=De.getInstanceByDom(h.current);N?.resize(),v&&setTimeout(()=>N?.resize(),v)},loadingVisible:v=>{if(!h.current)return;const N=De.getInstanceByDom(h.current);v?N?.showLoading():N?.hideLoading()},dispose:()=>{if(!h.current)return;De.getInstanceByDom(h.current)?.dispose()},on:(v,N)=>{if(!h.current)return;De.getInstanceByDom(h.current)?.on(v,N)}})),m.useEffect(()=>{h.current&&(w.current=De.init(h.current,o));const v=()=>w.current?.resize?.();return window.addEventListener("resize",v),()=>{w.current&&(w.current.dispose(),w.current=null),window.removeEventListener("resize",v)}},[o]),m.useEffect(()=>{w.current&&w.current.setOption(C,n),w.current&&w.current.on("click",d)},[a,n,o]),m.useEffect(()=>{w.current&&w.current.resize()},[c]),m.useEffect(()=>{w.current&&setTimeout(()=>{w.current?.resize()},500)},[]),e.jsx("div",{ref:h,...t,style:{width:"100%",height:"100%",...r}})});function hn({tooltipContent:t,fileNamePlaceholder:a,fileName:r,onFileNameChange:n,...s}){const o=m.useRef(null);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex",children:[e.jsx($,{ref:o,type:"file",className:"hidden",...s}),e.jsx("div",{className:"mx-1"}),e.jsx($,{className:"rounded-e-none",placeholder:a,onChange:(...l)=>n?.(...l),value:r}),e.jsx(Ne,{tooltipContent:t||"Browse File",onClick:()=>o?.current?.click(),className:"border-s-0 rounded-s-none",children:e.jsx(g.Upload,{})})]})})}const ki=(({blur:t=0,inactiveZone:a=.7,proximity:r=0,spread:n=20,variant:s="default",glow:o=!1,className:l,movementDuration:c=2,borderWidth:d=1,disabled:u=!0})=>{const f=m.useRef(null),h=m.useRef({x:0,y:0}),w=m.useRef(0),C=m.useCallback(v=>{f.current&&(w.current&&cancelAnimationFrame(w.current),w.current=requestAnimationFrame(()=>{const N=f.current;if(!N)return;const{left:b,top:y,width:x,height:I}=N.getBoundingClientRect(),j=v?.x??h.current.x,p=v?.y??h.current.y;v&&(h.current={x:j,y:p});const S=[b+x*.5,y+I*.5],A=Math.hypot(j-S[0],p-S[1]),D=.5*Math.min(x,I)*a;if(A<D){N.style.setProperty("--active","0");return}const M=j>b-r&&j<b+x+r&&p>y-r&&p<y+I+r;if(N.style.setProperty("--active",M?"1":"0"),!M)return;const O=parseFloat(N.style.getPropertyValue("--start"))||0,Ee=(180*Math.atan2(p-S[1],j-S[0])/Math.PI+90-O+180)%360-180,Pe=O+Ee;ot.animate(O,Pe,{duration:c,ease:[.16,1,.3,1],onUpdate:T=>{N.style.setProperty("--start",String(T))}})}))},[a,r,c]);return m.useEffect(()=>{if(u)return;const v=()=>C(),N=b=>C(b);return window.addEventListener("scroll",v,{passive:!0}),document.body.addEventListener("pointermove",N,{passive:!0}),()=>{w.current&&cancelAnimationFrame(w.current),window.removeEventListener("scroll",v),document.body.removeEventListener("pointermove",N)}},[C,u]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:i("pointer-events-none absolute -inset-px hidden rounded-[inherit] border opacity-0 transition-opacity",o&&"opacity-100",s==="white"&&"border-white",u&&"!block")}),e.jsx("div",{ref:f,style:{"--blur":`${t}px`,"--spread":n,"--start":"0","--active":"0","--glowingeffect-border-width":`${d}px`,"--repeating-conic-gradient-times":"5","--gradient":s==="white"?"repeating-conic-gradient(from 236.84deg at 50% 50%,var(--black),var(--black) calc(25% / var(--repeating-conic-gradient-times)))":"linear-gradient(54.29deg, #00A5E9 22.93%, #A020F0 32.97%, #55C8FF 52.28%, #A020F0 73.13%, #071182 88.57%)"},className:i("pointer-events-none absolute inset-0 rounded-[inherit] opacity-100 transition-opacity",o&&"opacity-100",t>0&&"blur-[var(--blur)] ",l,u&&"!hidden"),children:e.jsx("div",{className:i("glow","rounded-[inherit]",'after:content-[""] after:rounded-[inherit] after:absolute after:inset-[calc(-1*var(--glowingeffect-border-width))]',"after:[border:var(--glowingeffect-border-width)_solid_transparent]","after:[background:var(--gradient)] after:[background-attachment:fixed]","after:opacity-[var(--active)] after:transition-opacity after:duration-300","after:[mask-clip:padding-box,border-box]","after:[mask-composite:intersect]","after:[mask-image:linear-gradient(#0000,#0000),conic-gradient(from_calc((var(--start)-var(--spread))*1deg),#00000000_0deg,#fff,#00000000_calc(var(--spread)*2deg))]")})})]})});function mt({name:t,...a}){const r=As[t];return r?e.jsx(r,{...a}):(console.warn(`Icon "${t}" not found in lucide-react`),null)}const Ii=({size:t=48,className:a,visible:r=!0,...n})=>r?e.jsx("div",{className:"h-full w-full",children:e.jsx("div",{className:"absolute inset-0 flex justify-center items-center z-50",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,...n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:i("animate-spin",a),children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}):null;function Si({placeholder:t,items:a,onValueChange:r,defaultValue:n,defaultOptions:s=2}){const[o,l]=m.useState(n||[]),[c,d]=m.useState(""),u=m.useRef(null),[f,h]=m.useState(!1);m.useEffect(()=>{r(o)},[o,r]);const w=a.filter(x=>(x.label||x.value).toLowerCase().includes(c.toLowerCase())).sort((x,I)=>(x?.label??"").localeCompare(I?.label??"")),C=x=>{const I=x.currentTarget;I.scrollTop+=x.deltaY,x.preventDefault()},v=x=>{const I=o.includes(x)?o.filter(j=>j!==x):[...o,x];l(I)},[N,b]=m.useState(o.length),y=m.useCallback(()=>{const x=u.current;if(!x)return N;const I=Array.from(x.children),j=x.offsetWidth;let p=0,S=0;for(const A of I){const D=A.offsetWidth+4;if(p+D<=j)p+=D,S++;else break}return S},[N]);return m.useEffect(()=>{const x=u.current;if(!x)return;let I=null;const j=()=>{I&&cancelAnimationFrame(I),I=requestAnimationFrame(()=>{const S=y();b(A=>A!==S?S:A)})},p=new ResizeObserver(j);return p.observe(x),I=requestAnimationFrame(j),()=>{I&&cancelAnimationFrame(I),p.disconnect()}},[y]),e.jsxs(J,{open:f,onOpenChange:h,children:[e.jsx(X,{asChild:!0,className:"w-full",children:e.jsxs(R,{variant:"outline",role:"combobox",className:i("justify-between px-3 py-2 h-10",o.length===0&&"text-foreground/50","bg-secondary"),onClick:()=>h(x=>!x),children:[o.length>0?e.jsx(ye,{children:e.jsxs("div",{ref:u,className:"flex flex-wrap gap-2 items-center overflow-hidden flex-1",children:[o.slice(0,s).map(x=>{const I=a.find(j=>j.value===x)?.label||x;return e.jsxs("span",{className:"flex items-center px-2 py-1 bg-secondary text-secondary-foreground rounded-md truncate max-w-full",title:I,children:[e.jsx("span",{className:"truncate max-w-[120px]",children:I}),e.jsx("span",{role:"button",tabIndex:0,onClick:j=>{j.stopPropagation(),v(x)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),v(x))},className:"ml-1 text-muted-foreground hover:text-destructive cursor-pointer outline-none",children:e.jsx(g.X,{className:"w-3 h-3 ml-1"})})]},x)}),o.length>s&&e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,children:e.jsxs("span",{className:"px-2 py-1 bg-secondary text-secondary-foreground dark:bg-secondary dark:text-secondary-foreground keross:bg-secondary keross:text-secondary-foreground rounded-md cursor-pointer",children:["+",o.length-s," more"]})}),e.jsx(re,{className:"max-w-xs break-words",children:e.jsx("div",{onWheel:C,className:"flex flex-col gap-1 max-h-[200px] overflow-auto",children:o.slice(s).map(x=>e.jsx("span",{className:"text-sm",children:a.find(I=>I.value===x)?.label||x},x))})})]})]})}):e.jsx("span",{className:"flex-1 text-left truncate",children:t}),e.jsx(g.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Q,{className:"p-0 min-w-[var(--radix-popover-trigger-width)]",style:{width:"max-content",maxWidth:"min(500px, 90vw)"},align:"start",children:e.jsxs(Y,{onMouseDown:x=>x.preventDefault(),children:[e.jsx(ne,{placeholder:"Search...",value:c,onValueChange:d}),e.jsxs(se,{onWheel:C,className:"max-h-60 overflow-auto",children:[e.jsx(oe,{children:"No items found."}),e.jsx(ee,{children:w.map(x=>{const I=o.includes(x.value),j=x.disabled===!0||typeof x.disabled=="function"&&x.disabled(x);return e.jsxs(K,{value:x.label||x.value,disabled:j,onPointerDown:p=>{p.preventDefault(),p.stopPropagation()},onSelect:()=>{j||v(x.value)},className:i("flex items-center justify-between space-x-2",j&&"opacity-50 cursor-not-allowed"),children:[e.jsx(Xe,{checked:I,onCheckedChange:()=>{j||v(x.value)},onClick:p=>p.stopPropagation(),disabled:j}),e.jsx("span",{className:"flex-grow text-left",children:x?.label||x.value})]},x.value)})})]})]})})]})}function ta({text:t}){return e.jsxs("div",{className:"flex flex-col h-full justify-center text-center gap-2",children:[e.jsx(g.CircleAlert,{className:"text-muted-foreground mx-auto",size:36}),e.jsx("p",{className:"text-muted-foreground",children:t||"No Data Available"})]})}function Ai({title:t,subtitle:a,tools:r,children:n}){return t=t??"",a=a??"",e.jsxs("div",{className:"flex flex-col gap-4 h-full",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-1",children:[t&&e.jsx("h1",{className:"text-2xl font-semibold",children:t}),a&&e.jsx("p",{className:"text-muted-foreground/60",children:a})]}),e.jsx("div",{children:r})]}),n]})}const Ti=({value:t})=>{const a=js(t),r=a.score*100/4,n=()=>{switch(a.score){case 0:return"#828282";case 1:return"#EA1111";case 2:return"#FFAD00";case 3:return"#9bc158";case 4:return"#00b500";default:return""}};return e.jsx(e.Fragment,{children:e.jsx(jt,{value:r,className:n()})})},da=({code:t})=>{const a=_s[t];return e.jsx(a,{})};function Pi({className:t,...a}){const[r,n]=m.useState(!1),[s,o]=m.useState(""),[l,c]=m.useState("");return e.jsxs(J,{open:r,onOpenChange:n,children:[e.jsx(X,{asChild:!0,children:e.jsxs(R,{variant:"outline",role:"combobox","aria-expanded":r,className:"justify-between bg-secondary",children:[l?e.jsx(da,{code:l}):"...",e.jsx(g.ChevronsUpDown,{className:"opacity-50"})]})}),e.jsx(Q,{className:"p-0",align:"start",children:e.jsxs(Y,{filter:(d,u,f=[])=>(d.toLowerCase()+" "+f.join(" ").toLowerCase()).includes(u.toLowerCase())?1:0,children:[e.jsx(ne,{placeholder:"Search ...",className:"h-9"}),e.jsxs(se,{children:[e.jsx(oe,{children:"No country found."}),e.jsx(ee,{children:Object.entries(ws.countries).map(([d,u])=>u.phone.map(f=>e.jsxs(K,{value:`${f}`,keywords:[u.name,"+"+f.toString(),d],onSelect:h=>{o(h===s?"":h),c(d),n(!1)},children:[e.jsx(da,{code:d})," ",u.name," +",f]},f)))})]})]})})]})}function bn({buttonText:t,buttonIcon:a,buttonStyle:r,sheetContent:n,sheetDescription:s,sheetTitle:o,closeButton:l}){return e.jsxs(Xt,{children:[e.jsx(lr,{asChild:!0,children:e.jsxs(R,{variant:"outline",className:r,size:"icon-sm",children:[t,a]})}),e.jsxs(Qt,{className:"p-4",children:[e.jsx(Zt,{children:o}),n]})]})}const Di=g.icons;function Ri({title:t,iconName:a,iconSize:r,iconClass:n,primaryText:s,secondaryText:o,mainClassName:l="",loading:c,loadingMessage:d}){let u=null;return a&&(u=Di[a]),r=r===void 0?20:r,n=n??"",d=d??"Loading...",e.jsx(ut,{className:l,children:e.jsxs(Ua,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{children:t}),c?e.jsx(g.LoaderCircle,{size:r,className:"animate-spin "+n}):u&&e.jsx(u,{size:r,className:n})]}),e.jsx("div",{className:"mt-6 text-2xl font-semibold",children:c?"...":s}),o&&e.jsx("small",{className:"mt-2 text-gray-400",children:c?d:o})]})})}function vn({children:t,tabArray:a,pathName:r,tabListClass:n="",tabListInnerClass:s="",tabListButtonClass:o="",tabContentClass:l="",headerEndComponent:c,onTabChange:d,isSeperatePage:u=!1}){const[f,h]=m.useState(5),w=Nt(),[C,v]=m.useState([]),[N,b]=m.useState([]),[y,x]=m.useState(a.find(p=>p.default)?.tabId||a[0]?.tabId||"");m.useEffect(()=>{h(w?2:5)},[w]),m.useEffect(()=>{if(r&&u){const p=r.split("/").pop()||"";x(p)}},[r,u]),m.useEffect(()=>{v(a.slice(0,f)),b(a.slice(f))},[a,f]);const I=p=>{x(p),d?.(p)},j=p=>{v(S=>{const A=[...S],D=A.pop();return D&&b(M=>[...M.filter(O=>O.tabId!==p.tabId),D]),[...A,p]}),I(p.tabId)};return e.jsxs(Rr,{value:y,onValueChange:I,className:"w-full h-full flex flex-col",children:[e.jsxs(zr,{className:`flex justify-between items-center ${n}`,children:[e.jsxs("div",{className:`flex w-full ${s}`,children:[C.map(p=>e.jsx(Mr,{value:p.tabId,className:o,children:p.tabName},p.tabId)),N.length>0&&e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(et,{variant:"outline",size:"sm",className:"mt-1",children:e.jsx(g.EllipsisVertical,{})})}),e.jsx(Te,{children:N.map(p=>e.jsx(ie,{onClick:()=>j(p),children:p.tabName},p.tabId))})]})]}),c&&e.jsx("div",{children:c})]}),t?e.jsx(_t,{value:y,className:`mt-3 flex-grow overflow-auto h-full w-full ${l}`,children:e.jsx(ut,{className:"h-full w-full p-3",children:t})}):a.map(p=>e.jsx(_t,{value:p.tabId,className:`mt-3 flex-grow overflow-auto h-full w-full ${l}`,children:e.jsx(ut,{className:"h-full w-full p-3",children:p?.tabContent})},p.tabId))]})}function jn(){const{setTheme:t,theme:a,resolvedTheme:r}=Sr(),[n,s]=m.useState(!1);m.useEffect(()=>{s(!0)},[]);const o=a==="system"?r:a,l=C=>{const v=parseInt(C.slice(1),16),N=v>>16&255,b=v>>8&255,y=v>>0&255,[x,I,j]=[N,b,y].map(p=>(p=p/255,p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4)));return .2126*x+.7152*I+.0722*j},c=C=>l(C)>.25?"#000000":"#ffffff",d=m.useCallback(()=>{const C=localStorage.getItem("primary")||"#0f172b",v=localStorage.getItem("secondary")||"#1b2336",N=localStorage.getItem("tertiary")||"#1f3aba",b=localStorage.getItem("primaryChart")||"#00bc7d",y=localStorage.getItem("secondaryChart")||"#fd9a00",x=localStorage.getItem("tertiaryChart")||"#ad46ff";document.documentElement.style.setProperty("--background",C),document.documentElement.style.setProperty("--secondary",v),document.documentElement.style.setProperty("--card",v),document.documentElement.style.setProperty("--popover",v),document.documentElement.style.setProperty("--muted",v),document.documentElement.style.setProperty("--sidebar",v),document.documentElement.style.setProperty("--btn-secondary",v),document.documentElement.style.setProperty("--accent",N),document.documentElement.style.setProperty("--sidebar-primary",N),document.documentElement.style.setProperty("--sidebar-accent",N),document.documentElement.style.setProperty("--foreground",c(C)),document.documentElement.style.setProperty("--secondary-foreground",c(v)),document.documentElement.style.setProperty("--card-foreground",c(v)),document.documentElement.style.setProperty("--popover-foreground",c(v)),document.documentElement.style.setProperty("--muted-foreground",c(v)),document.documentElement.style.setProperty("--sidebar-foreground",c(v)),document.documentElement.style.setProperty("--accent-foreground",c(N)),document.documentElement.style.setProperty("--sidebar-primary-foreground",c(N)),document.documentElement.style.setProperty("--sidebar-accent-foreground",c(N)),document.documentElement.style.setProperty("--chart-1",b),document.documentElement.style.setProperty("--chart-2",y),document.documentElement.style.setProperty("--chart-3",x),document.documentElement.style.setProperty("--chart-4",b),document.documentElement.style.setProperty("--chart-5",y)},[]),u=m.useCallback(()=>{document.documentElement.style.removeProperty("--background"),document.documentElement.style.removeProperty("--secondary"),document.documentElement.style.removeProperty("--card"),document.documentElement.style.removeProperty("--popover"),document.documentElement.style.removeProperty("--muted"),document.documentElement.style.removeProperty("--sidebar"),document.documentElement.style.removeProperty("--btn-secondary"),document.documentElement.style.removeProperty("--accent"),document.documentElement.style.removeProperty("--sidebar-primary"),document.documentElement.style.removeProperty("--sidebar-accent"),document.documentElement.style.removeProperty("--foreground"),document.documentElement.style.removeProperty("--secondary-foreground"),document.documentElement.style.removeProperty("--card-foreground"),document.documentElement.style.removeProperty("--popover-foreground"),document.documentElement.style.removeProperty("--muted-foreground"),document.documentElement.style.removeProperty("--sidebar-foreground"),document.documentElement.style.removeProperty("--accent-foreground"),document.documentElement.style.removeProperty("--sidebar-primary-foreground"),document.documentElement.style.removeProperty("--sidebar-accent-foreground"),document.documentElement.style.removeProperty("--chart-1"),document.documentElement.style.removeProperty("--chart-2"),document.documentElement.style.removeProperty("--chart-3"),document.documentElement.style.removeProperty("--chart-4"),document.documentElement.style.removeProperty("--chart-5")},[]);m.useEffect(()=>{n&&o==="blue-dark"&&(document.documentElement.classList.add("blue-dark"),d())},[n,o,d]);const f=m.useCallback(C=>{t(C),(C==="light"||C==="dark")&&(document.documentElement.classList.remove("blue-dark"),u()),C==="blue-dark"&&(document.documentElement.classList.add("blue-dark"),d())},[t,d,u]);if(!n)return null;const h=o==="blue-dark"?e.jsx(g.Waves,{className:"h-5 w-5"}):o==="dark"?e.jsx(g.Moon,{className:"h-5 w-5"}):o==="light"?e.jsx(g.Sun,{className:"h-5 w-5"}):e.jsx(g.Laptop,{className:"h-5 w-5"}),w=C=>o===C;return e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(R,{variant:"outline",size:"icon","aria-label":"Change theme",title:`Theme: ${a==="system"?`system (${r})`:a}`,children:h})}),e.jsxs(Te,{align:"end",sideOffset:8,children:[e.jsxs(ie,{onClick:()=>f("light"),className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(g.Sun,{className:"mr-2 h-4 w-4"})," Light"]}),w("light")&&e.jsx(g.Check,{className:"h-4 w-4"})]}),e.jsxs(ie,{onClick:()=>f("dark"),className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(g.Moon,{className:"mr-2 h-4 w-4"})," Dark"]}),w("dark")&&e.jsx(g.Check,{className:"h-4 w-4"})]}),e.jsxs(ie,{onClick:()=>f("blue-dark"),className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(g.Waves,{className:"mr-2 h-4 w-4"})," Custom"]}),w("blue-dark")&&e.jsx(g.Check,{className:"h-4 w-4"})]})]})]})}function _i({title:t,value:a,valueText:r,isPercent:n=!0,className:s,titleClassName:o,valueClassName:l,progressClassName:c}){let d=a.toFixed(2);const u=d.split(".");return u[1]==="00"&&(d=u[0]),e.jsxs("div",{className:"w-full "+(s??""),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-muted-foreground text-sm "+(o??""),children:t}),e.jsx("div",{className:"text-sm "+(l??""),children:r??`${d}${n?"%":""}`})]}),e.jsx(jt,{value:a,className:"w-full mt-2 "+(c??"")})]})}function zi({processedData:t,value:a,onChange:r,placeholder:n="Select items...",searchPlaceholder:s="Search...",className:o}){const[l,c]=k.useState(!1),[d,u]=k.useState(""),{flatTree:f,itemMap:h}=t,w=k.useMemo(()=>{const b=new Map,y=new Set(a);return[...f].reverse().forEach(x=>{const I=h[x.id];if(!I||!x.treatAsParent||I.childrenIds.length===0)y.has(x.id)&&b.set(x.id,"checked");else{const j=I.childrenIds.map(A=>b.get(A)),p=j.filter(A=>A==="checked").length,S=j.filter(A=>A==="indeterminate").length;p===I.childrenIds.length?b.set(x.id,"checked"):(p>0||S>0)&&b.set(x.id,"indeterminate")}}),b},[a,f,h]),C=b=>{const y=new Set(a),x=w.get(b.id),I=!(x==="checked"||x==="indeterminate"),j=new Set,p=[...h[b.id]?.childrenIds||[]];for(;p.length>0;){const A=p.shift();j.add(A),(h[A]?.childrenIds||[]).forEach(M=>p.push(M))}I?(y.add(b.id),j.forEach(A=>y.add(A))):(y.delete(b.id),j.forEach(A=>y.delete(A)));let S=h[b.id]?.parentId;for(;S;){const A=h[S];A&&A.childrenIds.length>0&&(A.childrenIds.every(M=>y.has(M))?y.add(S):y.delete(S)),S=A?.parentId}r(Array.from(y))},v=k.useMemo(()=>{if(!d)return f.slice();const b=d.toLowerCase(),y=new Set;f.forEach(p=>{(p.title.toLowerCase().includes(b)||p.description.toLowerCase().includes(b)||p.index.toLowerCase().includes(b))&&y.add(p.id)});const x=new Set(y),I=p=>{let S=p;for(;S;){const A=h[S]?.parentId;if(A&&!x.has(A))x.add(A),S=A;else break}},j=p=>{const S=h[p]?.childrenIds||[];for(const A of S)x.has(A)||(x.add(A),j(A))};return y.forEach(p=>{I(p),j(p)}),f.filter(p=>x.has(p.id))},[d,f,h]),N=()=>{const b=a.filter(y=>{const x=h[y];return!x||x.childrenIds.length===0});if(b.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});if(b.length===1){const y=f.find(x=>x.id===b[0]);return y?y.index:n}return`${b.length} items selected`};return e.jsxs(J,{open:l,onOpenChange:c,children:[e.jsx(X,{asChild:!0,children:e.jsxs(R,{variant:"outline",role:"combobox","aria-expanded":l,className:i("w-full justify-between transition-all duration-150 ease-in-out border hover:border-primary hover:shadow-sm bg-secondary cursor-pointer",o),children:[e.jsx("span",{className:"truncate",children:N()}),e.jsx(g.ChevronsUpDown,{className:i("ml-2 h-4 w-4 shrink-0 transition-transform duration-200",l&&"rotate-180")})]})}),e.jsx(Q,{className:"w-[--radix-popover-trigger-width] p-0 max-h-[400px] overflow-y-auto",children:e.jsxs(Y,{children:[e.jsx(ne,{placeholder:s,value:d,onValueChange:u}),e.jsxs(se,{className:"transition-all duration-200 ease-in-out",children:[e.jsx(oe,{children:"No results found."}),v.map(b=>e.jsxs(K,{value:`${b.index} ${b.title} ${b.description}`,onSelect:()=>C(b),className:"flex items-start cursor-pointer gap-2",style:{paddingLeft:`${b.level*1.5+.75}rem`},children:[e.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 accent-primary border rounded",checked:w.get(b.id)==="checked",ref:y=>{y&&(y.indeterminate=w.get(b.id)==="indeterminate")},readOnly:!0}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-xs font-mono text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:b.index}),e.jsx("span",{className:"font-medium",children:b.title})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:b.description})]})]},b.id))]})]})})]})}function Mi({widgetData:t}){const a=t.slice(0,4),r=t.slice(4);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"flex flex-col md:flex-row gap-2",children:a.map(n=>e.jsxs("div",{className:"flex flex-1 flex-row justify-between border rounded-md p-2 border-l-4 border-l-primary",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(ye,{children:e.jsxs(te,{children:[e.jsx(ae,{className:"cursor-default select-text",children:e.jsx("p",{className:"font-medium max-w-[240px] truncate",children:n.widgetText})}),e.jsx(re,{children:e.jsx("p",{children:n.widgetText})})]})}),e.jsx("div",{children:n.onButtonClickfunc?e.jsx(R,{className:"px-0",variant:"link",onClick:()=>n.onButtonClickfunc?.({id:n.id}),children:n.widgetNumber}):e.jsx("p",{className:"inline-flex items-center justify-center px-0 py-2 text-sm font-medium border border-transparent rounded-md",children:n.widgetNumber})})]}),e.jsx("div",{className:"flex justify-end items-center",children:n.iconName&&e.jsx(mt,{name:n.iconName})})]},n.id))}),r.length>0&&e.jsx("div",{className:"flex flex-col md:flex-row gap-2",children:r.map(n=>e.jsxs("div",{className:"flex flex-1 flex-row justify-between border rounded-md p-2 border-l-4 border-l-primary",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(ye,{children:e.jsxs(te,{children:[e.jsx(ae,{className:"cursor-default select-text",children:e.jsx("p",{className:"font-medium max-w-[240px] truncate",children:n.widgetText})}),e.jsx(re,{children:e.jsx("p",{children:n.widgetText})})]})}),e.jsx("div",{children:n.onButtonClickfunc?e.jsx(R,{className:"px-0",variant:"link",onClick:()=>n.onButtonClickfunc?.({id:n.id}),children:n.widgetNumber}):e.jsx("p",{className:"inline-flex items-center justify-center px-0 py-2 text-sm font-medium border border-transparent rounded-md",children:n.widgetNumber})})]}),e.jsx("div",{className:"flex justify-end items-center",children:n.iconName&&e.jsx(mt,{name:n.iconName})})]},n.id))})]})}function Fi({onNavigate:t,onView:a,label:r,extraTools:n,view:s}){const[o,l]=m.useState(s===W.Views.DAY?"DAY":s===W.Views.WEEK?"WEEK":"MONTH");return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center mb-3",children:[e.jsxs(Re,{type:"single",variant:"outline",onValueChange:c=>{switch(c){case"PREV":t("PREV");break;case"NEXT":t("NEXT");break;case"TODAY":t("TODAY");break}},children:[e.jsx(U,{className:"rounded-e-none",value:"PREV",children:e.jsx(g.ChevronLeft,{size:16})}),e.jsx(U,{className:"rounded-none border-x",value:"NEXT",children:e.jsx(g.ChevronRight,{size:16})}),e.jsx(U,{className:"rounded-s-none",value:"TODAY",children:"Today"})]}),e.jsx("span",{className:"rbc-toolbar-label",children:r}),e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsxs(Re,{type:"single",variant:"outline",value:o,onValueChange:c=>{switch(l(c),c){case"DAY":a(W.Views.DAY);break;case"WEEK":a(W.Views.WEEK);break;case"MONTH":a(W.Views.MONTH);break}},children:[e.jsx(U,{className:"rounded-e-none",value:"MONTH",children:"Month"}),e.jsx(U,{className:"rounded-none border-x-0",value:"WEEK",children:"Week"}),e.jsx(U,{className:"rounded-s-none",value:"DAY",children:"Day"})]}),n?.map((c,d)=>e.jsx(m.Fragment,{children:c},d))]})]})})}function Ei({event:t,extraParamsEvent:a}){return e.jsxs("div",{className:"custom-event flex flex-row justify-between",children:[e.jsx("span",{className:"truncate w-auto",children:t.title}),e.jsxs("span",{className:"flex flex-row gap-1",children:[(a?.isEditableAll||t.isEditable)&&e.jsx(Ce,{tooltipContent:"Edit",children:e.jsx("button",{className:"event-edit-button w-fit px-1",onClick:r=>{r.stopPropagation(),a?.onEditEventClick?.(t)},children:e.jsx(g.SquarePen,{size:16})})}),e.jsx(Ce,{tooltipContent:"View",children:e.jsx("button",{className:"event-view-button w-fit px-1",onClick:r=>{r.stopPropagation(),a?.onViewEventClick?.(t)},children:e.jsx(g.Eye,{size:16})})})]})]})}const Oi={"en-US":ys.enUS},Li=W.dateFnsLocalizer({format:qe.format,parse:qe.parse,startOfWeek:qe.startOfWeek,getDay:qe.getDay,locales:Oi});function Bi({events:t,extraParamsEvent:a,extraTools:r}){const[n,s]=m.useState(a?.defaultView==="day"?W.Views.DAY:a?.defaultView==="week"?W.Views.WEEK:a?.defaultView==="month"?W.Views.MONTH:a?.defaultView==="work week"?W.Views.WORK_WEEK:a?.defaultView==="agenda"?W.Views.AGENDA:W.Views.MONTH),[o,l]=m.useState(new Date);return e.jsx(W.Calendar,{localizer:Li,events:t||[],startAccessor:"start",endAccessor:"end",views:[W.Views.DAY,W.Views.WEEK,W.Views.MONTH],view:n,onView:c=>s(c),date:o,onNavigate:c=>l(c),components:{event:c=>e.jsx(Ei,{event:c.event,extraParamsEvent:a}),toolbar:c=>e.jsx(Fi,{...c,extraTools:r,view:n})},style:{height:a?.height||"100%",margin:a?.margin||"0px"}})}const wn=m.createContext(void 0);function Nn({children:t}){const[a,r]=m.useState([]),n=c=>{r(d=>[...d.filter(f=>f.level<c.level),c])},s=(c,d)=>{r(d?c:u=>[...u,...c])},o=c=>{r(d=>[...d.filter(f=>f.level<=c.level)])},l=()=>{r([])};return e.jsx(wn.Provider,{value:{breadcrumbItems:a,addBreadcrumb:n,backBreadcrumb:o,addBreadcrumbItems:s,clearBreadcrumb:l},children:t})}function aa(){const t=m.useContext(wn);if(!t)throw new Error("useBreadcrumb must be used within a BreadcrumbProvider");return t}function yn(){const{breadcrumbItems:t,backBreadcrumb:a}=aa(),[r,n]=m.useState(!1),[s,o]=m.useState(2),l=Nt(),c=xe.useNavigate();m.useEffect(()=>{o(l?2:4)},[l]);const d=m.useMemo(()=>({firstVisibleBreadcrumbList:t.slice(0,2),hiddenBreadcrumbList:l?t.slice(2):t.slice(2,s),lastVisibleBreadcrumbList:t.length>2?t.slice(2-(t.length<s?t.length:s)):[]}),[t,s,l]);return!d||l==null||s==null?null:e.jsx(Er,{children:e.jsxs(Or,{children:[d.firstVisibleBreadcrumbList.map((u,f)=>f<t.length-1?e.jsxs(m.Fragment,{children:[e.jsx(Le,{children:u.href?e.jsx(Mt,{className:"max-w-20 truncate md:max-w-none cursor-pointer",onClick:()=>{a(u),u.href&&c(u.href)},children:u.title}):e.jsx(Ge,{className:"max-w-20 truncate md:max-w-none",children:u.title})}),e.jsx(lt,{},"firstsep"+f)]},"first"+f):e.jsx(Le,{children:e.jsx(Ge,{className:"max-w-20 truncate md:max-w-none",children:u.title})},"first"+f)),t.length>s?e.jsxs(e.Fragment,{children:[e.jsx(Le,{children:l?e.jsxs(Vr,{open:r,onOpenChange:n,children:[e.jsx(qr,{"aria-label":"Toggle Menu",children:e.jsx(Ft,{className:"h-4 w-4"})}),e.jsxs(Hr,{children:[e.jsxs(Kr,{className:"text-left",children:[e.jsx(Jr,{children:"Navigate to"}),e.jsx(Xr,{children:"Select a page to navigate to."})]}),e.jsx("div",{className:"grid gap-1 px-2 lg:px-4",children:d.hiddenBreadcrumbList.map((u,f)=>e.jsx("div",{children:u.clickable==!1?e.jsx("span",{className:"py-1 text-sm",children:u.title}):e.jsx(xe.Link,{to:u.href?u.href:"#",className:"py-1 text-sm",children:u.title})},f))}),e.jsx(Yr,{className:"pt-4",children:e.jsx(Gr,{asChild:!0,children:e.jsx(R,{variant:"outline",children:"Close"})})})]})]}):e.jsxs(Se,{open:r,onOpenChange:n,children:[e.jsx(Ae,{className:"flex items-center gap-1","aria-label":"Toggle menu",children:e.jsx(Ft,{className:"h-4 w-4"})}),e.jsx(Te,{align:"start",children:d.hiddenBreadcrumbList.map((u,f)=>e.jsx(ie,{children:u.href?e.jsx(xe.Link,{to:u.href?u.href:"#",children:u.title}):e.jsx("span",{children:u.title})},f))})]})}),!l&&e.jsx(lt,{})]}):null,!l&&d.lastVisibleBreadcrumbList.map((u,f)=>f==d.lastVisibleBreadcrumbList.length-1?e.jsx(Le,{children:e.jsx(Ge,{className:"max-w-20 truncate md:max-w-none cursor-pointer",children:u.title})},"last"+f):e.jsxs(m.Fragment,{children:[e.jsx(Le,{children:u.href?e.jsx(Mt,{className:"max-w-20 truncate md:max-w-none cursor-pointer",onClick:()=>{a(u),u.href&&c(u.href)},children:u.title}):e.jsx(Ge,{className:"max-w-20 truncate md:max-w-none",children:u.title})}),e.jsx(lt,{},"lastsep"+f)]},"last"+f))]},"BreadcrumbList1")},"Breadcrumb1")}function Ui({breadcrumb:t}){const{addBreadcrumb:a}=aa();return m.useEffect(()=>{a(t)},[t]),e.jsx(e.Fragment,{})}function Vi({formControl:t,name:a,label:r,placeholder:n,formDescription:s,items:o,disabled:l,onSelect:c}){return e.jsx(e.Fragment,{children:e.jsx(ce,{control:t,name:a,render:({field:d})=>e.jsxs(de,{className:"",children:[r&&e.jsx(e.Fragment,{children:e.jsx(pe,{children:r})}),e.jsxs(J,{children:[e.jsx(X,{asChild:!0,className:"w-full",children:e.jsx(ue,{children:e.jsxs(R,{variant:"outline",role:"combobox",className:i("justify-between",!d.value&&"text-muted-foreground"),disabled:l==!0||l&&l(...arguments),children:[d.value?o.find(u=>u.value===d.value)?.label||d.value:n,e.jsx(g.ChevronsUpDown,{className:"opacity-50"})]})})}),e.jsx(Q,{className:"p-0",align:"start",children:e.jsxs(Y,{children:[e.jsx(ne,{placeholder:"Search..."}),e.jsxs(se,{children:[e.jsx(oe,{children:"No items found."}),e.jsx(ee,{children:o.map(u=>e.jsxs(K,{value:u.value,disabled:u.disabled==!0||u.disabled&&u.disabled(u),onSelect:f=>{d.onChange(f),c&&c(f)},children:[u?.label||u.value,e.jsx(g.Check,{className:i("ml-auto",u.value===d.value?"opacity-100":"opacity-0")})]},u.value))})]})]})})]}),s&&e.jsx(ge,{children:s}),e.jsx(me,{})]})})})}function qi(t){const{field:a}=Ue.useController({name:t.name,control:t.formControl}),r=t.value!==void 0?t.value:a.value;return e.jsx(ce,{control:t.formControl,name:t.name,render:({field:n})=>e.jsxs(de,{className:"",children:[t.label&&e.jsxs(e.Fragment,{children:[e.jsx(pe,{children:t.label}),e.jsx("br",{})]}),e.jsxs(J,{children:[e.jsx(X,{asChild:!0,className:"w-full",children:e.jsx(ue,{children:e.jsxs(R,{variant:"outline",role:"combobox",className:i("justify-between",!r&&"text-muted-foreground"),disabled:typeof t.disabled=="function"?t.disabled():t.disabled,children:[r?t.items.find(s=>s.value===r)?.label||r:t.placeholder,e.jsx(g.ChevronsUpDown,{className:"opacity-50"})]})})}),e.jsx(Q,{className:"p-0",align:"start",children:e.jsxs(Y,{children:[e.jsx(ne,{placeholder:"Search..."}),e.jsxs(se,{children:[e.jsx(oe,{children:"No items found."}),e.jsx(ee,{children:t.items.map(s=>e.jsxs(K,{value:s.value,disabled:typeof s.disabled=="function"?s.disabled(s):s.disabled,onSelect:o=>{n.onChange(o),t.onSelect&&t.onSelect(o),t.onChange&&t.onChange(o)},children:[s?.label||s.value,e.jsx(g.Check,{className:i("ml-auto",s.value===r?"opacity-100":"opacity-0")})]},s.value))})]})]})})]}),t.formDescription&&e.jsx(ge,{children:t.formDescription}),e.jsx(me,{})]})})}function Wi({formControl:t,name:a,label:r,placeholder:n,dateFormat:s,calendarDateDisabled:o,formDescription:l,disabled:c}){return e.jsx(e.Fragment,{children:e.jsx(ce,{control:t,name:a,render:({field:d})=>e.jsxs(de,{children:[r&&e.jsx(e.Fragment,{children:e.jsx(pe,{children:r})}),e.jsxs(J,{children:[e.jsx(X,{asChild:!0,className:"w-full",children:e.jsx(ue,{children:e.jsxs(R,{variant:"outline",className:i(!d.value&&"text-foreground/50"),disabled:c,children:[d.value?qe.format(d.value,s||"PPP"):e.jsx("span",{children:n||"Pick a date"}),e.jsx(g.CalendarIcon,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Q,{className:"w-auto p-0",align:"start",children:e.jsx(La,{mode:"single",selected:d.value,onSelect:d.onChange,disabled:o,captionLayout:"dropdown",autoFocus:!0})})]}),l&&e.jsx(ge,{children:l}),e.jsx(me,{})]})})})}function Gi(){return e.jsx(e.Fragment,{})}function $i({formControl:t,label:a,formDescription:r,extraFormComponent:n,name:s,...o}){return e.jsx(e.Fragment,{children:e.jsx(ce,{control:t,name:s,render:({field:l})=>e.jsxs(de,{children:[a&&e.jsx(pe,{children:a}),e.jsx(ue,{children:e.jsx($,{...l,...o})}),n&&n(l.value),r&&e.jsx(ge,{children:r}),e.jsx(me,{})]})})})}function Hi({formControl:t,name:a,label:r,placeholder:n,formDescription:s,items:o=[],disabled:l,onSelect:c,defaultValue:d=[],defaultOptions:u=2}){const[f,h]=m.useState(""),w=m.useRef(null),C=o.filter(v=>v.label?.toLowerCase().includes(f.toLowerCase())).sort((v,N)=>(v?.label??"").localeCompare(N?.label??""));return e.jsx(ce,{control:t,name:a,render:({field:v})=>{m.useEffect(()=>{(v.value===void 0||v.value===null)&&d.length>0&&v.onChange(d)},[d,v]);const N=v.value||[],[b,y]=m.useState(N.length),x=m.useCallback(()=>{const p=w.current;if(!p)return b;const S=Array.from(p.children);let A=p.offsetWidth,D=0,M=0;for(const O of S){const he=O.offsetWidth+4;if(D+he<=A)D+=he,M++;else break}return M},[b]);m.useEffect(()=>{const p=w.current;if(!p)return;let S=null;const A=new ResizeObserver(()=>{S&&cancelAnimationFrame(S),S=requestAnimationFrame(()=>{const D=x();y(M=>M!==D?D:M)})});return A.observe(p),y(x()),()=>{S&&cancelAnimationFrame(S),A.disconnect()}},[x]);const I=p=>{let S;N.includes(p)?S=N.filter(A=>A!==p):S=[...N,p],v.onChange(S),c&&c(S)},j=p=>{const S=p.currentTarget;S.scrollTop+=p.deltaY,p.preventDefault()};return e.jsxs(de,{children:[r&&e.jsx(pe,{children:r}),e.jsxs(J,{children:[e.jsx(X,{asChild:!0,className:"w-full",children:e.jsx(ue,{children:e.jsxs(R,{variant:"outline",role:"combobox",className:i("justify-between",!N.length&&"text-foreground/50"),disabled:l===!0||l&&l(...arguments),children:[N.length>0?e.jsx(ye,{children:e.jsxs("div",{ref:w,className:"flex flex-wrap gap-2 items-center overflow-hidden",children:[N.slice(0,u).map(p=>{const S=o.find(A=>A.value===p)?.label||p;return e.jsxs("span",{className:"flex items-center px-2 py-1 bg-secondary text-secondary-foreground rounded-md truncate max-w-full",title:S,children:[e.jsx("span",{className:"truncate max-w-[120px]",children:S}),e.jsx("span",{role:"button",tabIndex:0,onClick:A=>{A.stopPropagation();const D=N.filter(M=>M!==p);v.onChange(D),c&&c(D)},onKeyDown:A=>{if(A.key==="Enter"||A.key===" "){A.preventDefault(),A.stopPropagation();const D=N.filter(M=>M!==p);v.onChange(D),c&&c(D)}},className:"ml-1 text-muted-foreground hover:text-destructive cursor-pointer outline-none",children:e.jsx(g.X,{className:"w-3 h-3 ml-1"})})]},p)}),N.length>u&&e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,children:e.jsxs("span",{className:"px-2 py-1 bg-secondary text-secondary-foreground rounded-md cursor-pointer",children:["+",N.length-u," more"]})}),e.jsx(re,{className:"max-w-xs break-words",children:e.jsx("div",{onWheel:j,className:"flex flex-col gap-1 max-h-[200px] overflow-auto",children:N.slice(u).map(p=>e.jsx("span",{className:"text-sm",children:o.find(S=>S.value===p)?.label||p},p))})})]})]})}):n,e.jsx(g.ChevronsUpDown,{className:"opacity-50"})]})})}),e.jsx(Q,{id:"multiSelectPopover",className:"p-0 min-w-[--radix-popover-trigger-width]",style:{width:"max-content",maxWidth:"min(500px, 90vw)"},align:"start",children:e.jsxs(Y,{id:"commandPopover",children:[e.jsx(ne,{placeholder:"Search...",value:f,onValueChange:h,autoFocus:!0}),e.jsxs(se,{className:"max-h-60 overflow-auto",onWheel:j,children:[e.jsx(oe,{children:"No items found."}),e.jsx(ee,{children:C.map(p=>{const S=N.includes(p.value);return e.jsxs(K,{value:p.label??"",onSelect:()=>I(p.value),className:"flex items-center space-x-2 justify-start",children:[e.jsx(Xe,{checked:S,onCheckedChange:()=>I(p.value),onClick:A=>A.stopPropagation()}),e.jsx("span",{children:p.label})]},p.value)})})]})]})})]}),s&&e.jsx(ge,{children:s}),e.jsx(me,{})]})}})}function Ki({formControl:t,label:a,formDescription:r,extraFormComponent:n,name:s,...o}){return e.jsx(e.Fragment,{children:e.jsx(ce,{control:t,name:s,render:({field:l})=>e.jsxs(de,{children:[a&&e.jsx(pe,{children:a}),e.jsx(ue,{children:e.jsx(tn,{maxLength:4,...l,children:e.jsxs(an,{children:[e.jsx($e,{index:0}),e.jsx($e,{index:1}),e.jsx($e,{index:2}),e.jsx($e,{index:3})]})})}),n&&n(l.value),r&&e.jsx(ge,{children:r}),e.jsx(me,{})]})})})}function Yi(){return e.jsx("div",{children:"FormPhoneInput"})}function Ji({formControl:t,name:a,label:r,formItemClass:n,formDescription:s,...o}){return e.jsx(e.Fragment,{children:e.jsx(ce,{control:t,name:a,render:({field:l})=>e.jsxs(de,{className:n,children:[r&&e.jsx(pe,{children:r}),e.jsx(ue,{children:e.jsx(Fr,{...l,...o})}),s&&e.jsx(ge,{children:s}),e.jsx(me,{})]})})})}function Xi({formControl:t,label:a,formDescription:r,extraFormComponent:n,name:s,...o}){const[l,c]=k.useState(!1),d=()=>c(!l);return e.jsx(e.Fragment,{children:e.jsx(ce,{control:t,name:s,render:({field:u})=>e.jsxs(de,{children:[a&&e.jsx(pe,{children:a}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{children:e.jsx($,{type:l?"text":"password",...u,...o,className:`${o.className||""} pr-10`})}),e.jsx(R,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 text-muted-foreground hover:bg-transparent!",onClick:d,children:l?e.jsx(g.EyeOff,{className:"h-4 w-4"}):e.jsx(g.Eye,{className:"h-4 w-4"})})]}),n&&n(u.value),r&&e.jsx(ge,{children:r}),e.jsx(me,{})]})})})}function Qi({rowCount:t=6,showToolbar:a=!0}){return e.jsxs("div",{className:"space-y-4",children:[a&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx(_e,{className:"h-8 w-64 rounded-md"}),e.jsx(_e,{className:"h-8 w-32 rounded-md"})]}),e.jsx("div",{className:"space-y-4",children:[...Array(t)].map((r,n)=>e.jsx("div",{className:"grid gap-4 items-center",children:e.jsx(_e,{className:"h-8 w-full"})},n))})]})}function Zi({count:t}){return e.jsx("div",{className:"flex flex-row gap-3 w-full",children:t>0&&Array.from({length:t}).map((a,r)=>e.jsx(_e,{className:"w-1/"+t+" flex flex-col md:flex-row gap-2 h-20",children:e.jsx("div",{className:"flex flex-1 flex-row justify-between border rounded-md p-2 bg-card-new"})},"widget_"+r))})}function Cn(){const t=Ue.useForm({defaultValues:{text:"",fileNames:[]}}),[a,r]=m.useState(""),[n,s]=m.useState([]),[o,l]=m.useState([]),[c,d]=m.useState(""),[u,f]=m.useState(!0),h=o.some(b=>b.progress<100),w=async(b,y)=>{const x=new FormData;x.append("file",y.file);try{const I=await ha.post("UPLOAD_ENDPOINT_URL",x,{onUploadProgress:j=>{const p=Math.round(j.loaded*100/(j.total||1));l(S=>S.map((A,D)=>D===b?{...A,progress:p}:A))}});l(j=>j.map((p,S)=>S===b?{...p,url:I.data.url,progress:100}:p))}catch(I){console.error("Upload failed:",I)}};m.useEffect(()=>{const b=new Date,y=String(b.getDate()).padStart(2,"0"),x=String(b.getMonth()+1).padStart(2,"0"),I=b.getFullYear();d(`${y}-${x}-${I}`)},[]),m.useEffect(()=>{o.forEach((b,y)=>{b.progress===0&&w(y,b)})},[o]);const C=()=>{if(a.trim()||o.length>0){const b={text:a.trim(),fileNames:o.map(y=>y.name)};s([b,...n]),r(""),l([]),f(!1)}},v=b=>{if(b.target.files){const y=Array.from(b.target.files).map(x=>({name:x.name,url:"",progress:0,file:x}));l(x=>[...x,...y]),f(!1)}},N=b=>{const y=o.filter((x,I)=>I!==b);l(y),y.length===0&&n.length===0&&f(!0)};return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col h-full w-full gap-3",children:[e.jsxs("div",{className:"flex-grow overflow-auto flex flex-col-reverse gap-2",children:[u&&e.jsx(ta,{text:"No files uploaded"}),o.length>0&&e.jsxs("div",{className:"p-2 my-1 rounded-md border",children:[e.jsx("p",{className:"font-bold",children:"Selected Files:"}),o.map((b,y)=>e.jsxs("div",{className:"flex flex-col mb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("a",{href:b.url,download:b.name,className:"text-sm text-blue-600 underline cursor-pointer",children:b.name}),e.jsx("button",{onClick:()=>N(y),className:"text-red-500 hover:text-red-800",children:e.jsx(g.X,{className:"w-4 h-4"})})]}),e.jsx(jt,{value:b.progress}),e.jsxs("p",{className:"text-xs text-gray-500",children:[b.progress,"% uploaded"]})]},y))]}),n.map((b,y)=>e.jsxs("div",{className:"border-b text-sm pb-2",children:[b.fileNames.map((x,I)=>e.jsx("p",{children:e.jsx("a",{href:o.find(j=>j.name===x)?.url||"#",download:x,className:"text-sm text-blue-500 underline cursor-pointer",children:x})},I)),e.jsx("p",{children:b.text||"(No Text)"}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("p",{children:"John Doe"}),e.jsx("p",{children:c})]})]},y))]}),e.jsx(Qr,{...t,children:e.jsx("form",{onSubmit:t.handleSubmit(()=>C()),children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(ce,{name:"text",render:({field:b})=>e.jsxs(de,{children:[e.jsx(ue,{children:e.jsx($,{id:"text-input",type:"text",value:a,onChange:y=>r(y.target.value),placeholder:"Type something..."})}),e.jsx(me,{})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{htmlFor:"file-upload",className:"sr-only",children:"Upload Files"}),e.jsx(R,{variant:"outline",asChild:!0,children:e.jsx("label",{htmlFor:"file-upload",className:"cursor-pointer",children:e.jsx(g.UploadIcon,{className:"w-5 h-5"})})}),e.jsx($,{id:"file-upload",type:"file",multiple:!0,onChange:v,className:"hidden"})]}),e.jsx(R,{variant:"outline",type:"submit",disabled:h,children:e.jsx(g.Send,{})})]})})})})]})})}const kn=m.createContext(void 0);function In({children:t}){const[a,r]=m.useState([]),[n,s]=m.useState(null),[o,l]=m.useState(null),c=C=>{r(v=>v.some(b=>b.title===C.title)?v.map(b=>b.title===C.title?{...b,...C}:b):[...v,C])},d=C=>{r(v=>v.filter(N=>N.title!==C))},u=(C,v)=>{r(N=>N.map(b=>b.title===C?{...b,...v}:b))},f=C=>{s(C)},h=C=>{l(C)},w=()=>{r([])};return e.jsx(kn.Provider,{value:{navItems:a,header:n,footer:o,setNavItems:r,addNavItem:c,removeNavItem:d,updateNavItem:u,clearNavItems:w,setSidebarHeader:f,setSidebarFooter:h},children:t})}function yt(){const t=m.useContext(kn);if(!t)throw new Error("useSidebarNav must be used within a SidebarNavProvider");return t}function Sn(){const{navItems:t}=yt();return e.jsx(jr,{children:e.jsx(wr,{children:t.map(a=>a.items&&a.items.length>0?e.jsx(Lr,{asChild:!0,defaultOpen:a.isActive,className:"group/collapsible",children:e.jsxs(Pt,{children:[e.jsx(Br,{asChild:!0,children:e.jsxs(Dt,{tooltip:a.title,children:[a.icon&&e.jsx(a.icon,{}),e.jsx("span",{children:a.title}),e.jsx(g.ChevronRight,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),e.jsx(Ur,{children:e.jsx(Nr,{children:a.items.map(r=>e.jsx(yr,{children:e.jsx(Cr,{asChild:!0,children:e.jsx(xe.Link,{to:r.url,children:e.jsx("span",{children:r.title})})})},r.title))})})]})},a.title):e.jsx(Pt,{children:e.jsx(Dt,{asChild:!0,tooltip:a.title,children:e.jsxs(xe.Link,{to:a.url,className:"flex items-center gap-2 w-full",children:[a.icon&&e.jsx(a.icon,{}),e.jsx("span",{children:a.title})]})})},a.title))})})}function An({...t}){const{navItems:a,header:r,footer:n}=yt();return!a||a.length===0?null:e.jsxs(fr,{className:"ml-12",collapsible:"offcanvas",...t,children:[r&&e.jsx(hr,{children:r}),e.jsx(vr,{children:e.jsx(Sn,{})}),n&&e.jsx(br,{children:n}),e.jsx(pr,{})]})}function Tn(){return e.jsx("footer",{className:"ml-12 flex border-t px-4 py-2 justify-center lg:justify-start",children:e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(g.Copyright,{className:"size-4"}),e.jsx("span",{children:"Powered By"}),e.jsx("a",{href:"https://keross.com",target:"_blank",children:"Keross"}),e.jsx("span",{className:"",children:"|"}),e.jsx("span",{id:"txtCopyrightYear",className:"",children:new Date().getFullYear()})]})})}const Z={IKON_ACCOUNT_API_URL:"",IKON_AUTH_API_URL:"",IKON_BASE_API_URL:"",IKON_PLATFORM_API_URL:"",IKON_PLATFORM_PROFILE_URL:"",IKON_PLATFORM_UI_URL:"",IKON_USER_API_URL:"",LOGIN_PAGE_URL:""},el=t=>{Z.IKON_BASE_API_URL=t.IKON_BASE_API_URL,Z.IKON_PLATFORM_API_URL=`${t.IKON_BASE_API_URL}/platform`,Z.IKON_AUTH_API_URL=`${Z.IKON_PLATFORM_API_URL}/auth`,Z.IKON_USER_API_URL=`${Z.IKON_PLATFORM_API_URL}/user`,Z.IKON_ACCOUNT_API_URL=`${Z.IKON_PLATFORM_API_URL}/account`,Z.LOGIN_PAGE_URL=t.LOGIN_PAGE_URL,Z.IKON_PLATFORM_UI_URL=t.IKON_PLATFORM_UI_URL,Z.IKON_PLATFORM_PROFILE_URL=`${t.IKON_PLATFORM_UI_URL}/setting/profile`},fe=()=>Z;function Pn(){const{navItems:t}=yt(),{IKON_PLATFORM_UI_URL:a}=fe();return e.jsx("header",{className:"ml-12 flex h-12 border-b shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 px-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[!t||t.length===0?e.jsx("div",{}):e.jsx(xr,{className:"-ml-1"}),!t||t.length===0?e.jsx("div",{}):e.jsx(wt,{orientation:"vertical",className:"mr-2 data-[orientation=vertical]:h-4"}),e.jsx(yn,{})]}),e.jsxs("div",{className:"ml-auto flex gap-4",children:[e.jsx(Ne,{className:"px-2!",tooltipContent:"Notifications",children:e.jsx(g.Bell,{})}),e.jsx(jn,{}),e.jsx(xe.Link,{to:`${a}/app-store`,children:e.jsxs(tt,{variant:"default",children:[e.jsx(g.Play,{}),"App Store"]})})]})]})})}const ra="ikoncloud_next_";function Ot(t,a,r){let n=r?.expires;!n&&r?.maxAge&&(n=r.maxAge/86400),Vt.set(ra+t,a,{httpOnly:!1,sameSite:"lax",expires:n})}function ft(t){return Vt.get(ra+t)}function Lt(t){Vt.remove(ra+t)}async function tl(){}async function at(t){const a=ft("accessToken"),r=ft("refreshToken");if(a)return a;if(r){const n=await Dn(r,t?.isSetToken);if(n)return n}return null}async function Dn(t,a){try{const r=await fetch(`${fe().IKON_AUTH_API_URL}/refresh-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(r.ok){const s=await r.json(),{accessToken:o,refreshToken:l,expiresIn:c,refreshExpiresIn:d}=s;if(a==null||a)try{Ot("accessToken",o,{maxAge:c}),Ot("refreshToken",l,{maxAge:d})}catch(u){console.error(u)}return o}}catch(r){console.error("Failed to refresh access token:",r)}return null}function Bt(){Lt("accessToken"),Lt("refreshToken"),typeof window<"u"&&(window.location.href=fe().LOGIN_PAGE_URL)}const Me=ha.create();Me.interceptors.request.use(async t=>{const a=await at();return a&&t.headers&&(t.headers.Authorization=`Bearer ${a}`),t},t=>Promise.reject(t instanceof Error?t:new Error(String(t))));Me.interceptors.response.use(t=>t,async t=>{const a=t.config;if(t.response?.status===401&&a&&!a._retry){a._retry=!0;try{const r=await at({isSetToken:!0});if(r&&a.headers)return a.headers.Authorization=`Bearer ${r}`,Me(a);Bt()}catch(r){return Bt(),Promise.reject(r instanceof Error?r:new Error(String(r)))}}return Promise.reject(t instanceof Error?t:new Error(String(t)))});function al(t){return ze.useQuery({queryKey:["profile",t],queryFn:async()=>{if(!t)throw new Error("No userId");return(await Me.get(`${fe().IKON_USER_API_URL}/${t}`)).data},enabled:!!t})}function rl(){const t=ze.useQueryClient();return ze.useMutation({mutationFn:async a=>{await Me.post(`${fe().IKON_AUTH_API_URL}/switch-account`,{targetAccountId:a})},onSuccess:()=>{t.invalidateQueries({queryKey:["accounts"]}),t.invalidateQueries({queryKey:["profile"]})}})}function nl(){return ze.useQuery({queryKey:["accountMembership"],queryFn:async()=>{const{data:t}=await Me.get(`${fe().IKON_BASE_API_URL}/platform/user/account-membership`);return t}})}function sl(){return ze.useQuery({queryKey:["softwares"],queryFn:async()=>{const{data:t}=await Me.get(`${fe().IKON_BASE_API_URL}/platform/software/accessible/user`);return t}})}const Rn=m.createContext(void 0);function ol({children:t}){const[a,r]=m.useState(null);m.useEffect(()=>{const c=ft("accessToken");if(c)try{const d=Cs.jwtDecode(c);r(u=>({...u,userId:d.sub,primaryAccountId:d.primaryAccountId,activeAccountId:d.activeAccountId,roles:d.platformAccess?.roles??[]}))}catch{r(null)}},[]);const n=a?.userId??"",{data:s,isSuccess:o}=al(n);m.useEffect(()=>{o&&s&&r(c=>({...c,...s}))},[o,s]);const l=c=>{r(d=>({...d,accountName:c}))};return e.jsx(Rn.Provider,{value:{user:a,setUser:r,setAccountName:l},children:t})}function _n(){const t=m.useContext(Rn);if(!t)throw new Error("useUser must be used within a UserProvider");return t}function il(){const{user:t,setUser:a}=_n();return e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-10 w-10",children:e.jsx(g.CircleUserRound,{className:"h-8 w-8"})})}),e.jsxs(Te,{className:"w-55 p-0",side:"right",sideOffset:8,children:[e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-card",children:[e.jsx(g.CircleUserRound,{className:"h-8 w-8"}),e.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-bold text-foreground blue-dark:text-muted-foreground truncate",children:t?.userName}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t?.userEmail}),e.jsx("p",{className:"text-sm text-muted-foreground font-semibold"})]})]}),e.jsx(vt,{className:"my-0"}),e.jsxs(ie,{onClick:async()=>{Bt()},className:"flex items-center gap-2 px-4 py-3 cursor-pointer focus:bg-destructive dark:focus:bg-destructive blue-dark:focus:bg-destructive",children:[e.jsx(g.LogOut,{className:"h-4 w-4 text-foreground"}),e.jsx("span",{children:"Log out"})]})]})]})}function ll(){const{data:t}=nl(),{user:a,setAccountName:r}=_n(),n=l=>l?l.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2):"UN";m.useEffect(()=>{const l=t?.find(c=>c.accountId===a?.activeAccountId);r(l?.accountName||"")},[t]);const{mutateAsync:s}=rl(),o=async l=>{await s(l.accountId),r(l.accountName)};return e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(R,{variant:"default",className:"mb-4 h-8 w-8 rounded-lg p-0",disabled:!a?.accountName,children:e.jsx("span",{className:"text-base font-medium text-accent-background",children:a?n(a.accountName):"..."})})}),e.jsxs(Te,{className:"w-55",side:"right",sideOffset:8,align:"start",children:[e.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-foreground",children:"Accounts"}),t?.map(l=>e.jsxs(ie,{className:"flex items-center justify-between cursor-pointer",onClick:async()=>{try{await o(l),window.location.reload()}catch(c){console.error("Switch account failed",c)}},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-6 w-6 rounded bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-xs font-medium text-primary",children:n(l.accountName)})}),e.jsx("span",{className:"text-sm",children:l.accountName})]}),a?.activeAccountId===l.accountId&&e.jsx(g.Check,{className:"h-4 w-4 text-primary"})]},l.accountId))]})]})}function cl(){const{IKON_PLATFORM_UI_URL:t}=fe(),{data:a}=sl();function r(n){return n.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join("")}return e.jsxs(e.Fragment,{children:[" ",e.jsx("nav",{className:"flex flex-col gap-1",children:e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,className:"h-8 w-8",children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-10 w-10",asChild:!0,children:e.jsxs(xe.Link,{to:`${t}/home`,children:[e.jsx(g.Home,{className:"h-8 w-8"}),e.jsx("span",{className:"sr-only",children:"Home"})]})})}),e.jsx(re,{side:"right",sideOffset:5,children:"Home"})]},"home")}),e.jsx("nav",{className:"flex flex-col gap-1 flex-1",children:a?.map(n=>{if(!n.visible)return null;const s=!!(n.icon&&n.icon.trim()!=="");return e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,className:"h-8 w-8",children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-10 w-10",asChild:!0,children:e.jsxs(xe.Link,{to:n.url??"#",children:[s?e.jsx(mt,{name:r(n.icon??""),className:"h-8 w-8"}):e.jsx(g.FolderCode,{className:"h-8 w-8"}),e.jsx("span",{className:"sr-only",children:n.softwareName})]})})}),e.jsx(re,{side:"right",sideOffset:5,children:n.softwareName})]},n.softwareName)})})]})}const zn=()=>{const{IKON_PLATFORM_UI_URL:t}=fe();return e.jsx(ye,{delayDuration:0,children:e.jsxs("aside",{className:"fixed left-0 top-0 z-20 h-screen w-12 border-r border-border bg-sidebar text-sidebar-foreground flex flex-col items-center py-4 ",children:[e.jsx(ll,{}),e.jsx(cl,{}),e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,className:"h-8 w-8",children:e.jsx(R,{variant:"ghost",className:"h-10 w-10",asChild:!0,children:e.jsxs(xe.Link,{to:`${t}/settings`,children:[e.jsx(g.Settings,{className:"h-8 w-8"}),e.jsx("span",{className:"sr-only",children:"Settings"})]})})}),e.jsx(re,{side:"right",sideOffset:5,children:"Settings"})]},"settings"),e.jsx(il,{})]})})};function Mn({children:t}){return e.jsxs(e.Fragment,{children:[e.jsx(zn,{}),e.jsx(mr,{children:e.jsx(cn,{children:e.jsxs(In,{children:[e.jsx(An,{}),e.jsxs(gr,{className:"flex flex-col h-screen",children:[e.jsx(Pn,{}),e.jsx("div",{className:"flex flex-col gap-4 p-4 pt-0 ml-12 grow overflow-auto scrollbar-hidden",children:t}),e.jsx(Tn,{})]})]})})})]})}const Fn=m.createContext(void 0);function En({children:t}){const[a,r]=m.useState("Poppins"),[n,s]=m.useState(!1);m.useEffect(()=>{s(!0);const l=localStorage.getItem("app-font");l&&["Poppins","Oswald","Outfit"].includes(l)&&r(l)},[]),m.useEffect(()=>{if(!n)return;const l={Poppins:"var(--font-poppins)",Oswald:"var(--font-oswald)",Outfit:"var(--font-outfit)"};document.body.style.fontFamily=l[a],document.documentElement.style.fontFamily=l[a],localStorage.setItem("app-font",a),console.log("Font changed to:",a,l[a])},[a,n]);const o=m.useMemo(()=>({font:a,setFont:r}),[a]);return e.jsx(Fn.Provider,{value:o,children:t})}const dl=()=>{const t=m.useContext(Fn);if(t===void 0)throw new Error("useFont must be used within a FontProvider");return t},On=m.createContext(void 0);function Ln({children:t}){const[a,r]=m.useState(.5),[n,s]=m.useState(!1);m.useEffect(()=>{s(!0);const l=localStorage.getItem("app-radius");if(l){const c=parseFloat(l);[0,.25,.5,.75,1].includes(c)&&r(c)}},[]),m.useEffect(()=>{if(!n)return;const l=a===0?"0rem":`${a}rem`;document.documentElement.style.setProperty("--radius",l),localStorage.setItem("app-radius",a.toString()),console.log("Radius changed to:",a,l)},[a,n]);const o=m.useMemo(()=>({radius:a,setRadius:r}),[a]);return e.jsx(On.Provider,{value:o,children:t})}const ul=()=>{const t=m.useContext(On);if(t===void 0)throw new Error("useRadius must be used within a RadiusProvider");return t},Bn=m.createContext(void 0);function ml({children:t}){const[a,r]=m.useState(0),n=m.useCallback(()=>{r(s=>s+1)},[]);return e.jsx(Bn.Provider,{value:{refresh:n,refreshCounter:a},children:t})}function fl(){const t=m.useContext(Bn);if(t===void 0)throw new Error("useRefresh must be used within a RefreshProvider");return t}const xl=new ze.QueryClient;function pl({children:t}){return e.jsx(ze.QueryClientProvider,{client:xl,children:t})}function gl({children:t}){const a=fe();if(!a.IKON_BASE_API_URL||!a.IKON_PLATFORM_UI_URL||!a.LOGIN_PAGE_URL)throw new Error("[IKON] ProviderWrapper: Ikon config not set. Please call setIkonConfig() before rendering ProviderWrapper.");return e.jsx(pl,{children:e.jsx(ol,{children:e.jsx(Ir,{children:e.jsx(En,{children:e.jsx(Ln,{children:e.jsx(Nn,{children:e.jsx(ml,{children:e.jsx(xe.BrowserRouter,{children:e.jsx(Mn,{children:t})})})})})})})})})}function hl({activityLogs:t=[]}){const a=[{tabName:"Activity",tabId:"tab-activity",default:!0,tabContent:e.jsx("div",{className:"overflow-auto flex flex-col gap-2 h-full",children:t.length>0?t.map(r=>e.jsxs("div",{className:"border-b text-sm pb-2",children:[e.jsx("p",{className:"font-medium pb-1",children:r.activity}),e.jsxs("p",{className:"text-gray-500 pb-1",children:["Updated On:"," ",e.jsx("span",{className:"text-gray-700",children:new Date(r.updatedOn).toLocaleString()})]}),e.jsxs("p",{className:"text-gray-500 pb-1",children:["Updated By: ",e.jsx("span",{className:"text-gray-700",children:r.updatedBy})]})]},r.id)):e.jsx(ta,{text:"No Activity Logs Available"})})},{tabName:"File Upload",tabId:"tab-upload",default:!1,tabContent:e.jsx(Cn,{})}];return e.jsx(bn,{buttonText:"",buttonIcon:e.jsx(g.AlignJustify,{}),sheetTitle:"",sheetContent:e.jsx(vn,{tabArray:a,tabListClass:""}),closeButton:!0})}const bl=({src:t,onCroppedImage:a,aspectRatio:r,rotationAngle:n,zoomLevel:s,moveDirection:o})=>{const l=m.useRef(null);function c(d){const u=l.current?.cropper;if(u){const h=u.getCroppedCanvas().toDataURL("image/webp");a(h)}else console.log("Cropper instance is not available.")}return m.useEffect(()=>{const d=l.current?.cropper;d&&d.rotate(n)},[n]),m.useEffect(()=>{const d=l.current?.cropper;d&&d.getCropBoxData().width&&(console.log("Inside cropper scale"),d.scale(s))},[s]),m.useEffect(()=>{const d=l.current?.cropper;if(d&&d.getCropBoxData().width){const{x:f,y:h}=o;typeof f=="number"&&typeof h=="number"&&d.move(f,h)}},[o]),m.useEffect(()=>{const d=l.current?.cropper;if(d&&(d.setAspectRatio(r),r===1)){const u=d.getCanvasData(),f=u.width,h=u.height,w=u.left,C=u.top,v=200,N=100,b=w+(f-v)/2,y=C+(h-N)/2;d.setCropBoxData({left:b,top:y,width:v,height:N})}},[r]),e.jsx(ba,{src:t,style:{height:"100%",width:"100%",objectFit:"contain"},guides:!0,crop:c,ref:l,dragMode:"move",movable:!0,zoomable:!0,scalable:!0,cropBoxMovable:!0,cropBoxResizable:!1})},Un=m.memo(bl),ua={landscape:4/3,portrait:3/4,icon:1/1};function vl({onNewFileUpload:t}){const{originalImage:a,setOriginalImage:r,aspectRatioWiseImages:n,setAspectRatioWiseImages:s}=na(),[o,l]=m.useState(null),[c,d]=m.useState(),[u,f]=m.useState(0),[h,w]=m.useState(1),[C,v]=m.useState({x:0,y:0}),[N,b]=m.useState(null),y=j=>{j.preventDefault(),x(j.dataTransfer.files[0])},x=j=>{if(typeof j=="string")b(j);else if(j?.type?.startsWith("image/")){t?.();const p=new FileReader;p.onloadend=()=>{b(p.result),d(void 0)},p.readAsDataURL(j),r({...a,image:j,name:j.name})}else pa.toast.error("Please select a valid image file.")};m.useEffect(()=>{a.image&&x(a.image)},[a.image]);const I=j=>{const p=o&&c===j?o:n[j];return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"mb-3",children:j}),e.jsx(zt,{ratio:ua[j],className:"bg-muted",children:p&&e.jsx("img",{src:p,alt:`Preview ${j}`,className:"absolute inset-0 w-full h-full object-contain"})})]})};return m.useEffect(()=>{o&&s(c?{...n,[c]:o}:{landscape:o,portrait:o,icon:o})},[o]),e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-3 h-full overflow-auto",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 justify-between",children:[e.jsxs("div",{className:"w-full flex flex-col gap-4",children:[e.jsx(be,{htmlFor:"imageName",children:"Image Name"}),e.jsx(hn,{id:"inputImage",accept:"image/*",fileNamePlaceholder:"Enter image name",fileName:a?.name||"",onChange:j=>{const p=j.target.files?.[0];p&&x(p)},onFileNameChange:j=>{r({...a,name:j.target.value})}})]}),e.jsxs("div",{className:"w-full flex flex-col gap-4",children:[e.jsx(be,{htmlFor:"imageDescription",children:"Image Description"}),e.jsx($,{id:"imageDescription",placeholder:"Enter image Description",value:a?.description||"",onChange:j=>r({...a,description:j.target.value})})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3",children:[e.jsxs("div",{className:"flex-grow flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3",children:"Original Image"}),e.jsx(zt,{ratio:4/3,className:"flex justify-center items-center bg-muted text-muted-foreground",onDrop:y,onDragOver:j=>j.preventDefault(),children:N?e.jsx(Un,{src:N,onCroppedImage:l,aspectRatio:ua[c||"icon"],rotationAngle:u,zoomLevel:h,moveDirection:C}):e.jsxs("div",{className:"text-center",children:[e.jsx(be,{htmlFor:"inputImage",children:"Drag and drop an image here"}),e.jsx("div",{className:"mt-3",children:e.jsx(et,{variant:"outline",onClick:()=>document.getElementById("inputImage")?.click(),children:"Browse Image"})})]})})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 justify-between",children:[e.jsx("div",{children:e.jsxs(Re,{type:"single",variant:"outline",value:c,onValueChange:j=>d(j),children:[e.jsx(U,{className:"rounded-e-none",value:"landscape",children:e.jsx(g.ImageIcon,{})}),e.jsx(U,{className:"rounded-none border-x-0",value:"portrait",children:e.jsx(g.FileImage,{})}),e.jsx(U,{className:"rounded-s-none",value:"icon",children:e.jsx(g.Square,{})})]})}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 justify-between",children:[e.jsxs(Re,{type:"single",variant:"outline",value:"",onValueChange:j=>f(parseInt(j)),children:[e.jsx(U,{className:"rounded-e-none",value:"90",children:e.jsx(g.RotateCw,{})}),e.jsx(U,{className:"rounded-s-none border-s-0",value:"-90",children:e.jsx(g.RotateCcw,{})})]}),e.jsxs(Re,{type:"single",variant:"outline",value:"",children:[e.jsx(U,{className:"rounded-e-none",value:"up",onClick:()=>v({x:0,y:-5}),children:e.jsx(g.ArrowUp,{})}),e.jsx(U,{className:"rounded-none border-x-0",value:"down",onClick:()=>v({x:0,y:5}),children:e.jsx(g.ArrowDown,{})}),e.jsx(U,{className:"rounded-none border-e-0",value:"left",onClick:()=>v({x:-5,y:0}),children:e.jsx(g.ArrowLeft,{})}),e.jsx(U,{className:"rounded-s-none",value:"right",onClick:()=>v({x:5,y:0}),children:e.jsx(g.ArrowRight,{})})]}),e.jsxs(Re,{type:"single",variant:"outline",value:"",onValueChange:j=>w(p=>p+parseFloat(j)),children:[e.jsx(U,{className:"rounded-e-none",value:"0.1",children:e.jsx(g.ZoomIn,{})}),e.jsx(U,{className:"rounded-s-none border-s-0",value:"-0.1",children:e.jsx(g.ZoomOut,{})})]})]})]})]}),e.jsxs("div",{className:"flex flex-row lg:flex-col gap-3 w-full lg:w-48",children:[e.jsx("div",{className:"w-5/5",children:I("landscape")}),e.jsx("div",{className:"w-4/5",children:I("portrait")}),e.jsx("div",{className:"w-3/5",children:I("icon")})]})]})]})})}const Vn=m.memo(vl);function qn({open:t,onOpenChange:a,onCropperChange:r}){const{originalImage:n,aspectRatioWiseImages:s}=na();return e.jsx(gt,{modal:!0,open:t,onOpenChange:o=>{a(o)},children:e.jsxs(ht,{className:"max-w-full lg:max-w-5xl max-h-full overflow-auto",children:[e.jsx(Kt,{children:e.jsx(bt,{children:"Image to upload"})}),e.jsx(Vn,{}),e.jsx(Ga,{children:e.jsx(et,{onClick:()=>{r(n,s),a(!1)},children:"Save Changes"})})]})})}async function st(t,a=""){if(!t||!t.resourceId)return null;try{return`${fe().IKON_BASE_API_URL}/platform/file-resource/download/${a}/${t.resourceId}`}catch(r){return console.error("Error getting resource URL:",r),null}}async function jl(t){if(!t)return null;const a=t.originalImageInfo?await st(t.originalImageInfo):null,r=t.landscapeImageInfo?await st(t.landscapeImageInfo):null,n=t.portraitImageInfo?await st(t.portraitImageInfo):null,s=t.iconImageInfo?await st(t.iconImageInfo):null;return{originalImage:{image:a,name:t.imageName,description:t.imageDescription},aspectRatioWiseImages:{landscape:r,portrait:n,icon:s}}}const Wn=m.createContext(void 0);function wl({children:t,uploadedImages:a,onCropperChange:r,modalOpen:n,onModalOpenChange:s}){const[o,l]=m.useState({landscape:null,portrait:null,icon:null}),[c,d]=m.useState({image:null,name:"",description:""});return m.useEffect(()=>{async function u(){if(a)try{const f=await jl(a);f&&(d(h=>JSON.stringify(h)===JSON.stringify(f.originalImage)?h:f.originalImage),l(h=>JSON.stringify(h)===JSON.stringify(f.aspectRatioWiseImages)?h:f.aspectRatioWiseImages))}catch(f){console.error("Error processing uploaded images:",f)}}u()},[a]),e.jsxs(Wn.Provider,{value:{originalImage:c,setOriginalImage:d,aspectRatioWiseImages:o,setAspectRatioWiseImages:l},children:[t,n&&s&&e.jsx(qn,{open:n,onOpenChange:s,onCropperChange:r})]})}const na=()=>{const t=m.useContext(Wn);if(!t)throw new Error("useImageCropper must be used within a ImageCropperProvider");return t},Gn=({imageSrc:t,onCroppedImage:a,aspectRatio:r,rotationAngle:n,zoomLevel:s,moveDirection:o,currentState:l})=>{const c=m.useRef(null),d=()=>{const u=c.current?.cropper;if(u){u.setDragMode("move");const h=u.getCroppedCanvas().toDataURL();a(h)}else console.log("Cropper instance is not available.")};return m.useEffect(()=>{const u=c.current?.cropper;u&&u.rotate(n)},[n]),m.useEffect(()=>{const u=c.current?.cropper;u&&u.getCropBoxData().width&&(console.log("Inside cropper scale"),u.scale(s))},[s]),m.useEffect(()=>{const u=c.current?.cropper;if(u&&u.getCropBoxData().width){const{x:h,y:w}=o;typeof h=="number"&&typeof w=="number"&&u.move(h,w)}},[o]),m.useEffect(()=>{const u=c.current?.cropper;if(u&&(u.setAspectRatio(r),r===1)){const f=u.getCanvasData(),h=f.width,w=f.height,C=f.left,v=f.top,N=200,b=100,y=C+(h-N)/2,x=v+(w-b)/2;u.setCropBoxData({left:y,top:x,width:N,height:b})}},[r]),e.jsx(ba,{src:t,style:{height:"100%",width:"100%",objectFit:"contain"},guides:!0,crop:d,ref:c,dragMode:"move",movable:!0,zoomable:!0,scalable:!0,cropBoxMovable:!0,cropBoxResizable:!1})},Nl=({open:t,setOpen:a,onImageSubmit:r})=>{const[n,s]=m.useState(null),[o,l]=m.useState(null),[c,d]=m.useState({first:null,second:null,third:null}),[u,f]=m.useState(4/3),[h,w]=m.useState("first"),[C,v]=m.useState(0),[N,b]=m.useState(1),[y,x]=m.useState({x:0,y:0}),[I,j]=m.useState(""),p=()=>{console.log("Image Submit Button is pressed"),console.log(c),r(c.third),a(!1)},S=z=>{v(E=>E+z)},A=()=>{x({x:0,y:-5})},D=()=>{x({x:0,y:5})},M=()=>{x({x:-5,y:0})},O=()=>{x({x:5,y:0})},he=()=>{b(z=>{const E=z+.2;return E<=2?E:z})},Ee=()=>{b(z=>{const E=z-.2;return E>=.2?E:z})},Pe=(z,E)=>{f(z),w(E)},T=z=>{if(z.type.startsWith("image/")){const E=new FileReader;E.onloadend=()=>{s(E.result),j(Ve=>Ve||z.name)},E.readAsDataURL(z)}else alert("Please drop a valid image file.")},P=z=>{z.preventDefault(),T(z.dataTransfer.files[0])},V=z=>{const E=o&&h===z?o:c[z];return E?e.jsx("div",{className:`
|
|
4
|
-
${
|
|
5
|
-
${z==="first"?"relative w-3/5 h-[200px] bg-slate-400":z==="second"?"relative w-1/2 h-[220px] bg-slate-400":"relative w-1/3 h-[120px] bg-slate-400"}`})};return m.useEffect(()=>{o&&(c.first===null||c.second===null||c.third===null?d({first:o,second:o,third:o}):d(z=>({...z,[h]:o})))},[o]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(be,{htmlFor:"imageName",children:"Image Name"}),e.jsx($,{id:"imageName",placeholder:"Enter image name",value:I,onChange:z=>j(z.target.value)})]}),e.jsxs("div",{className:"self-end",children:[e.jsx(R,{variant:"outline",onClick:()=>document.getElementById("inputImage1")?.click(),children:e.jsx(g.Upload,{})}),e.jsx($,{id:"inputImage1",type:"file",accept:"image/png, image/jpeg",className:"hidden",onChange:z=>{const E=z.target.files?.[0];if(E&&E.type.startsWith("image/")){const Ve=new FileReader;Ve.onloadend=()=>{s(Ve.result),j(Yn=>Yn||E.name)},Ve.readAsDataURL(E),d({first:null,second:null,third:null})}}})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(be,{htmlFor:"imageDesc",children:"Image Description"}),e.jsx($,{id:"imageDesc",placeholder:"Describe your image"})]})]}),e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsx("div",{className:"w-3/5 flex justify-center items-center border-2 border-dashed border-gray-400 bg-gray-100",style:{height:"70vh"},onDrop:P,onDragOver:z=>z.preventDefault(),children:n?e.jsx(Gn,{imageSrc:n,onCroppedImage:l,aspectRatio:u,rotationAngle:C,zoomLevel:N,moveDirection:y,currentState:h}):e.jsxs("div",{className:"text-center",children:[e.jsx(be,{htmlFor:"inputImage",children:"Drag and drop an image here"}),e.jsxs("div",{className:"mt-4",children:[e.jsx(R,{variant:"outline",onClick:()=>document.getElementById("inputImage")?.click(),children:"Upload Image"}),e.jsx($,{id:"inputImage",type:"file",accept:"image/png, image/jpeg",className:"hidden",onChange:z=>{const E=z.target.files?.[0];E&&T(E)}})]})]})}),e.jsxs("div",{className:"w-2/5 flex flex-col gap-2",children:[e.jsx("h3",{children:"Landscape"}),V("first"),e.jsx("h3",{children:"Potrait"}),V("second"),e.jsx("h3",{children:"Icon"}),V("third")]})]}),e.jsxs("div",{className:"flex flex-row gap-1",children:[e.jsxs("div",{className:"w-3/5 flex flex-row justify-between",children:[e.jsxs("div",{children:[e.jsx(R,{variant:"outline",onClick:()=>Pe(4/3,"first"),children:e.jsx(g.ImageIcon,{})}),e.jsx(R,{variant:"outline",onClick:()=>Pe(3/4,"second"),children:e.jsx(g.FileImage,{})}),e.jsx(R,{variant:"outline",onClick:()=>Pe(1/1,"third"),children:e.jsx(g.Square,{})})]}),e.jsxs("div",{children:[e.jsx(R,{onClick:()=>S(90),variant:"outline",children:e.jsx(g.RotateCw,{})}),e.jsx(R,{onClick:()=>S(-90),variant:"outline",children:e.jsx(g.RotateCcw,{})})]}),e.jsxs("div",{children:[e.jsx(R,{onClick:()=>he(),variant:"outline",children:e.jsx(g.ZoomIn,{})}),e.jsx(R,{onClick:()=>Ee(),variant:"outline",children:e.jsx(g.ZoomOut,{})})]}),e.jsxs("div",{children:[e.jsx(R,{onClick:A,variant:"outline",children:e.jsx(g.ArrowUp,{})}),e.jsx(R,{onClick:D,variant:"outline",children:e.jsx(g.ArrowDown,{})}),e.jsx(R,{onClick:M,variant:"outline",children:e.jsx(g.ArrowLeft,{})}),e.jsx(R,{onClick:O,variant:"outline",children:e.jsx(g.ArrowRight,{})})]})]}),e.jsx("div",{className:"w-2/5 flex flex-row-reverse",children:e.jsx(R,{onClick:p,children:"Save"})})]})]})},yl=m.memo(Nl);function Cl(){return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"bg-background text-forefround rounded-xl p-6 text-center max-w-md",children:[e.jsx("div",{className:"text-3xl font-bold mb-2 animate-pulse",children:"🚧 Work in Progress"}),e.jsx("p",{className:"text-muted-foreground",children:"We’re currently working on this section. Check back soon!"})]})})}function kl({formControl:t,name:a,label:r,options:n,placeholder:s="Select an option",emptyMessage:o="No options found.",onValueChange:l,className:c,addNewPlaceholder:d="Add custom value...",formDescription:u,disabled:f}){const[h,w]=k.useState(!1),[C,v]=k.useState(""),[N,b]=k.useState(n),[y,x]=k.useState(!1),[I,j]=k.useState("");return k.useEffect(()=>{b(n)},[n]),e.jsx(ce,{control:t,name:a,render:({field:p})=>{const S=N.find(D=>D.value===p.value),A=()=>{const D=I.trim();if(!D)return;if(N.some(O=>O.value===D)){const O=N.find(he=>he.value===D);O&&(p.onChange(O.value),l?.(O.value),j(""),x(!1),w(!1),v(""));return}const M={value:D,label:D,disabled:!0};b(O=>[...O,M]),p.onChange(D),l?.(D),j(""),x(!1),w(!1),v("")};return e.jsxs(de,{className:i(c),children:[r&&e.jsxs(e.Fragment,{children:[e.jsx(pe,{children:r}),e.jsx("br",{})]}),e.jsxs(J,{open:h,onOpenChange:D=>{w(D),D||(v(""),x(!1),j(""))},children:[e.jsx(X,{asChild:!0,children:e.jsx(ue,{children:e.jsxs(R,{variant:"outline",role:"combobox","aria-expanded":h,className:i("w-full justify-between",!p.value&&"text-foreground/50",c),disabled:f||p.disabled,children:[e.jsx("span",{className:"line-clamp-1 text-left",children:p.value?S?S.label:p.value:s}),e.jsx(g.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),e.jsx(Q,{className:"p-0 w-[--radix-popover-trigger-width]",align:"start",children:e.jsxs(Y,{shouldFilter:!0,children:[e.jsx(ne,{placeholder:"Search...",value:C,onValueChange:v}),e.jsxs(se,{children:[e.jsx(oe,{children:C&&N.length>0?"No results found.":o}),e.jsx(ee,{children:N.filter(D=>D.label.toLowerCase().includes(C.toLowerCase())||D.value.toLowerCase().includes(C.toLowerCase())).map(D=>e.jsxs(K,{value:D.value,onSelect:M=>{p.onChange(M),l?.(M),w(!1),v("")},className:"cursor-pointer",disabled:D?.disabled,children:[e.jsx(g.Check,{className:i("mr-2 h-4 w-4",p.value===D.value?"opacity-100":"opacity-0")}),D.label]},D.value))})]}),e.jsx("div",{className:"border-t p-2",children:y?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{placeholder:d,value:I,onChange:D=>j(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),A()),D.key==="Escape"&&(x(!1),j(""))},autoFocus:!0,className:"h-8"}),e.jsx(R,{size:"sm",variant:"ghost",onClick:()=>{x(!1),j("")},className:"h-8",children:"Cancel"}),e.jsx(R,{size:"sm",variant:"default",onClick:A,className:"h-8",disabled:!I.trim()||N.some(D=>D.value===I.trim()),children:"Add"})]}):e.jsxs(R,{variant:"outline",className:"w-full justify-start",onClick:()=>x(!0),children:[e.jsx(g.Plus,{className:"mr-2 h-4 w-4"}),"Add new option"]})})]})})]}),u&&e.jsx(ge,{children:u}),e.jsx(me,{})]})}})}const le=m.forwardRef(({children:t,tooltip:a,side:r="bottom",className:n,...s},o)=>e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,children:e.jsxs(R,{variant:"ghost",size:"icon",...s,className:i("aui-button-icon size-6 p-1",n),ref:o,children:[e.jsx(Ut.Slottable,{children:t}),e.jsx("span",{className:"aui-sr-only sr-only",children:a})]})}),e.jsx(re,{side:r,children:a})]}));le.displayName="TooltipIconButton";const Il=()=>e.jsx(It.MarkdownTextPrimitive,{remarkPlugins:[Is],className:"aui-md",components:Pl}),Sl=m.memo(Il),Al=({language:t,code:a})=>{const{isCopied:r,copyToClipboard:n}=Tl(),s=()=>{!a||r||n(a)};return e.jsxs("div",{className:"aui-code-header-root mt-4 flex items-center justify-between gap-4 rounded-t-lg bg-muted-foreground/15 px-4 py-2 font-semibold text-foreground text-sm dark:bg-muted-foreground/20",children:[e.jsx("span",{className:"aui-code-header-language lowercase [&>span]:text-xs",children:t}),e.jsxs(le,{tooltip:"Copy",onClick:s,children:[!r&&e.jsx(g.CopyIcon,{}),r&&e.jsx(g.CheckIcon,{})]})]})},Tl=({copiedDuration:t=3e3}={})=>{const[a,r]=m.useState(!1);return{isCopied:a,copyToClipboard:s=>{s&&navigator.clipboard.writeText(s).then(()=>{r(!0),setTimeout(()=>r(!1),t)})}}},Pl=It.unstable_memoizeMarkdownComponents({h1:({className:t,...a})=>e.jsx("h1",{className:i("aui-md-h1 mb-8 scroll-m-20 font-extrabold text-4xl tracking-tight last:mb-0",t),...a}),h2:({className:t,...a})=>e.jsx("h2",{className:i("aui-md-h2 mt-8 mb-4 scroll-m-20 font-semibold text-3xl tracking-tight first:mt-0 last:mb-0",t),...a}),h3:({className:t,...a})=>e.jsx("h3",{className:i("aui-md-h3 mt-6 mb-4 scroll-m-20 font-semibold text-2xl tracking-tight first:mt-0 last:mb-0",t),...a}),h4:({className:t,...a})=>e.jsx("h4",{className:i("aui-md-h4 mt-6 mb-4 scroll-m-20 font-semibold text-xl tracking-tight first:mt-0 last:mb-0",t),...a}),h5:({className:t,...a})=>e.jsx("h5",{className:i("aui-md-h5 my-4 font-semibold text-lg first:mt-0 last:mb-0",t),...a}),h6:({className:t,...a})=>e.jsx("h6",{className:i("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",t),...a}),p:({className:t,...a})=>e.jsx("p",{className:i("aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",t),...a}),a:({className:t,...a})=>e.jsx("a",{className:i("aui-md-a font-medium text-primary underline underline-offset-4",t),...a}),blockquote:({className:t,...a})=>e.jsx("blockquote",{className:i("aui-md-blockquote border-l-2 pl-6 italic",t),...a}),ul:({className:t,...a})=>e.jsx("ul",{className:i("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2",t),...a}),ol:({className:t,...a})=>e.jsx("ol",{className:i("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2",t),...a}),hr:({className:t,...a})=>e.jsx("hr",{className:i("aui-md-hr my-5 border-b",t),...a}),table:({className:t,...a})=>e.jsx("table",{className:i("aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",t),...a}),th:({className:t,...a})=>e.jsx("th",{className:i("aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [[align=center]]:text-center [[align=right]]:text-right",t),...a}),td:({className:t,...a})=>e.jsx("td",{className:i("aui-md-td border-b border-l px-4 py-2 text-left last:border-r [[align=center]]:text-center [[align=right]]:text-right",t),...a}),tr:({className:t,...a})=>e.jsx("tr",{className:i("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",t),...a}),sup:({className:t,...a})=>e.jsx("sup",{className:i("aui-md-sup [&>a]:text-xs [&>a]:no-underline",t),...a}),pre:({className:t,...a})=>e.jsx("pre",{className:i("aui-md-pre overflow-x-auto rounded-t-none!rounded-b-lg bg-black p-4 text-white",t),...a}),code:function({className:a,...r}){const n=It.useIsMarkdownCodeBlock();return e.jsx("code",{className:i(!n&&"aui-md-inline-code rounded border bg-muted font-semibold",a),...r})},CodeHeader:Al}),Dl=({toolName:t,argsText:a,result:r,status:n})=>{const[s,o]=m.useState(!0),l=n?.type==="incomplete"&&n.reason==="cancelled",c=l&&n.error?typeof n.error=="string"?n.error:JSON.stringify(n.error):null;return e.jsxs("div",{className:i("aui-tool-fallback-root mb-4 flex w-full flex-col gap-3 rounded-lg border py-3",l&&"border-muted-foreground/30 bg-muted/30"),children:[e.jsxs("div",{className:"aui-tool-fallback-header flex items-center gap-2 px-4",children:[l?e.jsx(g.XCircleIcon,{className:"aui-tool-fallback-icon size-4 text-muted-foreground"}):e.jsx(g.CheckIcon,{className:"aui-tool-fallback-icon size-4"}),e.jsxs("p",{className:i("aui-tool-fallback-title grow",l&&"text-muted-foreground line-through"),children:[l?"Cancelled tool: ":"Used tool: ",e.jsx("b",{children:t})]}),e.jsx(R,{onClick:()=>o(!s),children:s?e.jsx(g.ChevronUpIcon,{}):e.jsx(g.ChevronDownIcon,{})})]}),!s&&e.jsxs("div",{className:"aui-tool-fallback-content flex flex-col gap-2 border-t pt-2",children:[c&&e.jsxs("div",{className:"aui-tool-fallback-cancelled-root px-4",children:[e.jsx("p",{className:"aui-tool-fallback-cancelled-header font-semibold text-muted-foreground",children:"Cancelled reason:"}),e.jsx("p",{className:"aui-tool-fallback-cancelled-reason text-muted-foreground",children:c})]}),e.jsx("div",{className:i("aui-tool-fallback-args-root px-4",l&&"opacity-60"),children:e.jsx("pre",{className:"aui-tool-fallback-args-value whitespace-pre-wrap",children:a})}),!l&&r!==void 0&&e.jsxs("div",{className:"aui-tool-fallback-result-root border-t border-dashed px-4 pt-2",children:[e.jsx("p",{className:"aui-tool-fallback-result-header font-semibold",children:"Result:"}),e.jsx("pre",{className:"aui-tool-fallback-result-content whitespace-pre-wrap",children:typeof r=="string"?r:JSON.stringify(r,null,2)})]})]})]})},ma=t=>Symbol.iterator in t,fa=t=>"entries"in t,xa=(t,a)=>{const r=t instanceof Map?t:new Map(t.entries()),n=a instanceof Map?a:new Map(a.entries());if(r.size!==n.size)return!1;for(const[s,o]of r)if(!n.has(s)||!Object.is(o,n.get(s)))return!1;return!0},Rl=(t,a)=>{const r=t[Symbol.iterator](),n=a[Symbol.iterator]();let s=r.next(),o=n.next();for(;!s.done&&!o.done;){if(!Object.is(s.value,o.value))return!1;s=r.next(),o=n.next()}return!!s.done&&!!o.done};function _l(t,a){return Object.is(t,a)?!0:typeof t!="object"||t===null||typeof a!="object"||a===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(a)?!1:ma(t)&&ma(a)?fa(t)&&fa(a)?xa(t,a):Rl(t,a):xa({entries:()=>Object.entries(t)},{entries:()=>Object.entries(a)})}function zl(t){const a=m.useRef(void 0);return r=>{const n=t(r);return _l(a.current,n)?a.current:a.current=n}}const Ml=t=>{const[a,r]=m.useState(void 0);return m.useEffect(()=>{if(!t){r(void 0);return}const n=URL.createObjectURL(t);return r(n),()=>{URL.revokeObjectURL(n)}},[t]),a},$n=()=>{const{file:t,src:a}=_.useAssistantState(zl(({attachment:r})=>{if(r.type!=="image")return{};if(r.file)return{file:r.file};const n=r.content?.filter(s=>s.type==="image")[0]?.image;return n?{src:n}:{}}));return Ml(t)??a},Fl=({src:t})=>{const[a,r]=m.useState(!1);return e.jsx("img",{src:t,alt:"Image Preview",width:1,height:1,className:a?"aui-attachment-preview-image-loaded block h-auto max-h-[80vh] w-auto max-w-full object-contain":"aui-attachment-preview-image-loading hidden",onLoad:()=>r(!0),loading:"lazy"})},El=({children:t})=>{const a=$n();return a?e.jsxs(gt,{children:[e.jsx(Va,{className:"aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50",asChild:!0,children:t}),e.jsxs(ht,{className:"aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0! [&_svg]:text-background [&>button]:hover:[&_svg]:text-destructive",children:[e.jsx(bt,{className:"aui-sr-only sr-only",children:"Image Attachment Preview"}),e.jsx("div",{className:"aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background",children:e.jsx(Fl,{src:a})})]})]}):t},Ol=()=>{const t=_.useAssistantState(({attachment:r})=>r.type==="image"),a=$n();return e.jsxs(Ma,{className:"aui-attachment-tile-avatar h-full w-full rounded-none",children:[e.jsx(Fa,{src:a,alt:"Attachment preview",className:"aui-attachment-tile-image object-cover"}),e.jsx(Ea,{delayMs:t?200:0,children:e.jsx(g.FileText,{className:"aui-attachment-tile-fallback-icon size-8 text-muted-foreground"})})]})},Hn=()=>{const a=_.useAssistantApi().attachment.source==="composer",r=_.useAssistantState(({attachment:s})=>s.type==="image"),n=_.useAssistantState(({attachment:s})=>{const o=s.type;switch(o){case"image":return"Image";case"document":return"Document";case"file":return"File";default:{const l=o;throw new Error(`Unknown attachment type: ${l}`)}}});return e.jsxs(te,{children:[e.jsxs(_.AttachmentPrimitive.Root,{className:i("aui-attachment-root relative",r&&"aui-attachment-root-composer only:[&>#attachment-tile]:size-24"),children:[e.jsx(El,{children:e.jsx(ae,{asChild:!0,children:e.jsx("div",{className:i("aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[14px] border bg-muted transition-opacity hover:opacity-75",a&&"aui-attachment-tile-composer border-foreground/20"),role:"button",id:"attachment-tile","aria-label":`${n} attachment`,children:e.jsx(Ol,{})})})}),a&&e.jsx(Ll,{})]}),e.jsx(re,{side:"top",children:e.jsx(_.AttachmentPrimitive.Name,{})})]})},Ll=()=>e.jsx(_.AttachmentPrimitive.Remove,{asChild:!0,children:e.jsx(le,{tooltip:"Remove file",className:"aui-attachment-tile-remove absolute top-1.5 right-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:bg-white! [&_svg]:text-black hover:[&_svg]:text-destructive",side:"top",children:e.jsx(g.XIcon,{className:"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]"})})}),Bl=()=>e.jsx("div",{className:"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2",children:e.jsx(_.MessagePrimitive.Attachments,{components:{Attachment:Hn}})}),Ul=()=>e.jsx("div",{className:"aui-composer-attachments mb-2 flex w-full flex-row items-center gap-2 overflow-x-auto px-1.5 pt-0.5 pb-1 empty:hidden",children:e.jsx(_.ComposerPrimitive.Attachments,{components:{Attachment:Hn}})}),Vl=()=>e.jsx(_.ComposerPrimitive.AddAttachment,{asChild:!0,children:e.jsx(le,{tooltip:"Add Attachment",side:"bottom",variant:"ghost",size:"icon",className:"aui-composer-add-attachment size-8.5 rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30","aria-label":"Add Attachment",children:e.jsx(g.PlusIcon,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})}),ql=({agents:t,selectedAgent:a,onSelectAgent:r,className:n,triggerClassName:s})=>{const[o,l]=m.useState(!1),c=a||null;return e.jsxs(Se,{open:o,onOpenChange:l,children:[e.jsx(Ae,{asChild:!0,children:e.jsxs(R,{variant:"outline",className:i("gap-2 px-3 py-2 text-sm font-medium rounded-2xl",s),children:[e.jsx("span",{className:"truncate",children:c?.agentName||"Select Agent"}),e.jsx(g.ChevronDownIcon,{className:"size-4 shrink-0 opacity-50"})]})}),e.jsx(Te,{align:"end",className:i("min-w-[200px]",n),children:t.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Jt,{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground",children:"Agents"}),e.jsx(vt,{}),e.jsx(Yt,{children:t.map(d=>e.jsxs(ie,{onClick:()=>{r(d),l(!1)},className:i("cursor-pointer flex flex-col gap-1",c?.agentID===d.agentID&&"bg-accent"),children:[e.jsx("div",{className:"font-medium text-sm",children:d.agentName}),d.agentDescription&&e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:d.agentDescription})]},d.agentID))})]}):e.jsx("div",{className:"px-2 py-1.5 text-sm text-muted-foreground text-center",children:"No agents available"})})]})},Wl=({currentUserDetails:t,agents:a=[],initialAgentId:r="default-agent",initialAgentName:n="Default Agent",onAgentChange:s})=>{const[o,l]=m.useState(a.find(c=>c.agentID===r));return e.jsx(ot.LazyMotion,{features:ot.domAnimation,children:e.jsx(ot.MotionConfig,{reducedMotion:"user",children:e.jsx(_.ThreadPrimitive.Root,{className:"aui-root aui-thread-root @container flex h-full flex-col bg-background",style:{"--thread-max-width":"44rem"},children:e.jsxs(_.ThreadPrimitive.Viewport,{turnAnchor:"top",className:"aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",children:[e.jsx(_.ThreadPrimitive.If,{empty:!0,children:e.jsx($l,{currentUserDetails:t})}),e.jsx(_.ThreadPrimitive.Messages,{components:{UserMessage:Zl,EditComposer:tc,AssistantMessage:Xl}}),e.jsxs(_.ThreadPrimitive.ViewportFooter,{className:"aui-thread-viewport-footer sticky bottom-0 mx-auto mt-4 flex w-full max-w-[var(--thread-max-width)] flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6",children:[e.jsx(Gl,{}),e.jsx(Kl,{agents:a,selectedAgent:o,onSelectAgent:c=>{l(c),s?.(c)}})]})]})})})})},Gl=()=>e.jsx(_.ThreadPrimitive.ScrollToBottom,{asChild:!0,children:e.jsx(le,{tooltip:"Scroll to bottom",variant:"outline",className:"aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:bg-background dark:hover:bg-accent",children:e.jsx(g.ArrowDownIcon,{})})}),$l=({currentUserDetails:t})=>{const r=new Date().getHours();let n="";return r>=5&&r<12?n="Good Morning":r>=12&&r<17?n="Good Afternoon":r>=17&&r<21?n="Good Evening":n="Good Night",console.log(n),e.jsxs("div",{className:"aui-thread-welcome-root mx-auto my-auto flex w-full max-w-[var(--thread-max-width)] flex-grow flex-col",children:[e.jsx("div",{className:"aui-thread-welcome-center flex w-full flex-grow flex-col items-center justify-center",children:e.jsxs("div",{className:"aui-thread-welcome-message flex size-full flex-col justify-center px-8",children:[e.jsx(At.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:"aui-thread-welcome-message-motion-1 text-2xl font-semibold",children:`${n} ${t.userName.split(" ")[0]}`}),e.jsx(At.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{delay:.1},className:"aui-thread-welcome-message-motion-2 text-2xl text-muted-foreground/65",children:"How can I help you today?"})]})}),e.jsx(Hl,{})]})},Hl=()=>e.jsx("div",{className:"aui-thread-welcome-suggestions grid w-full gap-2 pb-4 @md:grid-cols-2",children:[{title:"What's the weather",label:"in San Francisco?",action:"What's the weather in San Francisco?"},{title:"Explain React hooks",label:"like useState and useEffect",action:"Explain React hooks like useState and useEffect"},{title:"Write a SQL query",label:"to find top customers",action:"Write a SQL query to find top customers"},{title:"Create a meal plan",label:"for healthy weight loss",action:"Create a meal plan for healthy weight loss"}].map((t,a)=>e.jsx(At.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{delay:.05*a},className:"aui-thread-welcome-suggestion-display [&:nth-child(n+3)]:hidden @md:[&:nth-child(n+3)]:block",children:e.jsx(_.ThreadPrimitive.Suggestion,{prompt:t.action,send:!0,asChild:!0,children:e.jsxs(R,{variant:"ghost",className:"aui-thread-welcome-suggestion h-auto w-full flex-1 flex-wrap items-start justify-start gap-1 rounded-3xl border px-5 py-4 text-left text-sm @md:flex-col dark:hover:bg-accent/60","aria-label":t.action,children:[e.jsx("span",{className:"aui-thread-welcome-suggestion-text-1 font-medium",children:t.title}),e.jsx("span",{className:"aui-thread-welcome-suggestion-text-2 text-muted-foreground",children:t.label})]})})},`suggested-action-${t.title}-${a}`))}),Kl=({agents:t=[],selectedAgent:a,onSelectAgent:r})=>e.jsx(_.ComposerPrimitive.Root,{className:"aui-composer-root relative flex w-full flex-col",children:e.jsxs(_.ComposerPrimitive.AttachmentDropzone,{className:"aui-composer-attachment-dropzone group/input-group flex w-full flex-col rounded-3xl border border-input bg-background px-1 pt-2 shadow-xs transition-[color,box-shadow] outline-none has-[textarea:focus-visible]:border-ring has-[textarea:focus-visible]:ring-[3px] has-[textarea:focus-visible]:ring-ring/50 data-[dragging=true]:border-dashed data-[dragging=true]:border-ring data-[dragging=true]:bg-accent/50 dark:bg-background",children:[e.jsx(Ul,{}),e.jsx(_.ComposerPrimitive.Input,{placeholder:"Send a message...",className:"aui-composer-input mb-1 max-h-32 min-h-16 w-full resize-none bg-transparent px-3.5 pt-1.5 pb-3 text-base outline-none placeholder:text-muted-foreground focus-visible:ring-0",rows:1,autoFocus:!0,"aria-label":"Message input"}),e.jsx(Yl,{agents:t,selectedAgent:a,onSelectAgent:r})]})}),Yl=({agents:t=[],selectedAgent:a,onSelectAgent:r})=>e.jsxs("div",{className:"aui-composer-action-wrapper relative mx-1 mt-2 mb-2 flex items-center justify-between",children:[e.jsx(Vl,{}),e.jsxs("div",{className:"flex gap-3",children:[t.length>0&&e.jsx(ql,{agents:t,selectedAgent:a,onSelectAgent:r??(()=>{}),triggerClassName:"h-9 text-xs"}),e.jsx(_.ThreadPrimitive.If,{running:!1,children:e.jsx(_.ComposerPrimitive.Send,{asChild:!0,children:e.jsx(le,{tooltip:"Send message",side:"bottom",type:"submit",variant:"default",size:"icon",className:"aui-composer-send size-[34px] rounded-full p-1","aria-label":"Send message",children:e.jsx(g.ArrowUpIcon,{className:"aui-composer-send-icon size-5"})})})}),e.jsx(_.ThreadPrimitive.If,{running:!0,children:e.jsx(_.ComposerPrimitive.Cancel,{asChild:!0,children:e.jsx(R,{type:"button",variant:"default",size:"icon",className:"aui-composer-cancel size-[34px] rounded-full border border-muted-foreground/60 hover:bg-primary/75 dark:border-muted-foreground/90","aria-label":"Stop generating",children:e.jsx(g.Square,{className:"aui-composer-cancel-icon size-3.5 fill-white dark:fill-black"})})})})]})]}),Jl=()=>e.jsx(_.MessagePrimitive.Error,{children:e.jsx(_.ErrorPrimitive.Root,{className:"aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm text-destructive dark:bg-destructive/5 dark:text-red-200",children:e.jsx(_.ErrorPrimitive.Message,{className:"aui-message-error-message line-clamp-2"})})}),Xl=()=>e.jsxs(_.MessagePrimitive.Root,{className:"aui-assistant-message-root relative mx-auto w-full max-w-[var(--thread-max-width)] animate-in py-4 duration-150 ease-out fade-in slide-in-from-bottom-1","data-role":"assistant",children:[e.jsxs("div",{className:"aui-assistant-message-content mx-2 leading-7 break-words text-foreground",children:[e.jsx(_.MessagePrimitive.Parts,{components:{Text:Sl,tools:{Fallback:Dl}}}),e.jsx(Jl,{})]}),e.jsxs("div",{className:"aui-assistant-message-footer mt-2 ml-2 flex",children:[e.jsx(Kn,{}),e.jsx(Ql,{})]})]}),Ql=()=>e.jsxs(_.ActionBarPrimitive.Root,{hideWhenRunning:!0,autohide:"not-last",autohideFloat:"single-branch",className:"aui-assistant-action-bar-root col-start-3 row-start-2 -ml-1 flex gap-1 text-muted-foreground data-floating:absolute data-floating:rounded-md data-floating:border data-floating:bg-background data-floating:p-1 data-floating:shadow-sm",children:[e.jsx(_.ActionBarPrimitive.Copy,{asChild:!0,children:e.jsxs(le,{tooltip:"Copy",children:[e.jsx(_.MessagePrimitive.If,{copied:!0,children:e.jsx(g.CheckIcon,{})}),e.jsx(_.MessagePrimitive.If,{copied:!1,children:e.jsx(g.CopyIcon,{})})]})}),e.jsx(_.ActionBarPrimitive.Reload,{asChild:!0,children:e.jsx(le,{tooltip:"Refresh",children:e.jsx(g.RefreshCwIcon,{})})})]}),Zl=()=>e.jsxs(_.MessagePrimitive.Root,{className:"aui-user-message-root mx-auto grid w-full max-w-[var(--thread-max-width)] animate-in auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 py-4 duration-150 ease-out fade-in slide-in-from-bottom-1 [&:where(>*)]:col-start-2","data-role":"user",children:[e.jsx(Bl,{}),e.jsxs("div",{className:"aui-user-message-content-wrapper relative col-start-2 min-w-0",children:[e.jsx("div",{className:"aui-user-message-content rounded-3xl bg-muted px-5 py-2.5 break-words text-foreground",children:e.jsx(_.MessagePrimitive.Parts,{})}),e.jsx("div",{className:"aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2",children:e.jsx(ec,{})})]}),e.jsx(Kn,{className:"aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end"})]}),ec=()=>e.jsx(_.ActionBarPrimitive.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-user-action-bar-root flex flex-col items-end",children:e.jsx(_.ActionBarPrimitive.Edit,{asChild:!0,children:e.jsx(le,{tooltip:"Edit",className:"aui-user-action-edit p-4",children:e.jsx(g.PencilIcon,{})})})}),tc=()=>e.jsx(_.MessagePrimitive.Root,{className:"aui-edit-composer-wrapper mx-auto flex w-full max-w-[var(--thread-max-width)] flex-col gap-4 px-2",children:e.jsxs(_.ComposerPrimitive.Root,{className:"aui-edit-composer-root ml-auto flex w-full max-w-7/8 flex-col rounded-xl bg-muted",children:[e.jsx(_.ComposerPrimitive.Input,{className:"aui-edit-composer-input flex min-h-[60px] w-full resize-none bg-transparent p-4 text-foreground outline-none",autoFocus:!0}),e.jsxs("div",{className:"aui-edit-composer-footer mx-3 mb-3 flex items-center justify-center gap-2 self-end",children:[e.jsx(_.ComposerPrimitive.Cancel,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"sm","aria-label":"Cancel edit",children:"Cancel"})}),e.jsx(_.ComposerPrimitive.Send,{asChild:!0,children:e.jsx(R,{size:"sm","aria-label":"Update message",children:"Update"})})]})]})}),Kn=({className:t,...a})=>e.jsxs(_.BranchPickerPrimitive.Root,{hideWhenSingleBranch:!0,className:i("aui-branch-picker-root mr-2 -ml-2 inline-flex items-center text-xs text-muted-foreground",t),...a,children:[e.jsx(_.BranchPickerPrimitive.Previous,{asChild:!0,children:e.jsx(le,{tooltip:"Previous",children:e.jsx(g.ChevronLeftIcon,{})})}),e.jsxs("span",{className:"aui-branch-picker-state font-medium",children:[e.jsx(_.BranchPickerPrimitive.Number,{})," / ",e.jsx(_.BranchPickerPrimitive.Count,{})]}),e.jsx(_.BranchPickerPrimitive.Next,{asChild:!0,children:e.jsx(le,{tooltip:"Next",children:e.jsx(g.ChevronRightIcon,{})})})]});class ac{agentConfig;baseUrl;chatIdMap=new Map;constructor(a){this.agentConfig=a,this.baseUrl=a.baseUrl||""}updateAgentConfig(a){this.agentConfig={...this.agentConfig,...a}}getChatId(a){return this.chatIdMap.has(a)?this.chatIdMap.get(a):sa.v4()}async sendMessages(a){const{messages:r,chatId:n,abortSignal:s,headers:o,body:l}=a;console.log("sendMessages called with chatId:",n,"trigger:",a.trigger);const c=this.getChatId(n);console.log("Using server chatId:",c);const u={messages:r.map(w=>{const C=w.parts.filter(v=>v.type==="text").map(v=>v.text).join("");return{role:w.role,content:w.role==="user"&&this.agentConfig.additionalReferenceInfo&&Object.keys(this.agentConfig.additionalReferenceInfo).length>0?C+JSON.stringify(this.agentConfig.additionalReferenceInfo):C}}),provider:this.agentConfig.provider,model:this.agentConfig.model,agentId:this.agentConfig.agentId,agentName:this.agentConfig.agentName,temperature:this.agentConfig.temperature??.7,maxTokens:this.agentConfig.maxTokens??2048,stream:!0,useVoice:!1,...l},h={"Content-Type":"application/json",Authorization:`Bearer ${await at()}`,...o instanceof Headers?Object.fromEntries(o.entries()):o||{}};try{const w=await fetch(`${this.baseUrl}/api/chat/completions/${c}`,{method:"POST",headers:h,body:JSON.stringify(u),signal:s,cache:"no-store"});if(!w.ok)throw new Error(`HTTP error! status: ${w.status}`);if(!w.body)throw new Error("Response body is null");return this.processResponseStream(w.body)}catch(w){throw console.error("Error in sendMessages:",w),w}}async reconnectToStream(a){return null}processResponseStream(a){const r=new TextDecoder;let n="",s=null,o=!1,l=[],c=!1,d="",u=!1,f="";return new ReadableStream({async start(h){s=a.getReader()},async pull(h){if(!(!s||o)){if(l.length>0){h.enqueue(l.shift());return}try{const{done:w,value:C}=await s.read();if(w){if(c&&d)for(u&&f&&l.push({type:"text-end",id:f}),l.push({type:"finish",finishReason:"stop"});l.length>0;)h.enqueue(l.shift());o||(o=!0,h.close());return}n+=r.decode(C,{stream:!0});const v=n.split(`
|
|
6
|
-
`);n=v.pop()||"";for(const
|
|
3
|
+
`,onDragOver:c,onDragLeave:u,onDrop:i,onClick:()=>document.getElementById("fileInput")?.click(),children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(f.UploadCloud,{className:"w-10 h-10 text-blue-600"}),e.jsxs("p",{className:"text-gray-600",children:["Drag & drop your file here or"," ",e.jsx("span",{className:"text-blue-600 underline",children:"browse"})]})]})}):e.jsxs("div",{className:"border rounded-lg p-4 flex flex-col items-center gap-2 cursor-pointer text-center",onClick:()=>document.getElementById("fileInput")?.click(),children:[e.jsx(f.FileUp,{className:"w-8 h-8 text-blue-600"}),e.jsx("span",{className:"text-blue-600 underline",children:"Browse File"})]})]})}const Si=[15,20,30,40,50,100];function hn({table:t,extraParams:a}){return e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between ",children:[e.jsx("small",{className:"flex-1 px-2 text-gray-600 dark:text-gray-400",children:(a?.numberOfRows==null||a?.numberOfRows)&&a?.checkBoxColumn?e.jsxs(e.Fragment,{children:[t.getFilteredSelectedRowModel().rows.length," of"," ",t.getFilteredRowModel().rows.length," row(s) selected."]}):e.jsxs(e.Fragment,{children:["Total ",t.getFilteredRowModel().rows.length," no(s) of rows."]})}),(a?.pagination==null||a.pagination)&&e.jsxs("div",{className:"flex items-start md:items-center gap-3 flex-col md:flex-row ",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("small",{className:"text-gray-600 dark:text-gray-400",children:"Rows per page"}),(a?.rowsPerPage==null||a.rowsPerPage)&&e.jsxs(nr,{value:`${t.getState().pagination.pageSize}`,onValueChange:r=>{t.setPageSize(Number(r))},children:[e.jsx(or,{className:"w-[70px] h-8",children:e.jsx(sr,{placeholder:t.getState().pagination.pageSize})}),e.jsx(ir,{side:"top",children:(a?.pageSizeArray||Si).map(r=>e.jsx(lr,{value:`${r}`,children:r},r))})]})]}),e.jsxs(e.Fragment,{children:[e.jsxs("small",{className:"flex w-[100px] items-center justify-center text-gray-600 dark:text-gray-400",children:["Page ",t.getState().pagination.pageIndex+1," of"," ",t.getPageCount()]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ie,{tooltipContent:"Go to first page",size:"icon-sm",className:"dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),children:e.jsx(f.ChevronsLeft,{})}),e.jsx(Ie,{tooltipContent:"Go to previous page",size:"icon-sm",className:"dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),children:e.jsx(f.ChevronLeft,{})}),e.jsx(Ie,{tooltipContent:"Go to next page",size:"icon-sm",className:"dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),children:e.jsx(f.ChevronRight,{})}),e.jsx(Ie,{tooltipContent:"Go to last page",size:"icon-sm",className:"dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground",onClick:()=>t.setPageIndex(t.getPageCount()-1),disabled:!t.getCanNextPage(),children:e.jsx(f.ChevronsRight,{})})]})]})]})]})}function bn({className:t,...a}){return e.jsxs("div",{className:"relative w-auto flex items-center",children:[e.jsx(f.Search,{className:"absolute left-2 mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(K,{className:H.cx("pl-8 h-8",t),...a})]})}function vn({table:t,extraParams:a}){return e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex-grow flex items-center justify-between gap-3 overflow-hidden",children:[(a?.defaultTools==null||a?.defaultTools==!0||Array.isArray(a?.defaultTools)&&a?.defaultTools?.includes("search"))&&e.jsx(bn,{placeholder:"Search ...",onChange:r=>t.setGlobalFilter(r.target.value),className:"max-w-sm"}),(a?.defaultTools==null||a?.defaultTools==!0||Array.isArray(a?.defaultTools)&&a?.defaultTools?.includes("filter"))&&e.jsx(gn,{table:t})]}),e.jsxs("div",{className:"flex gap-3",children:[a?.extraTools?.map((r,n)=>e.jsx(m.Fragment,{children:r},n)),(a?.defaultTools==null||a?.defaultTools==!0||Array.isArray(a?.defaultTools)&&a?.defaultTools?.includes("columnFilter"))&&e.jsx(xn,{table:t})]})]})}const ki=m.forwardRef(({columns:t,data:a,extraParams:r,onTableReady:n},s)=>{const[o,i]=m.useState([]),[c,u]=m.useState(""),[d,x]=m.useState([]),[p,w]=m.useState({pageIndex:r?.pageIndex||0,pageSize:r?.pageSize||15}),[N,v]=m.useState({}),[y,b]=m.useState([]),[C,g]=m.useState({}),[S,j]=m.useState({});t=t.map(D=>(D?.filterFn||(D.filterFn="arrIncludesSome"),D)),m.useEffect(()=>{r?.checkBoxColumnCallback&&r.checkBoxColumnCallback(h.getFilteredSelectedRowModel().rows)},[S]),r?.checkBoxColumn&&t.splice(0,0,{id:"checkBoxColumn",header:({table:D})=>e.jsx(Ze,{checked:D.getIsAllPageRowsSelected()||D.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:P=>D.toggleAllPageRowsSelected(!!P),"aria-label":"Select all"}),cell:({row:D})=>e.jsx(e.Fragment,{children:e.jsx(Ze,{checked:D.getIsSelected(),onCheckedChange:P=>D.toggleSelected(!!P),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1}),(r?.actionMenu||r?.groupActionMenu)&&t.push({id:"DTActions",accessorKey:"Actions",header:()=>e.jsx("div",{className:"text-center",children:"Action"}),size:20,headerClassName:"text-center",cell:({row:D})=>D.getIsGrouped()?r?.groupActionMenu?e.jsx("div",{className:"text-end",children:e.jsx(Bt,{actionMenus:r.groupActionMenu.items,extraActionParams:{arguments:[D.original,...r.groupActionMenu.extraArguments||[]]}})}):null:r?.actionMenu?e.jsx("div",{className:"text-center",children:e.jsx(Bt,{actionMenus:r.actionMenu.items,extraActionParams:{arguments:[D.original,...r.actionMenu.extraArguments||[]]}})}):null,enableSorting:!1,enableHiding:!1}),m.useEffect(()=>{r?.onPaginationChange?.(p)},[p]);const h=L.useReactTable({data:a,columns:t,state:{sorting:o,globalFilter:c,columnFilters:d,columnVisibility:N,rowSelection:S,grouping:y,expanded:C,pagination:p},onPaginationChange:w,onSortingChange:i,onExpandedChange:g,onColumnFiltersChange:x,onColumnVisibilityChange:v,onGroupingChange:b,onGlobalFilterChange:u,onRowSelectionChange:j,getCoreRowModel:L.getCoreRowModel(),getPaginationRowModel:L.getPaginationRowModel(),getSortedRowModel:L.getSortedRowModel(),getFilteredRowModel:L.getFilteredRowModel(),getGroupedRowModel:L.getGroupedRowModel(),getExpandedRowModel:L.getExpandedRowModel(),getFacetedRowModel:L.getFacetedRowModel(),getFacetedUniqueValues:L.getFacetedUniqueValues(),getFacetedMinMaxValues:L.getFacetedMinMaxValues(),manualPagination:r?.pagination==null||r?.pagination==!0?void 0:!0});m.useImperativeHandle(s,()=>h);const[I,T]=m.useState([]),A=(D,P)=>{const E={id:P.id,title:ye(P.column)};D.dataTransfer.setData("headerObj",JSON.stringify(E)),D.dataTransfer.effectAllowed="move"},O=D=>{D.preventDefault();const P=JSON.parse(D.dataTransfer.getData("headerObj"));if(!I.find(E=>E.id==P.id)){T(_=>[..._,P]);const E=h.getColumn(P.id);E&&E.getToggleGroupingHandler()()}},V=D=>{D.preventDefault()},ce=D=>{const P=I.filter(_=>_.id!==D);T(()=>[...P]);const E=h.getColumn(D);E&&E.getToggleGroupingHandler()()},[ke,we]=m.useState(!1);return m.useEffect(()=>{ke||we(!0),r?.defaultGroups&&h.setGrouping(r?.defaultGroups)},[]),m.useEffect(()=>{n&&n(h)},[n,h]),ke&&e.jsxs("div",{className:"w-full h-full flex flex-col gap-3 justify-between",children:[e.jsxs("div",{className:"flex-grow flex flex-col gap-3 overflow-hidden",children:[(r?.defaultTools==null||r.defaultTools||r.extraTools)&&e.jsx(vn,{table:h,extraParams:r}),e.jsxs("div",{className:"flex-grow flex flex-col overflow-hidden",children:[(r?.grouping==null||r.grouping)&&e.jsx("div",{className:"w-full border-t min-h-10 px-2 py-1 flex gap-3 items-center text-sm bg-card-new",onDrop:O,onDragOver:V,children:I.length===0?"Drag a column header here to group its column":I.map((D,P)=>e.jsxs("div",{className:"rounded-md px-2 py-1 bg-muted text-muted-foreground flex gap-3 items-center",children:[D.title,e.jsx("span",{onClick:()=>ce(D.id),children:e.jsx(f.X,{size:15})})]},D.id))}),e.jsx("div",{className:"flex-grow overflow-hidden",children:e.jsxs(Ar,{className:"border-t whitespace-nowrap bg-card-new",children:[(r?.header==null||r.header)&&e.jsx(Rr,{className:"sticky top-0 z-10 border-t bg-card-new",children:h.getHeaderGroups().map(D=>e.jsx(Ue,{className:H.cx(""),children:D.headers.map(P=>P.column.getIsGrouped()?P.column.getGroupedIndex()<I.length-1?null:e.jsx(Ft,{colSpan:I.length,className:H.cx("w-36 ","text-left")},P.id):e.jsx(Ft,{...r?.grouping==null||r.grouping?{onDragStart:E=>A(E,P),draggable:!0}:{},className:H.cx("text-left"),children:P.isPlaceholder?null:(r?.sorting==null||r.sorting)&&P.column.getCanSort()?e.jsxs("div",{onClick:P.column.getToggleSortingHandler(),className:H.cx("-mx-2 inline-flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1 hover:bg-muted"),children:[e.jsx("div",{children:L.flexRender(P.column.columnDef.header,P.getContext())}),P.column.getCanSort()?e.jsxs("div",{className:"-space-y-2",children:[e.jsx(f.ChevronUp,{className:H.cx("size-3.5 text-foreground",P.column.getIsSorted()==="desc"?"opacity-30":""),"aria-hidden":"true"}),e.jsx(f.ChevronDown,{className:H.cx("size-3.5 text-foreground",P.column.getIsSorted()==="asc"?"opacity-30":""),"aria-hidden":"true"})]}):null]}):L.flexRender(P.column.columnDef.header,P.getContext())},P.id))},D.id))}),e.jsx(zr,{children:h.getRowModel().rows.length?h.getRowModel().rows.map(D=>D.getIsGrouped()?e.jsx(Ue,{children:D.getVisibleCells().map(P=>P.column.getIndex()<D.depth?null:e.jsx(We,{colSpan:P.column.getIndex()==D.depth?D.depth+1:void 0,className:P.column.getIndex()==D.depth?"w-36":"",children:P.getIsGrouped()?e.jsxs(R,{variant:"link",onClick:D.getToggleExpandedHandler(),className:"text-right text-foreground",style:{marginLeft:D.depth+"rem"},children:[D.getIsExpanded()?e.jsx(f.ChevronDown,{}):e.jsx(f.ChevronRight,{})," ",L.flexRender(P.column.columnDef.cell,P.getContext())," ","(",D.subRows.length,")"]}):P.column.id=="DTActions"?L.flexRender(P.column.columnDef.cell,P.getContext()):P.getIsAggregated()?L.flexRender(P.column.columnDef.aggregatedCell??P.column.columnDef.cell,P.getContext()):P.getIsPlaceholder()?null:L.flexRender(P.column.columnDef.cell,P.getContext())},P.id))},D.id):e.jsx(Ue,{className:H.cx(D.getIsSelected()?"bg-accent/10":""),...r?.checkBoxColumn&&{onClick:()=>D.toggleSelected(!D.getIsSelected())},children:D.getVisibleCells().map((P,E)=>e.jsxs(We,{className:H.cx(D.getIsSelected()?"relative":"",!(r?.actionMenu||r?.groupActionMenu)&&"py-2"),children:[E===0&&D.getIsSelected()&&e.jsx("div",{className:"absolute inset-y-0 left-0 w-0.5 bg-primary"}),P.getIsPlaceholder()?null:L.flexRender(P.column.columnDef.cell,P.getContext())]},P.id))},D.id)):e.jsx(Ue,{children:e.jsx(We,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})}),r?.footer&&e.jsx(_r,{className:"sticky bottom-0 bg-background text-foreground",children:h.getFooterGroups().map(D=>e.jsx(Ue,{children:D.headers.map(P=>e.jsx(We,{children:P.isPlaceholder?null:e.jsx("div",{className:"flex items-center",children:L.flexRender(P.column.columnDef.footer,P.getContext())})}))}))})]})})]})]}),(r?.paginationBar==null||r.paginationBar)&&e.jsx(hn,{table:h,extraParams:r})]})});function jn({isLoading:t,onReload:a,errorMessage:r}){return!t&&!r?null:e.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/60 backdrop-blur-md rounded-lg transition-all duration-300",children:e.jsx("div",{className:"flex flex-col items-center gap-4",children:t?e.jsx("div",{className:"bg-background/80 p-6 rounded-2xl shadow-xl border border-border/50 backdrop-blur-xl animate-in fade-in zoom-in duration-300",children:e.jsx(f.Loader2,{size:48,className:"text-primary animate-spin"})}):e.jsx("div",{className:"bg-background/80 p-4 rounded-full shadow-lg border border-border/50 backdrop-blur-xl animate-in fade-in zoom-in duration-300",children:e.jsx("button",{onClick:a,className:"p-3 rounded-full bg-primary/10 hover:bg-primary/20 transition-all text-primary hover:scale-110 active:scale-95",title:r||"Reload Data",children:e.jsx(f.RotateCcw,{className:"w-6 h-6"})})})})})}function Ii(){const t=ae.useNavigate(),{pathname:a}=ae.useLocation(),[r]=ae.useSearchParams(),[n,s]=m.useState(r.get("search")||""),[o]=ys.useDebounce(n,500);return m.useEffect(()=>{const i=new URLSearchParams(r.toString());o?i.set("search",o):i.delete("search"),i.get("search")!==r.get("search")&&(i.set("page","1"),t(`${a}?${i.toString()}`,{replace:!0}))},[o,a,t,r]),m.useEffect(()=>{const i=r.get("search")||"";i!==n&&s(i)},[r]),e.jsxs("div",{className:"relative w-full max-w-sm",children:[e.jsx(f.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"Search ...",value:n,onChange:i=>s(i.target.value),className:"flex h-9 w-full rounded-md border border-border bg-transparent pl-9 pr-3 py-1 text-sm shadow-sm transition-colors text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary"})]})}function Ti(){const t=ae.useNavigate(),{pathname:a}=ae.useLocation(),[r]=ae.useSearchParams(),n=r.get("size")||"10",s=o=>{const i=new URLSearchParams(r.toString());i.set("size",o.target.value),i.set("page","1"),t(`${a}?${i.toString()}`)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Rows per page:"}),e.jsxs("select",{className:"h-9 rounded-md border border-border bg-background text-foreground px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary",value:n,onChange:s,children:[e.jsx("option",{value:"10",children:"10"}),e.jsx("option",{value:"20",children:"20"}),e.jsx("option",{value:"50",children:"50"}),e.jsx("option",{value:"100",children:"100"})]})]})}function Di({totalPages:t,currentPage:a}){const r=ae.useNavigate(),{pathname:n}=ae.useLocation(),[s]=ae.useSearchParams(),o=i=>{const c=new URLSearchParams(s.toString());c.set("page",i.toString()),r(`${n}?${c.toString()}`)};return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{type:"button",onClick:()=>o(a-1),disabled:a<=1,className:"h-9 px-3 py-1 text-sm font-medium border border-border rounded-md bg-background text-foreground hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),e.jsxs("span",{className:"text-sm text-muted-foreground px-2",children:["Page ",e.jsx("span",{className:"font-semibold",children:a})," of"," ",e.jsx("span",{className:"font-semibold",children:Math.max(t,1)})]}),e.jsx("button",{type:"button",onClick:()=>o(a+1),disabled:a>=t,className:"h-9 px-3 py-1 text-sm font-medium border border-border rounded-md bg-background text-foreground hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})}function Pi({table:t}){const[a,r]=m.useState(!1),[n,s]=m.useState(""),o=m.useRef(null),i=t.getState().columnFilters,u=t.getAllLeafColumns().filter(d=>d.getCanFilter()).filter(d=>d.id.toLowerCase().includes(n.toLowerCase()));return m.useEffect(()=>{const d=x=>{o.current&&!o.current.contains(x.target)&&r(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]),e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:e.jsxs("div",{className:"relative",ref:o,children:[e.jsxs("button",{onClick:()=>r(!a),className:`flex items-center gap-2 px-3 h-9 border rounded-md bg-background text-sm font-medium transition-all ${a?"border-primary ring-1 ring-primary":"border-border hover:bg-muted"}`,children:[e.jsx(f.ListFilter,{className:"w-4 h-4"}),"Filter"]}),a&&e.jsxs("div",{className:"absolute mt-2 w-64 bg-white border border-gray-200 rounded-md shadow-xl ",children:[e.jsx("div",{className:"p-3 border-b text-center font-bold text-gray-800 text-sm",children:"Columns For Filtering"}),e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(f.Search,{className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx("input",{placeholder:"Search columns...",className:"w-full pl-8 pr-2 py-1.5 border rounded text-sm outline-none focus:ring-1 focus:ring-blue-500",value:n,onChange:d=>s(d.target.value)})]}),e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1 pr-1",children:u.map(d=>{const x=i.some(p=>p.id===d.id);return e.jsxs("label",{className:"flex items-center gap-2 p-2 hover:bg-gray-50 rounded cursor-pointer text-sm group",children:[e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:x,onChange:()=>{x?d.setFilterValue(void 0):d.setFilterValue([])}}),e.jsx("span",{className:"text-gray-700 group-hover:text-black",children:typeof d.columnDef.header=="string"?d.columnDef.header:d.id})]},d.id)})})]}),e.jsxs("div",{className:"p-3 border-t bg-gray-50 flex gap-2 rounded-b-md",children:[e.jsxs("button",{onClick:()=>r(!1),className:"flex-1 flex items-center justify-center gap-1 py-1.5 bg-blue-600 text-white rounded text-xs font-semibold hover:bg-blue-700",children:[e.jsx(f.Check,{size:14})," Apply"]}),e.jsxs("button",{onClick:()=>{t.resetColumnFilters(),r(!1)},className:"flex-1 flex items-center justify-center gap-1 py-1.5 border border-gray-300 bg-white text-gray-600 rounded text-xs font-semibold hover:bg-gray-50",children:[e.jsx(f.RotateCcw,{size:14})," Reset"]})]})]})]})})}function Ai({activeFilters:t,table:a}){return e.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(r=>e.jsx(Ri,{filter:r,table:a},r.id))})}function Ri({filter:t,table:a}){debugger;const[r,n]=m.useState(!1),[s,o]=m.useState(t.value||[]),i=m.useRef(null),c=a.getColumn(t.id);m.useEffect(()=>{o(t.value||[])},[t.value]);const u=m.useMemo(()=>{const p=new Set;return a.getPreFilteredRowModel().flatRows.forEach(w=>{const N=w.getValue(t.id);N!=null&&p.add(N)}),Array.from(p).sort()},[a.getPreFilteredRowModel().flatRows,t.id]);m.useEffect(()=>{const p=w=>{i.current&&!i.current.contains(w.target)&&n(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const d=()=>{c.setFilterValue(s.length>0?s:void 0),n(!1)},x=()=>{o([]),c.setFilterValue(void 0),n(!1)};return e.jsxs("div",{className:"relative",ref:i,children:[e.jsxs("div",{className:"flex items-center border border-gray-300 rounded-full bg-white px-3 py-1 text-xs shadow-sm",children:[e.jsxs("span",{className:"font-bold text-gray-500 uppercase mr-1 tracking-tight",children:[typeof c.columnDef.header=="string"?c.columnDef.header:t.id,":"]}),e.jsxs("button",{onClick:()=>n(!r),className:"flex items-center gap-1 font-semibold text-blue-600 hover:text-blue-800",children:[t.value?.length?`${t.value.length} Selected`:"All",e.jsx(f.ChevronDown,{size:12})]}),e.jsx("button",{onClick:()=>c.setFilterValue(void 0),className:"ml-2 text-gray-400 hover:text-red-500 transition-colors",children:e.jsx(f.X,{size:14})})]}),r&&e.jsxs("div",{className:"absolute top-full left-0 mt-1 w-56 bg-white border border-gray-200 rounded-md shadow-lg z-[110]",children:[e.jsx("div",{className:"p-2 max-h-48 overflow-y-auto space-y-1",children:u.map(p=>e.jsxs("label",{className:"flex items-center gap-2 p-2 hover:bg-gray-50 rounded cursor-pointer text-xs",children:[e.jsx("input",{type:"checkbox",className:"rounded text-blue-600 border-gray-300",checked:s.includes(p),onChange:()=>{o(w=>w.includes(p)?w.filter(N=>N!==p):[...w,p])}}),e.jsx("span",{className:"truncate",children:String(p)})]},p))}),e.jsxs("div",{className:"p-2 border-t bg-gray-50 flex gap-2 rounded-b-md",children:[e.jsx("button",{onClick:d,className:"flex-1 py-1 px-2 bg-blue-600 text-white rounded text-[10px] font-bold hover:bg-blue-700",children:"Apply"}),e.jsx("button",{onClick:x,className:"flex-1 py-1 px-2 border border-gray-300 bg-white text-gray-600 rounded text-[10px] font-bold hover:bg-gray-50",children:"Reset"})]})]})]})}function zi({table:t}){const[a,r]=m.useState(!1),n=m.useRef(null);return m.useEffect(()=>{function s(o){n.current&&!n.current.contains(o.target)&&r(!1)}return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]),e.jsxs("div",{className:"relative",ref:n,children:[e.jsxs("button",{type:"button",className:`flex items-center gap-2 px-3 h-9 border rounded-md bg-background transition-colors text-sm font-medium ${a?"border-primary bg-muted":"border-border hover:bg-muted"}`,onClick:()=>r(!a),children:[e.jsx(f.Settings2,{className:"w-4 h-4"}),"Columns"]}),a&&e.jsxs("div",{className:"absolute right-0 mt-2 w-56 z-50 bg-background border border-border rounded-md shadow-lg p-2 animate-in fade-in zoom-in duration-100",children:[e.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b mb-1",children:"Toggle Columns"}),e.jsx("div",{className:"max-h-64 overflow-y-auto",children:t.getAllLeafColumns().map(s=>s.getCanHide()?e.jsxs("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-muted rounded cursor-pointer text-sm capitalize",children:[e.jsx("input",{type:"checkbox",checked:s.getIsVisible(),onChange:s.getToggleVisibilityHandler(),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),e.jsx("span",{className:"truncate",children:typeof s.columnDef.header=="string"?s.columnDef.header:s.id})]},s.id):null)}),e.jsx("div",{className:"border-t mt-1 pt-1",children:e.jsx("button",{type:"button",onClick:()=>t.toggleAllColumnsVisible(!0),className:"w-full text-left px-2 py-1.5 text-xs hover:bg-muted hover:text-primary rounded",children:"Show All"})})]})]})}function _i({data:t,columns:a,totalPages:r,toggleViewMode:n,gridComponent:s,actionNode:o,filterComponent:i,showFooter:c,footerLabel:u,hiddenColumns:d}){const[x,p]=m.useState("list"),w=ae.useNavigate(),{pathname:N}=ae.useLocation(),[v]=ae.useSearchParams(),y=Number(v.get("page")||"1")-1,[b,C]=m.useState({pageIndex:0,pageSize:10}),[g,S]=m.useState(""),[j,h]=m.useState([]),[I,T]=m.useState([]),[A,O]=m.useState({}),[V,ce]=m.useState({}),[ke,we]=m.useState({}),[D,P]=m.useState([]),E=L.useReactTable({data:t,columns:a,pageCount:r,meta:{footerLabel:u},state:{pagination:b,globalFilter:g,sorting:j,grouping:I,expanded:A,rowSelection:V,columnVisibility:ke,columnFilters:D},onSortingChange:h,onGroupingChange:T,onExpandedChange:O,onRowSelectionChange:ce,onGlobalFilterChange:S,onPaginationChange:C,onColumnVisibilityChange:we,onColumnFiltersChange:P,manualPagination:!1,manualFiltering:!1,getCoreRowModel:L.getCoreRowModel(),getPaginationRowModel:L.getPaginationRowModel(),getSortedRowModel:L.getSortedRowModel(),getFilteredRowModel:L.getFilteredRowModel(),getGroupedRowModel:L.getGroupedRowModel(),getExpandedRowModel:L.getExpandedRowModel(),filterFns:{multiSelect:(F,M,ot)=>{debugger;return ot.length?ot.includes(String(F.getValue(M))):!0}}});m.useEffect(()=>{E.getAllLeafColumns().map(F=>{d?.includes(F.id)&&F.toggleVisibility(!1)})},[d,E]);const _=(F,M)=>{F.dataTransfer.setData("headerId",M)},U=F=>{debugger;F.preventDefault();const M=F.dataTransfer.getData("headerId");M&&!I.includes(M)&&E.getColumn(M)?.toggleGrouping()};return m.useEffect(()=>{debugger;E.setGlobalFilter(v.get("search")||"")},[v,w,N]),m.useEffect(()=>{E.setPageSize(Number(v.get("size")||"10")),E.setPageIndex(Number(v.get("page")||"1")-1)},[v,w,N]),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ii,{}),e.jsx(Ai,{activeFilters:E.getState().columnFilters,table:E}),i&&i]}),e.jsxs("div",{className:"flex items-center gap-2",children:[o&&o,e.jsx(zi,{table:E}),e.jsx(Pi,{table:E}),n&&e.jsxs("div",{className:"flex items-center border border-border rounded-md bg-background overflow-hidden h-9",children:[e.jsx("button",{onClick:()=>p("list"),className:`px-2.5 h-full flex items-center justify-center transition-colors ${x==="list"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,title:"List View",children:e.jsx(f.List,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>p("grid"),className:`px-2.5 h-full flex items-center justify-center transition-colors ${x==="grid"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,title:"Grid View",children:e.jsx(f.LayoutGrid,{className:"w-4 h-4"})})]})]})]}),x==="list"?e.jsxs(e.Fragment,{children:[e.jsx("div",{onDragOver:F=>F.preventDefault(),onDrop:U,className:"w-full border border-dashed rounded-md h-10 p-2 flex gap-2 items-center text-sm bg-muted/20 ",children:I.length===0?e.jsx("span",{className:"text-muted-foreground",children:"Drag a column header here to group"}):I.map(F=>e.jsxs("div",{className:"flex items-center gap-1 bg-background border px-2 py-1 rounded shadow-sm",children:[F,e.jsx(f.X,{size:14,className:"cursor-pointer",onClick:()=>E.getColumn(F)?.toggleGrouping()})]},F))}),e.jsx("div",{className:"rounded-md border border-border bg-background overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50 border-b border-border sticky top-0",children:E.getHeaderGroups().map(F=>e.jsx("tr",{children:F.headers.map(M=>e.jsx("th",{className:"px-4 py-3 text-left font-medium cursor-pointer select-none",draggable:!0,onDragStart:ot=>_(ot,M.id),children:e.jsxs("div",{className:"flex items-center gap-2",onClick:M.column.getToggleSortingHandler(),children:[L.flexRender(M.column.columnDef.header,M.getContext()),{asc:e.jsx(f.ChevronUp,{size:14}),desc:e.jsx(f.ChevronDown,{size:14})}[M.column.getIsSorted()]??null]})},M.id))},F.id))}),e.jsx("tbody",{className:"divide-y divide-border",children:E.getRowModel().rows.map(F=>e.jsx("tr",{className:`hover:bg-muted/30 transition-colors ${F.getIsSelected()?"bg-accent/20":""}`,children:F.getVisibleCells().map(M=>e.jsx("td",{className:"px-4 py-3",children:M.getIsGrouped()?e.jsxs("button",{onClick:F.getToggleExpandedHandler(),className:"flex items-center gap-2 font-semibold",children:[F.getIsExpanded()?e.jsx(f.ChevronDown,{size:16}):e.jsx(f.ChevronRight,{size:16}),L.flexRender(M.column.columnDef.cell,M.getContext())," (",F.subRows.length,")"]}):M.getIsAggregated()?L.flexRender(M.column.columnDef.aggregatedCell??M.column.columnDef.cell,M.getContext()):M.getIsPlaceholder()?null:L.flexRender(M.column.columnDef.cell,M.getContext())},M.id))},F.id))}),c&&e.jsx("tfoot",{className:"bg-muted/30 border-t-2 border-border font-bold",children:E.getFooterGroups().map(F=>e.jsx("tr",{children:F.headers.map(M=>e.jsx("td",{className:"px-4 py-3 text-left",children:M.isPlaceholder?null:L.flexRender(M.column.columnDef.footer,M.getContext())},M.id))},F.id))})]})}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[e.jsx(Ti,{}),e.jsx(Di,{totalPages:r,currentPage:y+1})]})]}):s?s(t):e.jsx("div",{className:"p-12 text-center text-muted-foreground border border-border border-dashed rounded-md bg-muted/20",children:"Grid view not implemented for this component yet."})]})}function Fi({data:t,columns:a,totalPages:r,actionNode:n,toggleViewMode:s,gridComponent:o,isLoading:i=!1,onReload:c,filterComponent:u,hiddenColumns:d}){const[x,p]=m.useState("list");return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mb-2",children:e.jsx("div",{className:"flex items-center gap-2"})}),e.jsxs("div",{className:"relative min-h-[300px]",children:[e.jsx(jn,{isLoading:i,onReload:c||(()=>window.location.reload())}),e.jsx("div",{className:`transition-all duration-300 ${i?"opacity-50 pointer-events-none":""}`,children:e.jsx(_i,{data:t,columns:a,totalPages:r,actionNode:n,toggleViewMode:s,hiddenColumns:d,showFooter:!0,footerLabel:"Total Leads",filterComponent:u,gridComponent:o})})]})]})}function Mi(t){(t==null||typeof t!="object")&&(t={});const a={...t};return(a.toolbox===void 0||a.toolbox===null||typeof a.toolbox!="object")&&(a.toolbox={}),(a.toolbox.feature===void 0||a.toolbox.feature===null||typeof a.toolbox.feature!="object")&&(a.toolbox.feature={}),a}const Ei=m.forwardRef(({parentDivProps:t={},option:a={},style:r={},settings:n={},loading:s=!0,theme:o,isConfigurable:i=!1,resizeKey:c,onClick:u=()=>{},onConfigure:d=()=>{}},x)=>{const p=m.useRef(null),w=m.useRef(null),N=Mi(a);return i&&(N.toolbox.feature={...N.toolbox.feature,myConfigureChartTool:{show:!0,title:"Configure Chart",icon:"image://data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXNldHRpbmdzLTIiPjxwYXRoIGQ9Ik0yMCA3aC05Ii8+PHBhdGggZD0iTTE0IDE3SDUiLz48Y2lyY2xlIGN4PSIxNyIgY3k9IjE3IiByPSIzIi8+PGNpcmNsZSBjeD0iNyIgY3k9IjciIHI9IjMiLz48L3N2Zz4=",onclick:()=>d?.()}}),m.useImperativeHandle(x,()=>({getChartObject:()=>p.current?Me.getInstanceByDom(p.current):null,setOption:(v,y)=>{if(!p.current)return;Me.getInstanceByDom(p.current)?.setOption(v,y)},resize:(v=0)=>{if(!p.current)return;const y=Me.getInstanceByDom(p.current);y?.resize(),v&&setTimeout(()=>y?.resize(),v)},loadingVisible:v=>{if(!p.current)return;const y=Me.getInstanceByDom(p.current);v?y?.showLoading():y?.hideLoading()},dispose:()=>{if(!p.current)return;Me.getInstanceByDom(p.current)?.dispose()},on:(v,y)=>{if(!p.current)return;Me.getInstanceByDom(p.current)?.on(v,y)}})),m.useEffect(()=>{p.current&&(w.current=Me.init(p.current,o));const v=()=>w.current?.resize?.();return window.addEventListener("resize",v),()=>{w.current&&(w.current.dispose(),w.current=null),window.removeEventListener("resize",v)}},[o]),m.useEffect(()=>{w.current&&w.current.setOption(N,n),w.current&&w.current.on("click",u)},[a,n,o]),m.useEffect(()=>{w.current&&w.current.resize()},[c]),m.useEffect(()=>{w.current&&setTimeout(()=>{w.current?.resize()},500)},[]),e.jsx("div",{ref:p,...t,style:{width:"100%",height:"100%",...r}})});function wn({tooltipContent:t,fileNamePlaceholder:a,fileName:r,onFileNameChange:n,...s}){const o=m.useRef(null);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex",children:[e.jsx(K,{ref:o,type:"file",className:"hidden",...s}),e.jsx("div",{className:"mx-1"}),e.jsx(K,{className:"rounded-e-none",placeholder:a,onChange:(...i)=>n?.(...i),value:r}),e.jsx(Ie,{tooltipContent:t||"Browse File",onClick:()=>o?.current?.click(),className:"border-s-0 rounded-s-none",children:e.jsx(f.Upload,{})})]})})}const Li=(({blur:t=0,inactiveZone:a=.7,proximity:r=0,spread:n=20,variant:s="default",glow:o=!1,className:i,movementDuration:c=2,borderWidth:u=1,disabled:d=!0})=>{const x=m.useRef(null),p=m.useRef({x:0,y:0}),w=m.useRef(0),N=m.useCallback(v=>{x.current&&(w.current&&cancelAnimationFrame(w.current),w.current=requestAnimationFrame(()=>{const y=x.current;if(!y)return;const{left:b,top:C,width:g,height:S}=y.getBoundingClientRect(),j=v?.x??p.current.x,h=v?.y??p.current.y;v&&(p.current={x:j,y:h});const I=[b+g*.5,C+S*.5],T=Math.hypot(j-I[0],h-I[1]),A=.5*Math.min(g,S)*a;if(T<A){y.style.setProperty("--active","0");return}const O=j>b-r&&j<b+g+r&&h>C-r&&h<C+S+r;if(y.style.setProperty("--active",O?"1":"0"),!O)return;const V=parseFloat(y.style.getPropertyValue("--start"))||0,ke=(180*Math.atan2(h-I[1],j-I[0])/Math.PI+90-V+180)%360-180,we=V+ke;ct.animate(V,we,{duration:c,ease:[.16,1,.3,1],onUpdate:D=>{y.style.setProperty("--start",String(D))}})}))},[a,r,c]);return m.useEffect(()=>{if(d)return;const v=()=>N(),y=b=>N(b);return window.addEventListener("scroll",v,{passive:!0}),document.body.addEventListener("pointermove",y,{passive:!0}),()=>{w.current&&cancelAnimationFrame(w.current),window.removeEventListener("scroll",v),document.body.removeEventListener("pointermove",y)}},[N,d]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l("pointer-events-none absolute -inset-px hidden rounded-[inherit] border opacity-0 transition-opacity",o&&"opacity-100",s==="white"&&"border-white",d&&"!block")}),e.jsx("div",{ref:x,style:{"--blur":`${t}px`,"--spread":n,"--start":"0","--active":"0","--glowingeffect-border-width":`${u}px`,"--repeating-conic-gradient-times":"5","--gradient":s==="white"?"repeating-conic-gradient(from 236.84deg at 50% 50%,var(--black),var(--black) calc(25% / var(--repeating-conic-gradient-times)))":"linear-gradient(54.29deg, #00A5E9 22.93%, #A020F0 32.97%, #55C8FF 52.28%, #A020F0 73.13%, #071182 88.57%)"},className:l("pointer-events-none absolute inset-0 rounded-[inherit] opacity-100 transition-opacity",o&&"opacity-100",t>0&&"blur-[var(--blur)] ",i,d&&"!hidden"),children:e.jsx("div",{className:l("glow","rounded-[inherit]",'after:content-[""] after:rounded-[inherit] after:absolute after:inset-[calc(-1*var(--glowingeffect-border-width))]',"after:[border:var(--glowingeffect-border-width)_solid_transparent]","after:[background:var(--gradient)] after:[background-attachment:fixed]","after:opacity-[var(--active)] after:transition-opacity after:duration-300","after:[mask-clip:padding-box,border-box]","after:[mask-composite:intersect]","after:[mask-image:linear-gradient(#0000,#0000),conic-gradient(from_calc((var(--start)-var(--spread))*1deg),#00000000_0deg,#fff,#00000000_calc(var(--spread)*2deg))]")})})]})});function pt({name:t,...a}){const r=Rs[t];return r?e.jsx(r,{...a}):(console.warn(`Icon "${t}" not found in lucide-react`),null)}const Oi=({size:t=48,className:a,visible:r=!0,...n})=>r?e.jsx("div",{className:"h-full w-full",children:e.jsx("div",{className:"absolute inset-0 flex justify-center items-center z-50",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,...n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:l("animate-spin",a),children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}):null;function Bi({placeholder:t,items:a,onValueChange:r,defaultValue:n,defaultOptions:s=2}){const[o,i]=m.useState(n||[]),[c,u]=m.useState(""),d=m.useRef(null),[x,p]=m.useState(!1);m.useEffect(()=>{r(o)},[o,r]);const w=a.filter(g=>(g.label||g.value).toLowerCase().includes(c.toLowerCase())).sort((g,S)=>(g?.label??"").localeCompare(S?.label??"")),N=g=>{const S=g.currentTarget;S.scrollTop+=g.deltaY,g.preventDefault()},v=g=>{const S=o.includes(g)?o.filter(j=>j!==g):[...o,g];i(S)},[y,b]=m.useState(o.length),C=m.useCallback(()=>{const g=d.current;if(!g)return y;const S=Array.from(g.children),j=g.offsetWidth;let h=0,I=0;for(const T of S){const A=T.offsetWidth+4;if(h+A<=j)h+=A,I++;else break}return I},[y]);return m.useEffect(()=>{const g=d.current;if(!g)return;let S=null;const j=()=>{S&&cancelAnimationFrame(S),S=requestAnimationFrame(()=>{const I=C();b(T=>T!==I?I:T)})},h=new ResizeObserver(j);return h.observe(g),S=requestAnimationFrame(j),()=>{S&&cancelAnimationFrame(S),h.disconnect()}},[C]),e.jsxs(J,{open:x,onOpenChange:p,children:[e.jsx(Z,{asChild:!0,className:"w-full",children:e.jsxs(R,{variant:"outline",role:"combobox",className:l("justify-between px-3 py-2 h-10",o.length===0&&"text-foreground/50","bg-secondary"),onClick:()=>p(g=>!g),children:[o.length>0?e.jsx(Te,{children:e.jsxs("div",{ref:d,className:"flex flex-wrap gap-2 items-center overflow-hidden flex-1",children:[o.slice(0,s).map(g=>{const S=a.find(j=>j.value===g)?.label||g;return e.jsxs("span",{className:"flex items-center px-2 py-1 bg-secondary text-secondary-foreground rounded-md truncate max-w-full",title:S,children:[e.jsx("span",{className:"truncate max-w-[120px]",children:S}),e.jsx("span",{role:"button",tabIndex:0,onClick:j=>{j.stopPropagation(),v(g)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),v(g))},className:"ml-1 text-muted-foreground hover:text-destructive cursor-pointer outline-none",children:e.jsx(f.X,{className:"w-3 h-3 ml-1"})})]},g)}),o.length>s&&e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:e.jsxs("span",{className:"px-2 py-1 bg-secondary text-secondary-foreground dark:bg-secondary dark:text-secondary-foreground keross:bg-secondary keross:text-secondary-foreground rounded-md cursor-pointer",children:["+",o.length-s," more"]})}),e.jsx(oe,{className:"max-w-xs break-words",children:e.jsx("div",{onWheel:N,className:"flex flex-col gap-1 max-h-[200px] overflow-auto",children:o.slice(s).map(g=>e.jsx("span",{className:"text-sm",children:a.find(S=>S.value===g)?.label||g},g))})})]})]})}):e.jsx("span",{className:"flex-1 text-left truncate",children:t}),e.jsx(f.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(ee,{className:"p-0 min-w-[var(--radix-popover-trigger-width)]",style:{width:"max-content",maxWidth:"min(500px, 90vw)"},align:"start",children:e.jsxs(Q,{onMouseDown:g=>g.preventDefault(),children:[e.jsx(ie,{placeholder:"Search...",value:c,onValueChange:u}),e.jsxs(le,{onWheel:N,className:"max-h-60 overflow-auto",children:[e.jsx(de,{children:"No items found."}),e.jsx(re,{children:w.map(g=>{const S=o.includes(g.value),j=g.disabled===!0||typeof g.disabled=="function"&&g.disabled(g);return e.jsxs(X,{value:g.label||g.value,disabled:j,onPointerDown:h=>{h.preventDefault(),h.stopPropagation()},onSelect:()=>{j||v(g.value)},className:l("flex items-center justify-between space-x-2",j&&"opacity-50 cursor-not-allowed"),children:[e.jsx(Ze,{checked:S,onCheckedChange:()=>{j||v(g.value)},onClick:h=>h.stopPropagation(),disabled:j}),e.jsx("span",{className:"flex-grow text-left",children:g?.label||g.value})]},g.value)})})]})]})})]})}function na({text:t}){return e.jsxs("div",{className:"flex flex-col h-full justify-center text-center gap-2",children:[e.jsx(f.CircleAlert,{className:"text-muted-foreground mx-auto",size:36}),e.jsx("p",{className:"text-muted-foreground",children:t||"No Data Available"})]})}function Ui({title:t,subtitle:a,tools:r,children:n}){return t=t??"",a=a??"",e.jsxs("div",{className:"flex flex-col gap-4 h-full",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-1",children:[t&&e.jsx("h1",{className:"text-2xl font-semibold",children:t}),a&&e.jsx("p",{className:"text-muted-foreground/60",children:a})]}),e.jsx("div",{children:r})]}),n]})}const Vi=({value:t})=>{const a=Cs(t),r=a.score*100/4,n=()=>{switch(a.score){case 0:return"#828282";case 1:return"#EA1111";case 2:return"#FFAD00";case 3:return"#9bc158";case 4:return"#00b500";default:return""}};return e.jsx(e.Fragment,{children:e.jsx(Ct,{value:r,className:n()})})},xa=({code:t})=>{const a=Es[t];return e.jsx(a,{})};function Gi({className:t,...a}){const[r,n]=m.useState(!1),[s,o]=m.useState(""),[i,c]=m.useState("");return e.jsxs(J,{open:r,onOpenChange:n,children:[e.jsx(Z,{asChild:!0,children:e.jsxs(R,{variant:"outline",role:"combobox","aria-expanded":r,className:"justify-between bg-secondary",children:[i?e.jsx(xa,{code:i}):"...",e.jsx(f.ChevronsUpDown,{className:"opacity-50"})]})}),e.jsx(ee,{className:"p-0",align:"start",children:e.jsxs(Q,{filter:(u,d,x=[])=>(u.toLowerCase()+" "+x.join(" ").toLowerCase()).includes(d.toLowerCase())?1:0,children:[e.jsx(ie,{placeholder:"Search ...",className:"h-9"}),e.jsxs(le,{children:[e.jsx(de,{children:"No country found."}),e.jsx(re,{children:Object.entries(Ss.countries).map(([u,d])=>d.phone.map(x=>e.jsxs(X,{value:`${x}`,keywords:[d.name,"+"+x.toString(),u],onSelect:p=>{o(p===s?"":p),c(u),n(!1)},children:[e.jsx(xa,{code:u})," ",d.name," +",x]},x)))})]})]})})]})}function Nn({buttonText:t,buttonIcon:a,buttonStyle:r,sheetContent:n,sheetDescription:s,sheetTitle:o,closeButton:i}){return e.jsxs(ea,{children:[e.jsx(ur,{asChild:!0,children:e.jsxs(R,{variant:"outline",className:r,size:"icon-sm",children:[t,a]})}),e.jsxs(ta,{className:"p-4",children:[e.jsx(aa,{children:o}),n]})]})}const $i=f.icons;function qi({title:t,iconName:a,iconSize:r,iconClass:n,primaryText:s,secondaryText:o,mainClassName:i="",loading:c,loadingMessage:u}){let d=null;return a&&(d=$i[a]),r=r===void 0?20:r,n=n??"",u=u??"Loading...",e.jsx(gt,{className:i,children:e.jsxs($a,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{children:t}),c?e.jsx(f.LoaderCircle,{size:r,className:"animate-spin "+n}):d&&e.jsx(d,{size:r,className:n})]}),e.jsx("div",{className:"mt-6 text-2xl font-semibold",children:c?"...":s}),o&&e.jsx("small",{className:"mt-2 text-gray-400",children:c?u:o})]})})}function yn({children:t,tabArray:a,pathName:r,tabListClass:n="",tabListInnerClass:s="",tabListButtonClass:o="",tabContentClass:i="",headerEndComponent:c,onTabChange:u,isSeperatePage:d=!1}){const[x,p]=m.useState(5),w=kt(),[N,v]=m.useState([]),[y,b]=m.useState([]),[C,g]=m.useState(a.find(h=>h.default)?.tabId||a[0]?.tabId||"");m.useEffect(()=>{p(w?2:5)},[w]),m.useEffect(()=>{if(r&&d){const h=r.split("/").pop()||"";g(h)}},[r,d]),m.useEffect(()=>{v(a.slice(0,x)),b(a.slice(x))},[a,x]);const S=h=>{g(h),u?.(h)},j=h=>{v(I=>{const T=[...I],A=T.pop();return A&&b(O=>[...O.filter(V=>V.tabId!==h.tabId),A]),[...T,h]}),S(h.tabId)};return e.jsxs(Fr,{value:C,onValueChange:S,className:"w-full h-full flex flex-col",children:[e.jsxs(Er,{className:`flex justify-between items-center ${n}`,children:[e.jsxs("div",{className:`flex w-full ${s}`,children:[N.map(h=>e.jsx(Lr,{value:h.tabId,className:o,children:h.tabName},h.tabId)),y.length>0&&e.jsxs(ze,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(at,{variant:"outline",size:"sm",className:"mt-1",children:e.jsx(f.EllipsisVertical,{})})}),e.jsx(Fe,{children:y.map(h=>e.jsx(ue,{onClick:()=>j(h),children:h.tabName},h.tabId))})]})]}),c&&e.jsx("div",{children:c})]}),t?e.jsx(Mt,{value:C,className:`mt-3 flex-grow overflow-auto h-full w-full ${i}`,children:e.jsx(gt,{className:"h-full w-full p-3",children:t})}):a.map(h=>e.jsx(Mt,{value:h.tabId,className:`mt-3 flex-grow overflow-auto h-full w-full ${i}`,children:e.jsx(gt,{className:"h-full w-full p-3",children:h?.tabContent})},h.tabId))]})}function Cn(){const{setTheme:t,theme:a,resolvedTheme:r}=Pr(),[n,s]=m.useState(!1);m.useEffect(()=>{s(!0)},[]);const o=a==="system"?r:a,i=N=>{const v=parseInt(N.slice(1),16),y=v>>16&255,b=v>>8&255,C=v>>0&255,[g,S,j]=[y,b,C].map(h=>(h=h/255,h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4)));return .2126*g+.7152*S+.0722*j},c=N=>i(N)>.25?"#000000":"#ffffff",u=m.useCallback(()=>{const N=localStorage.getItem("primary")||"#0f172b",v=localStorage.getItem("secondary")||"#1b2336",y=localStorage.getItem("tertiary")||"#1f3aba",b=localStorage.getItem("primaryChart")||"#00bc7d",C=localStorage.getItem("secondaryChart")||"#fd9a00",g=localStorage.getItem("tertiaryChart")||"#ad46ff";document.documentElement.style.setProperty("--background",N),document.documentElement.style.setProperty("--secondary",v),document.documentElement.style.setProperty("--card",v),document.documentElement.style.setProperty("--popover",v),document.documentElement.style.setProperty("--muted",v),document.documentElement.style.setProperty("--sidebar",v),document.documentElement.style.setProperty("--btn-secondary",v),document.documentElement.style.setProperty("--accent",y),document.documentElement.style.setProperty("--sidebar-primary",y),document.documentElement.style.setProperty("--sidebar-accent",y),document.documentElement.style.setProperty("--foreground",c(N)),document.documentElement.style.setProperty("--secondary-foreground",c(v)),document.documentElement.style.setProperty("--card-foreground",c(v)),document.documentElement.style.setProperty("--popover-foreground",c(v)),document.documentElement.style.setProperty("--muted-foreground",c(v)),document.documentElement.style.setProperty("--sidebar-foreground",c(v)),document.documentElement.style.setProperty("--accent-foreground",c(y)),document.documentElement.style.setProperty("--sidebar-primary-foreground",c(y)),document.documentElement.style.setProperty("--sidebar-accent-foreground",c(y)),document.documentElement.style.setProperty("--chart-1",b),document.documentElement.style.setProperty("--chart-2",C),document.documentElement.style.setProperty("--chart-3",g),document.documentElement.style.setProperty("--chart-4",b),document.documentElement.style.setProperty("--chart-5",C)},[]),d=m.useCallback(()=>{document.documentElement.style.removeProperty("--background"),document.documentElement.style.removeProperty("--secondary"),document.documentElement.style.removeProperty("--card"),document.documentElement.style.removeProperty("--popover"),document.documentElement.style.removeProperty("--muted"),document.documentElement.style.removeProperty("--sidebar"),document.documentElement.style.removeProperty("--btn-secondary"),document.documentElement.style.removeProperty("--accent"),document.documentElement.style.removeProperty("--sidebar-primary"),document.documentElement.style.removeProperty("--sidebar-accent"),document.documentElement.style.removeProperty("--foreground"),document.documentElement.style.removeProperty("--secondary-foreground"),document.documentElement.style.removeProperty("--card-foreground"),document.documentElement.style.removeProperty("--popover-foreground"),document.documentElement.style.removeProperty("--muted-foreground"),document.documentElement.style.removeProperty("--sidebar-foreground"),document.documentElement.style.removeProperty("--accent-foreground"),document.documentElement.style.removeProperty("--sidebar-primary-foreground"),document.documentElement.style.removeProperty("--sidebar-accent-foreground"),document.documentElement.style.removeProperty("--chart-1"),document.documentElement.style.removeProperty("--chart-2"),document.documentElement.style.removeProperty("--chart-3"),document.documentElement.style.removeProperty("--chart-4"),document.documentElement.style.removeProperty("--chart-5")},[]);m.useEffect(()=>{n&&o==="blue-dark"&&(document.documentElement.classList.add("blue-dark"),u())},[n,o,u]);const x=m.useCallback(N=>{t(N),(N==="light"||N==="dark")&&(document.documentElement.classList.remove("blue-dark"),d()),N==="blue-dark"&&(document.documentElement.classList.add("blue-dark"),u())},[t,u,d]);if(!n)return null;const p=o==="blue-dark"?e.jsx(f.Waves,{className:"h-5 w-5"}):o==="dark"?e.jsx(f.Moon,{className:"h-5 w-5"}):o==="light"?e.jsx(f.Sun,{className:"h-5 w-5"}):e.jsx(f.Laptop,{className:"h-5 w-5"}),w=N=>o===N;return e.jsxs(ze,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(R,{variant:"outline",size:"icon","aria-label":"Change theme",title:`Theme: ${a==="system"?`system (${r})`:a}`,children:p})}),e.jsxs(Fe,{align:"end",sideOffset:8,children:[e.jsxs(ue,{onClick:()=>x("light"),className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(f.Sun,{className:"mr-2 h-4 w-4"})," Light"]}),w("light")&&e.jsx(f.Check,{className:"h-4 w-4"})]}),e.jsxs(ue,{onClick:()=>x("dark"),className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(f.Moon,{className:"mr-2 h-4 w-4"})," Dark"]}),w("dark")&&e.jsx(f.Check,{className:"h-4 w-4"})]}),e.jsxs(ue,{onClick:()=>x("blue-dark"),className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(f.Waves,{className:"mr-2 h-4 w-4"})," Custom"]}),w("blue-dark")&&e.jsx(f.Check,{className:"h-4 w-4"})]})]})]})}function Wi({title:t,value:a,valueText:r,isPercent:n=!0,className:s,titleClassName:o,valueClassName:i,progressClassName:c}){let u=a.toFixed(2);const d=u.split(".");return d[1]==="00"&&(u=d[0]),e.jsxs("div",{className:"w-full "+(s??""),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-muted-foreground text-sm "+(o??""),children:t}),e.jsx("div",{className:"text-sm "+(i??""),children:r??`${u}${n?"%":""}`})]}),e.jsx(Ct,{value:a,className:"w-full mt-2 "+(c??"")})]})}function Hi({processedData:t,value:a,onChange:r,placeholder:n="Select items...",searchPlaceholder:s="Search...",className:o}){const[i,c]=k.useState(!1),[u,d]=k.useState(""),{flatTree:x,itemMap:p}=t,w=k.useMemo(()=>{const b=new Map,C=new Set(a);return[...x].reverse().forEach(g=>{const S=p[g.id];if(!S||!g.treatAsParent||S.childrenIds.length===0)C.has(g.id)&&b.set(g.id,"checked");else{const j=S.childrenIds.map(T=>b.get(T)),h=j.filter(T=>T==="checked").length,I=j.filter(T=>T==="indeterminate").length;h===S.childrenIds.length?b.set(g.id,"checked"):(h>0||I>0)&&b.set(g.id,"indeterminate")}}),b},[a,x,p]),N=b=>{const C=new Set(a),g=w.get(b.id),S=!(g==="checked"||g==="indeterminate"),j=new Set,h=[...p[b.id]?.childrenIds||[]];for(;h.length>0;){const T=h.shift();j.add(T),(p[T]?.childrenIds||[]).forEach(O=>h.push(O))}S?(C.add(b.id),j.forEach(T=>C.add(T))):(C.delete(b.id),j.forEach(T=>C.delete(T)));let I=p[b.id]?.parentId;for(;I;){const T=p[I];T&&T.childrenIds.length>0&&(T.childrenIds.every(O=>C.has(O))?C.add(I):C.delete(I)),I=T?.parentId}r(Array.from(C))},v=k.useMemo(()=>{if(!u)return x.slice();const b=u.toLowerCase(),C=new Set;x.forEach(h=>{(h.title.toLowerCase().includes(b)||h.description.toLowerCase().includes(b)||h.index.toLowerCase().includes(b))&&C.add(h.id)});const g=new Set(C),S=h=>{let I=h;for(;I;){const T=p[I]?.parentId;if(T&&!g.has(T))g.add(T),I=T;else break}},j=h=>{const I=p[h]?.childrenIds||[];for(const T of I)g.has(T)||(g.add(T),j(T))};return C.forEach(h=>{S(h),j(h)}),x.filter(h=>g.has(h.id))},[u,x,p]),y=()=>{const b=a.filter(C=>{const g=p[C];return!g||g.childrenIds.length===0});if(b.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});if(b.length===1){const C=x.find(g=>g.id===b[0]);return C?C.index:n}return`${b.length} items selected`};return e.jsxs(J,{open:i,onOpenChange:c,children:[e.jsx(Z,{asChild:!0,children:e.jsxs(R,{variant:"outline",role:"combobox","aria-expanded":i,className:l("w-full justify-between transition-all duration-150 ease-in-out border hover:border-primary hover:shadow-sm bg-secondary cursor-pointer",o),children:[e.jsx("span",{className:"truncate",children:y()}),e.jsx(f.ChevronsUpDown,{className:l("ml-2 h-4 w-4 shrink-0 transition-transform duration-200",i&&"rotate-180")})]})}),e.jsx(ee,{className:"w-[--radix-popover-trigger-width] p-0 max-h-[400px] overflow-y-auto",children:e.jsxs(Q,{children:[e.jsx(ie,{placeholder:s,value:u,onValueChange:d}),e.jsxs(le,{className:"transition-all duration-200 ease-in-out",children:[e.jsx(de,{children:"No results found."}),v.map(b=>e.jsxs(X,{value:`${b.index} ${b.title} ${b.description}`,onSelect:()=>N(b),className:"flex items-start cursor-pointer gap-2",style:{paddingLeft:`${b.level*1.5+.75}rem`},children:[e.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 accent-primary border rounded",checked:w.get(b.id)==="checked",ref:C=>{C&&(C.indeterminate=w.get(b.id)==="indeterminate")},readOnly:!0}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-xs font-mono text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:b.index}),e.jsx("span",{className:"font-medium",children:b.title})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:b.description})]})]},b.id))]})]})})]})}function Ki({widgetData:t}){const a=t.slice(0,4),r=t.slice(4);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"flex flex-col md:flex-row gap-2",children:a.map(n=>e.jsxs("div",{className:"flex flex-1 flex-row justify-between border rounded-md p-2 border-l-4 border-l-primary",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(Te,{children:e.jsxs(ne,{children:[e.jsx(se,{className:"cursor-default select-text",children:e.jsx("p",{className:"font-medium max-w-[240px] truncate",children:n.widgetText})}),e.jsx(oe,{children:e.jsx("p",{children:n.widgetText})})]})}),e.jsx("div",{children:n.onButtonClickfunc?e.jsx(R,{className:"px-0",variant:"link",onClick:()=>n.onButtonClickfunc?.({id:n.id}),children:n.widgetNumber}):e.jsx("p",{className:"inline-flex items-center justify-center px-0 py-2 text-sm font-medium border border-transparent rounded-md",children:n.widgetNumber})})]}),e.jsx("div",{className:"flex justify-end items-center",children:n.iconName&&e.jsx(pt,{name:n.iconName})})]},n.id))}),r.length>0&&e.jsx("div",{className:"flex flex-col md:flex-row gap-2",children:r.map(n=>e.jsxs("div",{className:"flex flex-1 flex-row justify-between border rounded-md p-2 border-l-4 border-l-primary",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(Te,{children:e.jsxs(ne,{children:[e.jsx(se,{className:"cursor-default select-text",children:e.jsx("p",{className:"font-medium max-w-[240px] truncate",children:n.widgetText})}),e.jsx(oe,{children:e.jsx("p",{children:n.widgetText})})]})}),e.jsx("div",{children:n.onButtonClickfunc?e.jsx(R,{className:"px-0",variant:"link",onClick:()=>n.onButtonClickfunc?.({id:n.id}),children:n.widgetNumber}):e.jsx("p",{className:"inline-flex items-center justify-center px-0 py-2 text-sm font-medium border border-transparent rounded-md",children:n.widgetNumber})})]}),e.jsx("div",{className:"flex justify-end items-center",children:n.iconName&&e.jsx(pt,{name:n.iconName})})]},n.id))})]})}function Yi({onNavigate:t,onView:a,label:r,extraTools:n,view:s}){const[o,i]=m.useState(s===W.Views.DAY?"DAY":s===W.Views.WEEK?"WEEK":"MONTH");return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center mb-3",children:[e.jsxs(Ee,{type:"single",variant:"outline",onValueChange:c=>{switch(c){case"PREV":t("PREV");break;case"NEXT":t("NEXT");break;case"TODAY":t("TODAY");break}},children:[e.jsx($,{className:"rounded-e-none",value:"PREV",children:e.jsx(f.ChevronLeft,{size:16})}),e.jsx($,{className:"rounded-none border-x",value:"NEXT",children:e.jsx(f.ChevronRight,{size:16})}),e.jsx($,{className:"rounded-s-none",value:"TODAY",children:"Today"})]}),e.jsx("span",{className:"rbc-toolbar-label",children:r}),e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsxs(Ee,{type:"single",variant:"outline",value:o,onValueChange:c=>{switch(i(c),c){case"DAY":a(W.Views.DAY);break;case"WEEK":a(W.Views.WEEK);break;case"MONTH":a(W.Views.MONTH);break}},children:[e.jsx($,{className:"rounded-e-none",value:"MONTH",children:"Month"}),e.jsx($,{className:"rounded-none border-x-0",value:"WEEK",children:"Week"}),e.jsx($,{className:"rounded-s-none",value:"DAY",children:"Day"})]}),n?.map((c,u)=>e.jsx(m.Fragment,{children:c},u))]})]})})}function Xi({event:t,extraParamsEvent:a}){return e.jsxs("div",{className:"custom-event flex flex-row justify-between",children:[e.jsx("span",{className:"truncate w-auto",children:t.title}),e.jsxs("span",{className:"flex flex-row gap-1",children:[(a?.isEditableAll||t.isEditable)&&e.jsx(De,{tooltipContent:"Edit",children:e.jsx("button",{className:"event-edit-button w-fit px-1",onClick:r=>{r.stopPropagation(),a?.onEditEventClick?.(t)},children:e.jsx(f.SquarePen,{size:16})})}),e.jsx(De,{tooltipContent:"View",children:e.jsx("button",{className:"event-view-button w-fit px-1",onClick:r=>{r.stopPropagation(),a?.onViewEventClick?.(t)},children:e.jsx(f.Eye,{size:16})})})]})]})}const Qi={"en-US":Is.enUS},Ji=W.dateFnsLocalizer({format:qe.format,parse:qe.parse,startOfWeek:qe.startOfWeek,getDay:qe.getDay,locales:Qi});function Zi({events:t,extraParamsEvent:a,extraTools:r}){const[n,s]=m.useState(a?.defaultView==="day"?W.Views.DAY:a?.defaultView==="week"?W.Views.WEEK:a?.defaultView==="month"?W.Views.MONTH:a?.defaultView==="work week"?W.Views.WORK_WEEK:a?.defaultView==="agenda"?W.Views.AGENDA:W.Views.MONTH),[o,i]=m.useState(new Date);return e.jsx(W.Calendar,{localizer:Ji,events:t||[],startAccessor:"start",endAccessor:"end",views:[W.Views.DAY,W.Views.WEEK,W.Views.MONTH],view:n,onView:c=>s(c),date:o,onNavigate:c=>i(c),components:{event:c=>e.jsx(Xi,{event:c.event,extraParamsEvent:a}),toolbar:c=>e.jsx(Yi,{...c,extraTools:r,view:n})},style:{height:a?.height||"100%",margin:a?.margin||"0px"}})}const Sn=m.createContext(void 0);function kn({children:t}){const[a,r]=m.useState([]),n=c=>{r(u=>[...u.filter(x=>x.level<c.level),c])},s=(c,u)=>{r(u?c:d=>[...d,...c])},o=c=>{r(u=>[...u.filter(x=>x.level<=c.level)])},i=()=>{r([])};return e.jsx(Sn.Provider,{value:{breadcrumbItems:a,addBreadcrumb:n,backBreadcrumb:o,addBreadcrumbItems:s,clearBreadcrumb:i},children:t})}function sa(){const t=m.useContext(Sn);if(!t)throw new Error("useBreadcrumb must be used within a BreadcrumbProvider");return t}function In(){const{breadcrumbItems:t,backBreadcrumb:a}=sa(),[r,n]=m.useState(!1),[s,o]=m.useState(2),i=kt(),c=be.useNavigate();m.useEffect(()=>{o(i?2:4)},[i]);const u=m.useMemo(()=>({firstVisibleBreadcrumbList:t.slice(0,2),hiddenBreadcrumbList:i?t.slice(2):t.slice(2,s),lastVisibleBreadcrumbList:t.length>2?t.slice(2-(t.length<s?t.length:s)):[]}),[t,s,i]);return!u||i==null||s==null?null:e.jsx(Br,{children:e.jsxs(Ur,{children:[u.firstVisibleBreadcrumbList.map((d,x)=>x<t.length-1?e.jsxs(m.Fragment,{children:[e.jsx(Ve,{children:d.href?e.jsx(Lt,{className:"max-w-20 truncate md:max-w-none cursor-pointer",onClick:()=>{a(d),d.href&&c(d.href)},children:d.title}):e.jsx(He,{className:"max-w-20 truncate md:max-w-none",children:d.title})}),e.jsx(mt,{},"firstsep"+x)]},"first"+x):e.jsx(Ve,{children:e.jsx(He,{className:"max-w-20 truncate md:max-w-none",children:d.title})},"first"+x)),t.length>s?e.jsxs(e.Fragment,{children:[e.jsx(Ve,{children:i?e.jsxs(qr,{open:r,onOpenChange:n,children:[e.jsx(Wr,{"aria-label":"Toggle Menu",children:e.jsx(Ot,{className:"h-4 w-4"})}),e.jsxs(Xr,{children:[e.jsxs(Qr,{className:"text-left",children:[e.jsx(Zr,{children:"Navigate to"}),e.jsx(en,{children:"Select a page to navigate to."})]}),e.jsx("div",{className:"grid gap-1 px-2 lg:px-4",children:u.hiddenBreadcrumbList.map((d,x)=>e.jsx("div",{children:d.clickable==!1?e.jsx("span",{className:"py-1 text-sm",children:d.title}):e.jsx(be.Link,{to:d.href?d.href:"#",className:"py-1 text-sm",children:d.title})},x))}),e.jsx(Jr,{className:"pt-4",children:e.jsx(Kr,{asChild:!0,children:e.jsx(R,{variant:"outline",children:"Close"})})})]})]}):e.jsxs(ze,{open:r,onOpenChange:n,children:[e.jsx(_e,{className:"flex items-center gap-1","aria-label":"Toggle menu",children:e.jsx(Ot,{className:"h-4 w-4"})}),e.jsx(Fe,{align:"start",children:u.hiddenBreadcrumbList.map((d,x)=>e.jsx(ue,{children:d.href?e.jsx(be.Link,{to:d.href?d.href:"#",children:d.title}):e.jsx("span",{children:d.title})},x))})]})}),!i&&e.jsx(mt,{})]}):null,!i&&u.lastVisibleBreadcrumbList.map((d,x)=>x==u.lastVisibleBreadcrumbList.length-1?e.jsx(Ve,{children:e.jsx(He,{className:"max-w-20 truncate md:max-w-none cursor-pointer",children:d.title})},"last"+x):e.jsxs(m.Fragment,{children:[e.jsx(Ve,{children:d.href?e.jsx(Lt,{className:"max-w-20 truncate md:max-w-none cursor-pointer",onClick:()=>{a(d),d.href&&c(d.href)},children:d.title}):e.jsx(He,{className:"max-w-20 truncate md:max-w-none",children:d.title})}),e.jsx(mt,{},"lastsep"+x)]},"last"+x))]},"BreadcrumbList1")},"Breadcrumb1")}function el({breadcrumb:t}){const{addBreadcrumb:a}=sa();return m.useEffect(()=>{a(t)},[t]),e.jsx(e.Fragment,{})}const Tn=m.createContext(void 0);function Dn({children:t}){const[a,r]=m.useState([]),[n,s]=m.useState(null),[o,i]=m.useState(null),c=N=>{r(v=>v.some(b=>b.title===N.title)?v.map(b=>b.title===N.title?{...b,...N}:b):[...v,N])},u=N=>{r(v=>v.filter(y=>y.title!==N))},d=(N,v)=>{r(y=>y.map(b=>b.title===N?{...b,...v}:b))},x=N=>{s(N)},p=N=>{i(N)},w=()=>{r([])};return e.jsx(Tn.Provider,{value:{navItems:a,header:n,footer:o,setNavItems:r,addNavItem:c,removeNavItem:u,updateNavItem:d,clearNavItems:w,setSidebarHeader:x,setSidebarFooter:p},children:t})}function nt(){const t=m.useContext(Tn);if(!t)throw new Error("useSidebarNav must be used within a SidebarNavProvider");return t}function Pn(){const{navItems:t}=nt();return e.jsx(yr,{children:e.jsx(Cr,{children:t.map(a=>a.items&&a.items.length>0?e.jsx(Vr,{asChild:!0,defaultOpen:a.isActive,className:"group/collapsible",children:e.jsxs(zt,{children:[e.jsx(Gr,{asChild:!0,children:e.jsxs(_t,{tooltip:a.title,children:[a.icon&&e.jsx(a.icon,{}),e.jsx("span",{children:a.title}),e.jsx(f.ChevronRight,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),e.jsx($r,{children:e.jsx(Sr,{children:a.items.map(r=>e.jsx(kr,{children:e.jsx(Ir,{asChild:!0,children:e.jsx(be.Link,{to:r.url,children:e.jsx("span",{children:r.title})})})},r.title))})})]})},a.title):e.jsx(zt,{children:e.jsx(_t,{asChild:!0,tooltip:a.title,children:e.jsxs(be.Link,{to:a.url,className:"flex items-center gap-2 w-full",children:[a.icon&&e.jsx(a.icon,{}),e.jsx("span",{children:a.title})]})})},a.title))})})}function tl({items:t,sidebarHeader:a,sidebarFooter:r}){const{setNavItems:n,setSidebarHeader:s,setSidebarFooter:o}=nt();return m.useEffect(()=>{n(t),s(a),o(r)},[t,a,r,n,s,o]),null}function al({formControl:t,name:a,label:r,placeholder:n,formDescription:s,items:o,disabled:i,onSelect:c}){return e.jsx(e.Fragment,{children:e.jsx(xe,{control:t,name:a,render:({field:u})=>e.jsxs(fe,{className:"",children:[r&&e.jsx(e.Fragment,{children:e.jsx(ve,{children:r})}),e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,className:"w-full",children:e.jsx(ge,{children:e.jsxs(R,{variant:"outline",role:"combobox",className:l("justify-between",!u.value&&"text-muted-foreground"),disabled:i==!0||i&&i(...arguments),children:[u.value?o.find(d=>d.value===u.value)?.label||u.value:n,e.jsx(f.ChevronsUpDown,{className:"opacity-50"})]})})}),e.jsx(ee,{className:"p-0",align:"start",children:e.jsxs(Q,{children:[e.jsx(ie,{placeholder:"Search..."}),e.jsxs(le,{children:[e.jsx(de,{children:"No items found."}),e.jsx(re,{children:o.map(d=>e.jsxs(X,{value:d.value,disabled:d.disabled==!0||d.disabled&&d.disabled(d),onSelect:x=>{u.onChange(x),c&&c(x)},children:[d?.label||d.value,e.jsx(f.Check,{className:l("ml-auto",d.value===u.value?"opacity-100":"opacity-0")})]},d.value))})]})]})})]}),s&&e.jsx(je,{children:s}),e.jsx(pe,{})]})})})}function rl(t){const{field:a}=$e.useController({name:t.name,control:t.formControl}),r=t.value!==void 0?t.value:a.value;return e.jsx(xe,{control:t.formControl,name:t.name,render:({field:n})=>e.jsxs(fe,{className:"",children:[t.label&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{children:t.label}),e.jsx("br",{})]}),e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,className:"w-full",children:e.jsx(ge,{children:e.jsxs(R,{variant:"outline",role:"combobox",className:l("justify-between",!r&&"text-muted-foreground"),disabled:typeof t.disabled=="function"?t.disabled():t.disabled,children:[r?t.items.find(s=>s.value===r)?.label||r:t.placeholder,e.jsx(f.ChevronsUpDown,{className:"opacity-50"})]})})}),e.jsx(ee,{className:"p-0",align:"start",children:e.jsxs(Q,{children:[e.jsx(ie,{placeholder:"Search..."}),e.jsxs(le,{children:[e.jsx(de,{children:"No items found."}),e.jsx(re,{children:t.items.map(s=>e.jsxs(X,{value:s.value,disabled:typeof s.disabled=="function"?s.disabled(s):s.disabled,onSelect:o=>{n.onChange(o),t.onSelect&&t.onSelect(o),t.onChange&&t.onChange(o)},children:[s?.label||s.value,e.jsx(f.Check,{className:l("ml-auto",s.value===r?"opacity-100":"opacity-0")})]},s.value))})]})]})})]}),t.formDescription&&e.jsx(je,{children:t.formDescription}),e.jsx(pe,{})]})})}function nl({formControl:t,name:a,label:r,placeholder:n,dateFormat:s,calendarDateDisabled:o,formDescription:i,disabled:c}){return e.jsx(e.Fragment,{children:e.jsx(xe,{control:t,name:a,render:({field:u})=>e.jsxs(fe,{children:[r&&e.jsx(e.Fragment,{children:e.jsx(ve,{children:r})}),e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,className:"w-full",children:e.jsx(ge,{children:e.jsxs(R,{variant:"outline",className:l(!u.value&&"text-foreground/50"),disabled:c,children:[u.value?qe.format(u.value,s||"PPP"):e.jsx("span",{children:n||"Pick a date"}),e.jsx(f.CalendarIcon,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(ee,{className:"w-auto p-0",align:"start",children:e.jsx(Va,{mode:"single",selected:u.value,onSelect:u.onChange,disabled:o,captionLayout:"dropdown",autoFocus:!0})})]}),i&&e.jsx(je,{children:i}),e.jsx(pe,{})]})})})}function sl(){return e.jsx(e.Fragment,{})}function ol({formControl:t,label:a,formDescription:r,extraFormComponent:n,name:s,...o}){return e.jsx(e.Fragment,{children:e.jsx(xe,{control:t,name:s,render:({field:i})=>e.jsxs(fe,{children:[a&&e.jsx(ve,{children:a}),e.jsx(ge,{children:e.jsx(K,{...i,...o})}),n&&n(i.value),r&&e.jsx(je,{children:r}),e.jsx(pe,{})]})})})}function il({formControl:t,name:a,label:r,placeholder:n,formDescription:s,items:o=[],disabled:i,onSelect:c,defaultValue:u=[],defaultOptions:d=2}){const[x,p]=m.useState(""),w=m.useRef(null),N=o.filter(v=>v.label?.toLowerCase().includes(x.toLowerCase())).sort((v,y)=>(v?.label??"").localeCompare(y?.label??""));return e.jsx(xe,{control:t,name:a,render:({field:v})=>{m.useEffect(()=>{(v.value===void 0||v.value===null)&&u.length>0&&v.onChange(u)},[u,v]);const y=v.value||[],[b,C]=m.useState(y.length),g=m.useCallback(()=>{const h=w.current;if(!h)return b;const I=Array.from(h.children);let T=h.offsetWidth,A=0,O=0;for(const V of I){const ce=V.offsetWidth+4;if(A+ce<=T)A+=ce,O++;else break}return O},[b]);m.useEffect(()=>{const h=w.current;if(!h)return;let I=null;const T=new ResizeObserver(()=>{I&&cancelAnimationFrame(I),I=requestAnimationFrame(()=>{const A=g();C(O=>O!==A?A:O)})});return T.observe(h),C(g()),()=>{I&&cancelAnimationFrame(I),T.disconnect()}},[g]);const S=h=>{let I;y.includes(h)?I=y.filter(T=>T!==h):I=[...y,h],v.onChange(I),c&&c(I)},j=h=>{const I=h.currentTarget;I.scrollTop+=h.deltaY,h.preventDefault()};return e.jsxs(fe,{children:[r&&e.jsx(ve,{children:r}),e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,className:"w-full",children:e.jsx(ge,{children:e.jsxs(R,{variant:"outline",role:"combobox",className:l("justify-between",!y.length&&"text-foreground/50"),disabled:i===!0||i&&i(...arguments),children:[y.length>0?e.jsx(Te,{children:e.jsxs("div",{ref:w,className:"flex flex-wrap gap-2 items-center overflow-hidden",children:[y.slice(0,d).map(h=>{const I=o.find(T=>T.value===h)?.label||h;return e.jsxs("span",{className:"flex items-center px-2 py-1 bg-secondary text-secondary-foreground rounded-md truncate max-w-full",title:I,children:[e.jsx("span",{className:"truncate max-w-[120px]",children:I}),e.jsx("span",{role:"button",tabIndex:0,onClick:T=>{T.stopPropagation();const A=y.filter(O=>O!==h);v.onChange(A),c&&c(A)},onKeyDown:T=>{if(T.key==="Enter"||T.key===" "){T.preventDefault(),T.stopPropagation();const A=y.filter(O=>O!==h);v.onChange(A),c&&c(A)}},className:"ml-1 text-muted-foreground hover:text-destructive cursor-pointer outline-none",children:e.jsx(f.X,{className:"w-3 h-3 ml-1"})})]},h)}),y.length>d&&e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:e.jsxs("span",{className:"px-2 py-1 bg-secondary text-secondary-foreground rounded-md cursor-pointer",children:["+",y.length-d," more"]})}),e.jsx(oe,{className:"max-w-xs break-words",children:e.jsx("div",{onWheel:j,className:"flex flex-col gap-1 max-h-[200px] overflow-auto",children:y.slice(d).map(h=>e.jsx("span",{className:"text-sm",children:o.find(I=>I.value===h)?.label||h},h))})})]})]})}):n,e.jsx(f.ChevronsUpDown,{className:"opacity-50"})]})})}),e.jsx(ee,{id:"multiSelectPopover",className:"p-0 min-w-[--radix-popover-trigger-width]",style:{width:"max-content",maxWidth:"min(500px, 90vw)"},align:"start",children:e.jsxs(Q,{id:"commandPopover",children:[e.jsx(ie,{placeholder:"Search...",value:x,onValueChange:p,autoFocus:!0}),e.jsxs(le,{className:"max-h-60 overflow-auto",onWheel:j,children:[e.jsx(de,{children:"No items found."}),e.jsx(re,{children:N.map(h=>{const I=y.includes(h.value);return e.jsxs(X,{value:h.label??"",onSelect:()=>S(h.value),className:"flex items-center space-x-2 justify-start",children:[e.jsx(Ze,{checked:I,onCheckedChange:()=>S(h.value),onClick:T=>T.stopPropagation()}),e.jsx("span",{children:h.label})]},h.value)})})]})]})})]}),s&&e.jsx(je,{children:s}),e.jsx(pe,{})]})}})}function ll({formControl:t,label:a,formDescription:r,extraFormComponent:n,name:s,...o}){return e.jsx(e.Fragment,{children:e.jsx(xe,{control:t,name:s,render:({field:i})=>e.jsxs(fe,{children:[a&&e.jsx(ve,{children:a}),e.jsx(ge,{children:e.jsx(nn,{maxLength:4,...i,children:e.jsxs(sn,{children:[e.jsx(Ke,{index:0}),e.jsx(Ke,{index:1}),e.jsx(Ke,{index:2}),e.jsx(Ke,{index:3})]})})}),n&&n(i.value),r&&e.jsx(je,{children:r}),e.jsx(pe,{})]})})})}function dl(){return e.jsx("div",{children:"FormPhoneInput"})}function cl({formControl:t,name:a,label:r,formItemClass:n,formDescription:s,...o}){return e.jsx(e.Fragment,{children:e.jsx(xe,{control:t,name:a,render:({field:i})=>e.jsxs(fe,{className:n,children:[r&&e.jsx(ve,{children:r}),e.jsx(ge,{children:e.jsx(Or,{...i,...o})}),s&&e.jsx(je,{children:s}),e.jsx(pe,{})]})})})}function ul({formControl:t,label:a,formDescription:r,extraFormComponent:n,name:s,...o}){const[i,c]=k.useState(!1),u=()=>c(!i);return e.jsx(e.Fragment,{children:e.jsx(xe,{control:t,name:s,render:({field:d})=>e.jsxs(fe,{children:[a&&e.jsx(ve,{children:a}),e.jsxs("div",{className:"relative",children:[e.jsx(ge,{children:e.jsx(K,{type:i?"text":"password",...d,...o,className:`${o.className||""} pr-10`})}),e.jsx(R,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 text-muted-foreground hover:bg-transparent!",onClick:u,children:i?e.jsx(f.EyeOff,{className:"h-4 w-4"}):e.jsx(f.Eye,{className:"h-4 w-4"})})]}),n&&n(d.value),r&&e.jsx(je,{children:r}),e.jsx(pe,{})]})})})}function ml({rowCount:t=6,showToolbar:a=!0}){return e.jsxs("div",{className:"space-y-4",children:[a&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx(Le,{className:"h-8 w-64 rounded-md"}),e.jsx(Le,{className:"h-8 w-32 rounded-md"})]}),e.jsx("div",{className:"space-y-4",children:[...Array(t)].map((r,n)=>e.jsx("div",{className:"grid gap-4 items-center",children:e.jsx(Le,{className:"h-8 w-full"})},n))})]})}function xl({count:t}){return e.jsx("div",{className:"flex flex-row gap-3 w-full",children:t>0&&Array.from({length:t}).map((a,r)=>e.jsx(Le,{className:"w-1/"+t+" flex flex-col md:flex-row gap-2 h-20",children:e.jsx("div",{className:"flex flex-1 flex-row justify-between border rounded-md p-2 bg-card-new"})},"widget_"+r))})}function An(){const t=$e.useForm({defaultValues:{text:"",fileNames:[]}}),[a,r]=m.useState(""),[n,s]=m.useState([]),[o,i]=m.useState([]),[c,u]=m.useState(""),[d,x]=m.useState(!0),p=o.some(b=>b.progress<100),w=async(b,C)=>{const g=new FormData;g.append("file",C.file);try{const S=await ja.post("UPLOAD_ENDPOINT_URL",g,{onUploadProgress:j=>{const h=Math.round(j.loaded*100/(j.total||1));i(I=>I.map((T,A)=>A===b?{...T,progress:h}:T))}});i(j=>j.map((h,I)=>I===b?{...h,url:S.data.url,progress:100}:h))}catch(S){console.error("Upload failed:",S)}};m.useEffect(()=>{const b=new Date,C=String(b.getDate()).padStart(2,"0"),g=String(b.getMonth()+1).padStart(2,"0"),S=b.getFullYear();u(`${C}-${g}-${S}`)},[]),m.useEffect(()=>{o.forEach((b,C)=>{b.progress===0&&w(C,b)})},[o]);const N=()=>{if(a.trim()||o.length>0){const b={text:a.trim(),fileNames:o.map(C=>C.name)};s([b,...n]),r(""),i([]),x(!1)}},v=b=>{if(b.target.files){const C=Array.from(b.target.files).map(g=>({name:g.name,url:"",progress:0,file:g}));i(g=>[...g,...C]),x(!1)}},y=b=>{const C=o.filter((g,S)=>S!==b);i(C),C.length===0&&n.length===0&&x(!0)};return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col h-full w-full gap-3",children:[e.jsxs("div",{className:"flex-grow overflow-auto flex flex-col-reverse gap-2",children:[d&&e.jsx(na,{text:"No files uploaded"}),o.length>0&&e.jsxs("div",{className:"p-2 my-1 rounded-md border",children:[e.jsx("p",{className:"font-bold",children:"Selected Files:"}),o.map((b,C)=>e.jsxs("div",{className:"flex flex-col mb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("a",{href:b.url,download:b.name,className:"text-sm text-blue-600 underline cursor-pointer",children:b.name}),e.jsx("button",{onClick:()=>y(C),className:"text-red-500 hover:text-red-800",children:e.jsx(f.X,{className:"w-4 h-4"})})]}),e.jsx(Ct,{value:b.progress}),e.jsxs("p",{className:"text-xs text-gray-500",children:[b.progress,"% uploaded"]})]},C))]}),n.map((b,C)=>e.jsxs("div",{className:"border-b text-sm pb-2",children:[b.fileNames.map((g,S)=>e.jsx("p",{children:e.jsx("a",{href:o.find(j=>j.name===g)?.url||"#",download:g,className:"text-sm text-blue-500 underline cursor-pointer",children:g})},S)),e.jsx("p",{children:b.text||"(No Text)"}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("p",{children:"John Doe"}),e.jsx("p",{children:c})]})]},C))]}),e.jsx(tn,{...t,children:e.jsx("form",{onSubmit:t.handleSubmit(()=>N()),children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(xe,{name:"text",render:({field:b})=>e.jsxs(fe,{children:[e.jsx(ge,{children:e.jsx(K,{id:"text-input",type:"text",value:a,onChange:C=>r(C.target.value),placeholder:"Type something..."})}),e.jsx(pe,{})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ne,{htmlFor:"file-upload",className:"sr-only",children:"Upload Files"}),e.jsx(R,{variant:"outline",asChild:!0,children:e.jsx("label",{htmlFor:"file-upload",className:"cursor-pointer",children:e.jsx(f.UploadIcon,{className:"w-5 h-5"})})}),e.jsx(K,{id:"file-upload",type:"file",multiple:!0,onChange:v,className:"hidden"})]}),e.jsx(R,{variant:"outline",type:"submit",disabled:p,children:e.jsx(f.Send,{})})]})})})})]})})}function Rn({...t}){const{navItems:a,header:r,footer:n}=nt();return!a||a.length===0?null:e.jsxs(pr,{className:"ml-12",collapsible:"offcanvas",...t,children:[r&&e.jsx(jr,{children:r}),e.jsx(Nr,{children:e.jsx(Pn,{})}),n&&e.jsx(wr,{children:n}),e.jsx(br,{})]})}function zn(){return e.jsx("footer",{className:"ml-12 flex border-t px-4 py-2 justify-center lg:justify-start",children:e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(f.Copyright,{className:"size-4"}),e.jsx("span",{children:"Powered By"}),e.jsx("a",{href:"https://keross.com",target:"_blank",children:"Keross"}),e.jsx("span",{className:"",children:"|"}),e.jsx("span",{id:"txtCopyrightYear",className:"",children:new Date().getFullYear()})]})})}const te={IKON_ACCOUNT_API_URL:"",IKON_AUTH_API_URL:"",IKON_BASE_API_URL:"",IKON_PLATFORM_API_URL:"",IKON_PLATFORM_PROFILE_URL:"",IKON_PLATFORM_UI_URL:"",IKON_USER_API_URL:"",LOGIN_PAGE_URL:""},fl=t=>{te.IKON_BASE_API_URL=t.IKON_BASE_API_URL,te.IKON_PLATFORM_API_URL=`${t.IKON_BASE_API_URL}/platform`,te.IKON_AUTH_API_URL=`${te.IKON_PLATFORM_API_URL}/auth`,te.IKON_USER_API_URL=`${te.IKON_PLATFORM_API_URL}/user`,te.IKON_ACCOUNT_API_URL=`${te.IKON_PLATFORM_API_URL}/account`,te.LOGIN_PAGE_URL=t.LOGIN_PAGE_URL,te.IKON_PLATFORM_UI_URL=t.IKON_PLATFORM_UI_URL,te.IKON_PLATFORM_PROFILE_URL=`${t.IKON_PLATFORM_UI_URL}/setting/profile`},he=()=>te;function _n(){const{navItems:t}=nt(),{IKON_PLATFORM_UI_URL:a}=he();return e.jsx("header",{className:"ml-12 flex h-12 border-b shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 px-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[!t||t.length===0?e.jsx("div",{}):e.jsx(hr,{className:"-ml-1"}),!t||t.length===0?e.jsx("div",{}):e.jsx(St,{orientation:"vertical",className:"mr-2 data-[orientation=vertical]:h-4"}),e.jsx(In,{})]}),e.jsxs("div",{className:"ml-auto flex gap-4",children:[e.jsx(Ie,{className:"px-2!",tooltipContent:"Notifications",children:e.jsx(f.Bell,{})}),e.jsx(Cn,{}),e.jsx(be.Link,{to:`${a}/app-store`,children:e.jsxs(rt,{variant:"default",children:[e.jsx(f.Play,{}),"App Store"]})})]})]})})}const oa="ikoncloud_next_";function Ut(t,a,r){let n=r?.expires;!n&&r?.maxAge&&(n=r.maxAge/86400),qt.set(oa+t,a,{httpOnly:!1,sameSite:"lax",expires:n})}function ht(t){return qt.get(oa+t)}function Vt(t){qt.remove(oa+t)}async function gl(){}async function st(t){const a=ht("accessToken"),r=ht("refreshToken");if(a)return a;if(r){const n=await Fn(r,t?.isSetToken);if(n)return n}return null}async function Fn(t,a){try{const r=await fetch(`${he().IKON_AUTH_API_URL}/refresh-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(r.ok){const s=await r.json(),{accessToken:o,refreshToken:i,expiresIn:c,refreshExpiresIn:u}=s;if(a==null||a)try{Ut("accessToken",o,{maxAge:c}),Ut("refreshToken",i,{maxAge:u})}catch(d){console.error(d)}return o}}catch(r){console.error("Failed to refresh access token:",r)}return null}function Gt(){Vt("accessToken"),Vt("refreshToken"),typeof window<"u"&&(window.location.href=he().LOGIN_PAGE_URL)}const Pe=ja.create();Pe.interceptors.request.use(async t=>{const a=await st();return a&&t.headers&&(t.headers.Authorization=`Bearer ${a}`),t},t=>Promise.reject(t instanceof Error?t:new Error(String(t))));Pe.interceptors.response.use(t=>t,async t=>{const a=t.config;if(t.response?.status===401&&a&&!a._retry){a._retry=!0;try{const r=await st({isSetToken:!0});if(r&&a.headers)return a.headers.Authorization=`Bearer ${r}`,Pe(a);Gt()}catch(r){return Gt(),Promise.reject(r instanceof Error?r:new Error(String(r)))}}return Promise.reject(t instanceof Error?t:new Error(String(t)))});function pl(t){return Oe.useQuery({queryKey:["profile",t],queryFn:async()=>{if(!t)throw new Error("No userId");return(await Pe.get(`${he().IKON_USER_API_URL}/${t}`)).data},enabled:!!t})}function hl(){const t=Oe.useQueryClient();return Oe.useMutation({mutationFn:async a=>{await Pe.post(`${he().IKON_AUTH_API_URL}/switch-account`,{targetAccountId:a})},onSuccess:()=>{t.invalidateQueries({queryKey:["accounts"]}),t.invalidateQueries({queryKey:["profile"]})}})}function bl(){return Oe.useQuery({queryKey:["accountMembership"],queryFn:async()=>{const{data:t}=await Pe.get(`${he().IKON_BASE_API_URL}/platform/user/account-membership`);return t}})}function vl(){return Oe.useQuery({queryKey:["softwares"],queryFn:async()=>{const{data:t}=await Pe.get(`${he().IKON_BASE_API_URL}/platform/software/accessible/user`);return t}})}const Mn=m.createContext(void 0);function jl({children:t}){const[a,r]=m.useState(null);m.useEffect(()=>{const c=ht("accessToken");if(c)try{const u=Ts.jwtDecode(c);r(d=>({...d,userId:u.sub,primaryAccountId:u.primaryAccountId,activeAccountId:u.activeAccountId,roles:u.platformAccess?.roles??[]}))}catch{r(null)}},[]);const n=a?.userId??"",{data:s,isSuccess:o}=pl(n);m.useEffect(()=>{o&&s&&r(c=>({...c,...s}))},[o,s]);const i=c=>{r(u=>({...u,accountName:c}))};return e.jsx(Mn.Provider,{value:{user:a,setUser:r,setAccountName:i},children:t})}function En(){const t=m.useContext(Mn);if(!t)throw new Error("useUser must be used within a UserProvider");return t}function wl(){const{user:t,setUser:a}=En();return e.jsxs(ze,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-10 w-10",children:e.jsx(f.CircleUserRound,{className:"h-8 w-8"})})}),e.jsxs(Fe,{className:"w-55 p-0",side:"right",sideOffset:8,children:[e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-card",children:[e.jsx(f.CircleUserRound,{className:"h-8 w-8"}),e.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-bold text-foreground blue-dark:text-muted-foreground truncate",children:t?.userName}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t?.userEmail}),e.jsx("p",{className:"text-sm text-muted-foreground font-semibold"})]})]}),e.jsx(yt,{className:"my-0"}),e.jsxs(ue,{onClick:async()=>{Gt()},className:"flex items-center gap-2 px-4 py-3 cursor-pointer focus:bg-destructive dark:focus:bg-destructive blue-dark:focus:bg-destructive",children:[e.jsx(f.LogOut,{className:"h-4 w-4 text-foreground"}),e.jsx("span",{children:"Log out"})]})]})]})}function Nl(){const{data:t}=bl(),{user:a,setAccountName:r}=En(),n=i=>i?i.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2):"UN";m.useEffect(()=>{const i=t?.find(c=>c.accountId===a?.activeAccountId);r(i?.accountName||"")},[t]);const{mutateAsync:s}=hl(),o=async i=>{await s(i.accountId),r(i.accountName)};return e.jsxs(ze,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(R,{variant:"default",className:"mb-4 h-8 w-8 rounded-lg p-0",disabled:!a?.accountName,children:e.jsx("span",{className:"text-base font-medium text-accent-background",children:a?n(a.accountName):"..."})})}),e.jsxs(Fe,{className:"w-55",side:"right",sideOffset:8,align:"start",children:[e.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-foreground",children:"Accounts"}),t?.map(i=>e.jsxs(ue,{className:"flex items-center justify-between cursor-pointer",onClick:async()=>{try{await o(i),window.location.reload()}catch(c){console.error("Switch account failed",c)}},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-6 w-6 rounded bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-xs font-medium text-primary",children:n(i.accountName)})}),e.jsx("span",{className:"text-sm",children:i.accountName})]}),a?.activeAccountId===i.accountId&&e.jsx(f.Check,{className:"h-4 w-4 text-primary"})]},i.accountId))]})]})}function yl(){const{IKON_PLATFORM_UI_URL:t}=he(),{data:a}=vl();function r(n){return n.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join("")}return e.jsxs(e.Fragment,{children:[" ",e.jsx("nav",{className:"flex flex-col gap-1",children:e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,className:"h-8 w-8",children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-10 w-10",asChild:!0,children:e.jsxs(be.Link,{to:`${t}/home`,children:[e.jsx(f.Home,{className:"h-8 w-8"}),e.jsx("span",{className:"sr-only",children:"Home"})]})})}),e.jsx(oe,{side:"right",sideOffset:5,children:"Home"})]},"home")}),e.jsx("nav",{className:"flex flex-col gap-1 flex-1",children:a?.map(n=>{if(!n.visible)return null;const s=!!(n.icon&&n.icon.trim()!=="");return e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,className:"h-8 w-8",children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-10 w-10",asChild:!0,children:e.jsxs(be.Link,{to:n.url??"#",children:[s?e.jsx(pt,{name:r(n.icon??""),className:"h-8 w-8"}):e.jsx(f.FolderCode,{className:"h-8 w-8"}),e.jsx("span",{className:"sr-only",children:n.softwareName})]})})}),e.jsx(oe,{side:"right",sideOffset:5,children:n.softwareName})]},n.softwareName)})})]})}const Ln=()=>{const{IKON_PLATFORM_UI_URL:t}=he();return e.jsx(Te,{delayDuration:0,children:e.jsxs("aside",{className:"fixed left-0 top-0 z-20 h-screen w-12 border-r border-border bg-sidebar text-sidebar-foreground flex flex-col items-center py-4 ",children:[e.jsx(Nl,{}),e.jsx(yl,{}),e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,className:"h-8 w-8",children:e.jsx(R,{variant:"ghost",className:"h-10 w-10",asChild:!0,children:e.jsxs(be.Link,{to:`${t}/settings`,children:[e.jsx(f.Settings,{className:"h-8 w-8"}),e.jsx("span",{className:"sr-only",children:"Settings"})]})})}),e.jsx(oe,{side:"right",sideOffset:5,children:"Settings"})]},"settings"),e.jsx(wl,{})]})})};function On({children:t}){return e.jsxs(e.Fragment,{children:[e.jsx(Ln,{}),e.jsx(gr,{children:e.jsx(mn,{children:e.jsxs(Dn,{children:[e.jsx(Rn,{}),e.jsxs(vr,{className:"flex flex-col h-screen",children:[e.jsx(_n,{}),e.jsx("div",{className:"flex flex-col gap-4 p-4 pt-0 ml-12 grow overflow-auto scrollbar-hidden",children:t}),e.jsx(zn,{})]})]})})})]})}const Bn=m.createContext(void 0);function Un({children:t}){const[a,r]=m.useState("Poppins"),[n,s]=m.useState(!1);m.useEffect(()=>{s(!0);const i=localStorage.getItem("app-font");i&&["Poppins","Oswald","Outfit"].includes(i)&&r(i)},[]),m.useEffect(()=>{if(!n)return;const i={Poppins:"var(--font-poppins)",Oswald:"var(--font-oswald)",Outfit:"var(--font-outfit)"};document.body.style.fontFamily=i[a],document.documentElement.style.fontFamily=i[a],localStorage.setItem("app-font",a),console.log("Font changed to:",a,i[a])},[a,n]);const o=m.useMemo(()=>({font:a,setFont:r}),[a]);return e.jsx(Bn.Provider,{value:o,children:t})}const Cl=()=>{const t=m.useContext(Bn);if(t===void 0)throw new Error("useFont must be used within a FontProvider");return t},Vn=m.createContext(void 0);function Gn({children:t}){const[a,r]=m.useState(.5),[n,s]=m.useState(!1);m.useEffect(()=>{s(!0);const i=localStorage.getItem("app-radius");if(i){const c=parseFloat(i);[0,.25,.5,.75,1].includes(c)&&r(c)}},[]),m.useEffect(()=>{if(!n)return;const i=a===0?"0rem":`${a}rem`;document.documentElement.style.setProperty("--radius",i),localStorage.setItem("app-radius",a.toString()),console.log("Radius changed to:",a,i)},[a,n]);const o=m.useMemo(()=>({radius:a,setRadius:r}),[a]);return e.jsx(Vn.Provider,{value:o,children:t})}const Sl=()=>{const t=m.useContext(Vn);if(t===void 0)throw new Error("useRadius must be used within a RadiusProvider");return t},$n=m.createContext(void 0);function kl({children:t}){const[a,r]=m.useState(0),n=m.useCallback(()=>{r(s=>s+1)},[]);return e.jsx($n.Provider,{value:{refresh:n,refreshCounter:a},children:t})}function Il(){const t=m.useContext($n);if(t===void 0)throw new Error("useRefresh must be used within a RefreshProvider");return t}const Tl=new Oe.QueryClient;function Dl({children:t}){return e.jsx(Oe.QueryClientProvider,{client:Tl,children:t})}function Pl({children:t}){const a=he();if(!a.IKON_BASE_API_URL||!a.IKON_PLATFORM_UI_URL||!a.LOGIN_PAGE_URL)throw new Error("[IKON] ProviderWrapper: Ikon config not set. Please call setIkonConfig() before rendering ProviderWrapper.");return e.jsx(Dl,{children:e.jsx(jl,{children:e.jsx(Dr,{children:e.jsx(Un,{children:e.jsx(Gn,{children:e.jsx(kn,{children:e.jsx(kl,{children:e.jsx(be.BrowserRouter,{children:e.jsx(On,{children:t})})})})})})})})})}function Al({activityLogs:t=[]}){const a=[{tabName:"Activity",tabId:"tab-activity",default:!0,tabContent:e.jsx("div",{className:"overflow-auto flex flex-col gap-2 h-full",children:t.length>0?t.map(r=>e.jsxs("div",{className:"border-b text-sm pb-2",children:[e.jsx("p",{className:"font-medium pb-1",children:r.activity}),e.jsxs("p",{className:"text-gray-500 pb-1",children:["Updated On:"," ",e.jsx("span",{className:"text-gray-700",children:new Date(r.updatedOn).toLocaleString()})]}),e.jsxs("p",{className:"text-gray-500 pb-1",children:["Updated By: ",e.jsx("span",{className:"text-gray-700",children:r.updatedBy})]})]},r.id)):e.jsx(na,{text:"No Activity Logs Available"})})},{tabName:"File Upload",tabId:"tab-upload",default:!1,tabContent:e.jsx(An,{})}];return e.jsx(Nn,{buttonText:"",buttonIcon:e.jsx(f.AlignJustify,{}),sheetTitle:"",sheetContent:e.jsx(yn,{tabArray:a,tabListClass:""}),closeButton:!0})}const Rl=({src:t,onCroppedImage:a,aspectRatio:r,rotationAngle:n,zoomLevel:s,moveDirection:o})=>{const i=m.useRef(null);function c(u){const d=i.current?.cropper;if(d){const p=d.getCroppedCanvas().toDataURL("image/webp");a(p)}else console.log("Cropper instance is not available.")}return m.useEffect(()=>{const u=i.current?.cropper;u&&u.rotate(n)},[n]),m.useEffect(()=>{const u=i.current?.cropper;u&&u.getCropBoxData().width&&(console.log("Inside cropper scale"),u.scale(s))},[s]),m.useEffect(()=>{const u=i.current?.cropper;if(u&&u.getCropBoxData().width){const{x,y:p}=o;typeof x=="number"&&typeof p=="number"&&u.move(x,p)}},[o]),m.useEffect(()=>{const u=i.current?.cropper;if(u&&(u.setAspectRatio(r),r===1)){const d=u.getCanvasData(),x=d.width,p=d.height,w=d.left,N=d.top,v=200,y=100,b=w+(x-v)/2,C=N+(p-y)/2;u.setCropBoxData({left:b,top:C,width:v,height:y})}},[r]),e.jsx(wa,{src:t,style:{height:"100%",width:"100%",objectFit:"contain"},guides:!0,crop:c,ref:i,dragMode:"move",movable:!0,zoomable:!0,scalable:!0,cropBoxMovable:!0,cropBoxResizable:!1})},qn=m.memo(Rl),fa={landscape:4/3,portrait:3/4,icon:1/1};function zl({onNewFileUpload:t}){const{originalImage:a,setOriginalImage:r,aspectRatioWiseImages:n,setAspectRatioWiseImages:s}=ia(),[o,i]=m.useState(null),[c,u]=m.useState(),[d,x]=m.useState(0),[p,w]=m.useState(1),[N,v]=m.useState({x:0,y:0}),[y,b]=m.useState(null),C=j=>{j.preventDefault(),g(j.dataTransfer.files[0])},g=j=>{if(typeof j=="string")b(j);else if(j?.type?.startsWith("image/")){t?.();const h=new FileReader;h.onloadend=()=>{b(h.result),u(void 0)},h.readAsDataURL(j),r({...a,image:j,name:j.name})}else ba.toast.error("Please select a valid image file.")};m.useEffect(()=>{a.image&&g(a.image)},[a.image]);const S=j=>{const h=o&&c===j?o:n[j];return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"mb-3",children:j}),e.jsx(Et,{ratio:fa[j],className:"bg-muted",children:h&&e.jsx("img",{src:h,alt:`Preview ${j}`,className:"absolute inset-0 w-full h-full object-contain"})})]})};return m.useEffect(()=>{o&&s(c?{...n,[c]:o}:{landscape:o,portrait:o,icon:o})},[o]),e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-3 h-full overflow-auto",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 justify-between",children:[e.jsxs("div",{className:"w-full flex flex-col gap-4",children:[e.jsx(Ne,{htmlFor:"imageName",children:"Image Name"}),e.jsx(wn,{id:"inputImage",accept:"image/*",fileNamePlaceholder:"Enter image name",fileName:a?.name||"",onChange:j=>{const h=j.target.files?.[0];h&&g(h)},onFileNameChange:j=>{r({...a,name:j.target.value})}})]}),e.jsxs("div",{className:"w-full flex flex-col gap-4",children:[e.jsx(Ne,{htmlFor:"imageDescription",children:"Image Description"}),e.jsx(K,{id:"imageDescription",placeholder:"Enter image Description",value:a?.description||"",onChange:j=>r({...a,description:j.target.value})})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3",children:[e.jsxs("div",{className:"flex-grow flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3",children:"Original Image"}),e.jsx(Et,{ratio:4/3,className:"flex justify-center items-center bg-muted text-muted-foreground",onDrop:C,onDragOver:j=>j.preventDefault(),children:y?e.jsx(qn,{src:y,onCroppedImage:i,aspectRatio:fa[c||"icon"],rotationAngle:d,zoomLevel:p,moveDirection:N}):e.jsxs("div",{className:"text-center",children:[e.jsx(Ne,{htmlFor:"inputImage",children:"Drag and drop an image here"}),e.jsx("div",{className:"mt-3",children:e.jsx(at,{variant:"outline",onClick:()=>document.getElementById("inputImage")?.click(),children:"Browse Image"})})]})})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 justify-between",children:[e.jsx("div",{children:e.jsxs(Ee,{type:"single",variant:"outline",value:c,onValueChange:j=>u(j),children:[e.jsx($,{className:"rounded-e-none",value:"landscape",children:e.jsx(f.ImageIcon,{})}),e.jsx($,{className:"rounded-none border-x-0",value:"portrait",children:e.jsx(f.FileImage,{})}),e.jsx($,{className:"rounded-s-none",value:"icon",children:e.jsx(f.Square,{})})]})}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 justify-between",children:[e.jsxs(Ee,{type:"single",variant:"outline",value:"",onValueChange:j=>x(parseInt(j)),children:[e.jsx($,{className:"rounded-e-none",value:"90",children:e.jsx(f.RotateCw,{})}),e.jsx($,{className:"rounded-s-none border-s-0",value:"-90",children:e.jsx(f.RotateCcw,{})})]}),e.jsxs(Ee,{type:"single",variant:"outline",value:"",children:[e.jsx($,{className:"rounded-e-none",value:"up",onClick:()=>v({x:0,y:-5}),children:e.jsx(f.ArrowUp,{})}),e.jsx($,{className:"rounded-none border-x-0",value:"down",onClick:()=>v({x:0,y:5}),children:e.jsx(f.ArrowDown,{})}),e.jsx($,{className:"rounded-none border-e-0",value:"left",onClick:()=>v({x:-5,y:0}),children:e.jsx(f.ArrowLeft,{})}),e.jsx($,{className:"rounded-s-none",value:"right",onClick:()=>v({x:5,y:0}),children:e.jsx(f.ArrowRight,{})})]}),e.jsxs(Ee,{type:"single",variant:"outline",value:"",onValueChange:j=>w(h=>h+parseFloat(j)),children:[e.jsx($,{className:"rounded-e-none",value:"0.1",children:e.jsx(f.ZoomIn,{})}),e.jsx($,{className:"rounded-s-none border-s-0",value:"-0.1",children:e.jsx(f.ZoomOut,{})})]})]})]})]}),e.jsxs("div",{className:"flex flex-row lg:flex-col gap-3 w-full lg:w-48",children:[e.jsx("div",{className:"w-5/5",children:S("landscape")}),e.jsx("div",{className:"w-4/5",children:S("portrait")}),e.jsx("div",{className:"w-3/5",children:S("icon")})]})]})]})})}const Wn=m.memo(zl);function Hn({open:t,onOpenChange:a,onCropperChange:r}){const{originalImage:n,aspectRatioWiseImages:s}=ia();return e.jsx(jt,{modal:!0,open:t,onOpenChange:o=>{a(o)},children:e.jsxs(wt,{className:"max-w-full lg:max-w-5xl max-h-full overflow-auto",children:[e.jsx(Qt,{children:e.jsx(Nt,{children:"Image to upload"})}),e.jsx(Wn,{}),e.jsx(Ka,{children:e.jsx(at,{onClick:()=>{r(n,s),a(!1)},children:"Save Changes"})})]})})}async function dt(t,a=""){if(!t||!t.resourceId)return null;try{return`${he().IKON_BASE_API_URL}/platform/file-resource/download/${a}/${t.resourceId}`}catch(r){return console.error("Error getting resource URL:",r),null}}async function _l(t){if(!t)return null;const a=t.originalImageInfo?await dt(t.originalImageInfo):null,r=t.landscapeImageInfo?await dt(t.landscapeImageInfo):null,n=t.portraitImageInfo?await dt(t.portraitImageInfo):null,s=t.iconImageInfo?await dt(t.iconImageInfo):null;return{originalImage:{image:a,name:t.imageName,description:t.imageDescription},aspectRatioWiseImages:{landscape:r,portrait:n,icon:s}}}const Kn=m.createContext(void 0);function Fl({children:t,uploadedImages:a,onCropperChange:r,modalOpen:n,onModalOpenChange:s}){const[o,i]=m.useState({landscape:null,portrait:null,icon:null}),[c,u]=m.useState({image:null,name:"",description:""});return m.useEffect(()=>{async function d(){if(a)try{const x=await _l(a);x&&(u(p=>JSON.stringify(p)===JSON.stringify(x.originalImage)?p:x.originalImage),i(p=>JSON.stringify(p)===JSON.stringify(x.aspectRatioWiseImages)?p:x.aspectRatioWiseImages))}catch(x){console.error("Error processing uploaded images:",x)}}d()},[a]),e.jsxs(Kn.Provider,{value:{originalImage:c,setOriginalImage:u,aspectRatioWiseImages:o,setAspectRatioWiseImages:i},children:[t,n&&s&&e.jsx(Hn,{open:n,onOpenChange:s,onCropperChange:r})]})}const ia=()=>{const t=m.useContext(Kn);if(!t)throw new Error("useImageCropper must be used within a ImageCropperProvider");return t},Yn=({imageSrc:t,onCroppedImage:a,aspectRatio:r,rotationAngle:n,zoomLevel:s,moveDirection:o,currentState:i})=>{const c=m.useRef(null),u=()=>{const d=c.current?.cropper;if(d){d.setDragMode("move");const p=d.getCroppedCanvas().toDataURL();a(p)}else console.log("Cropper instance is not available.")};return m.useEffect(()=>{const d=c.current?.cropper;d&&d.rotate(n)},[n]),m.useEffect(()=>{const d=c.current?.cropper;d&&d.getCropBoxData().width&&(console.log("Inside cropper scale"),d.scale(s))},[s]),m.useEffect(()=>{const d=c.current?.cropper;if(d&&d.getCropBoxData().width){const{x:p,y:w}=o;typeof p=="number"&&typeof w=="number"&&d.move(p,w)}},[o]),m.useEffect(()=>{const d=c.current?.cropper;if(d&&(d.setAspectRatio(r),r===1)){const x=d.getCanvasData(),p=x.width,w=x.height,N=x.left,v=x.top,y=200,b=100,C=N+(p-y)/2,g=v+(w-b)/2;d.setCropBoxData({left:C,top:g,width:y,height:b})}},[r]),e.jsx(wa,{src:t,style:{height:"100%",width:"100%",objectFit:"contain"},guides:!0,crop:u,ref:c,dragMode:"move",movable:!0,zoomable:!0,scalable:!0,cropBoxMovable:!0,cropBoxResizable:!1})},Ml=({open:t,setOpen:a,onImageSubmit:r})=>{const[n,s]=m.useState(null),[o,i]=m.useState(null),[c,u]=m.useState({first:null,second:null,third:null}),[d,x]=m.useState(4/3),[p,w]=m.useState("first"),[N,v]=m.useState(0),[y,b]=m.useState(1),[C,g]=m.useState({x:0,y:0}),[S,j]=m.useState(""),h=()=>{console.log("Image Submit Button is pressed"),console.log(c),r(c.third),a(!1)},I=_=>{v(U=>U+_)},T=()=>{g({x:0,y:-5})},A=()=>{g({x:0,y:5})},O=()=>{g({x:-5,y:0})},V=()=>{g({x:5,y:0})},ce=()=>{b(_=>{const U=_+.2;return U<=2?U:_})},ke=()=>{b(_=>{const U=_-.2;return U>=.2?U:_})},we=(_,U)=>{x(_),w(U)},D=_=>{if(_.type.startsWith("image/")){const U=new FileReader;U.onloadend=()=>{s(U.result),j(F=>F||_.name)},U.readAsDataURL(_)}else alert("Please drop a valid image file.")},P=_=>{_.preventDefault(),D(_.dataTransfer.files[0])},E=_=>{const U=o&&p===_?o:c[_];return U?e.jsx("div",{className:`
|
|
4
|
+
${_==="first"?"relative w-3/5 h-[200px] bg-slate-400":_==="second"?"relative w-1/2 h-[220px] bg-slate-400":"relative w-1/3 h-[120px] bg-slate-400"}`,children:e.jsx("img",{src:U,alt:`Preview ${_}`,className:"absolute inset-0 w-full h-full object-contain"})}):e.jsx("div",{className:`
|
|
5
|
+
${_==="first"?"relative w-3/5 h-[200px] bg-slate-400":_==="second"?"relative w-1/2 h-[220px] bg-slate-400":"relative w-1/3 h-[120px] bg-slate-400"}`})};return m.useEffect(()=>{o&&(c.first===null||c.second===null||c.third===null?u({first:o,second:o,third:o}):u(_=>({..._,[p]:o})))},[o]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(Ne,{htmlFor:"imageName",children:"Image Name"}),e.jsx(K,{id:"imageName",placeholder:"Enter image name",value:S,onChange:_=>j(_.target.value)})]}),e.jsxs("div",{className:"self-end",children:[e.jsx(R,{variant:"outline",onClick:()=>document.getElementById("inputImage1")?.click(),children:e.jsx(f.Upload,{})}),e.jsx(K,{id:"inputImage1",type:"file",accept:"image/png, image/jpeg",className:"hidden",onChange:_=>{const U=_.target.files?.[0];if(U&&U.type.startsWith("image/")){const F=new FileReader;F.onloadend=()=>{s(F.result),j(M=>M||U.name)},F.readAsDataURL(U),u({first:null,second:null,third:null})}}})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(Ne,{htmlFor:"imageDesc",children:"Image Description"}),e.jsx(K,{id:"imageDesc",placeholder:"Describe your image"})]})]}),e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsx("div",{className:"w-3/5 flex justify-center items-center border-2 border-dashed border-gray-400 bg-gray-100",style:{height:"70vh"},onDrop:P,onDragOver:_=>_.preventDefault(),children:n?e.jsx(Yn,{imageSrc:n,onCroppedImage:i,aspectRatio:d,rotationAngle:N,zoomLevel:y,moveDirection:C,currentState:p}):e.jsxs("div",{className:"text-center",children:[e.jsx(Ne,{htmlFor:"inputImage",children:"Drag and drop an image here"}),e.jsxs("div",{className:"mt-4",children:[e.jsx(R,{variant:"outline",onClick:()=>document.getElementById("inputImage")?.click(),children:"Upload Image"}),e.jsx(K,{id:"inputImage",type:"file",accept:"image/png, image/jpeg",className:"hidden",onChange:_=>{const U=_.target.files?.[0];U&&D(U)}})]})]})}),e.jsxs("div",{className:"w-2/5 flex flex-col gap-2",children:[e.jsx("h3",{children:"Landscape"}),E("first"),e.jsx("h3",{children:"Potrait"}),E("second"),e.jsx("h3",{children:"Icon"}),E("third")]})]}),e.jsxs("div",{className:"flex flex-row gap-1",children:[e.jsxs("div",{className:"w-3/5 flex flex-row justify-between",children:[e.jsxs("div",{children:[e.jsx(R,{variant:"outline",onClick:()=>we(4/3,"first"),children:e.jsx(f.ImageIcon,{})}),e.jsx(R,{variant:"outline",onClick:()=>we(3/4,"second"),children:e.jsx(f.FileImage,{})}),e.jsx(R,{variant:"outline",onClick:()=>we(1/1,"third"),children:e.jsx(f.Square,{})})]}),e.jsxs("div",{children:[e.jsx(R,{onClick:()=>I(90),variant:"outline",children:e.jsx(f.RotateCw,{})}),e.jsx(R,{onClick:()=>I(-90),variant:"outline",children:e.jsx(f.RotateCcw,{})})]}),e.jsxs("div",{children:[e.jsx(R,{onClick:()=>ce(),variant:"outline",children:e.jsx(f.ZoomIn,{})}),e.jsx(R,{onClick:()=>ke(),variant:"outline",children:e.jsx(f.ZoomOut,{})})]}),e.jsxs("div",{children:[e.jsx(R,{onClick:T,variant:"outline",children:e.jsx(f.ArrowUp,{})}),e.jsx(R,{onClick:A,variant:"outline",children:e.jsx(f.ArrowDown,{})}),e.jsx(R,{onClick:O,variant:"outline",children:e.jsx(f.ArrowLeft,{})}),e.jsx(R,{onClick:V,variant:"outline",children:e.jsx(f.ArrowRight,{})})]})]}),e.jsx("div",{className:"w-2/5 flex flex-row-reverse",children:e.jsx(R,{onClick:h,children:"Save"})})]})]})},El=m.memo(Ml);function Ll(){return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"bg-background text-forefround rounded-xl p-6 text-center max-w-md",children:[e.jsx("div",{className:"text-3xl font-bold mb-2 animate-pulse",children:"🚧 Work in Progress"}),e.jsx("p",{className:"text-muted-foreground",children:"We’re currently working on this section. Check back soon!"})]})})}function Ol({formControl:t,name:a,label:r,options:n,placeholder:s="Select an option",emptyMessage:o="No options found.",onValueChange:i,className:c,addNewPlaceholder:u="Add custom value...",formDescription:d,disabled:x}){const[p,w]=k.useState(!1),[N,v]=k.useState(""),[y,b]=k.useState(n),[C,g]=k.useState(!1),[S,j]=k.useState("");return k.useEffect(()=>{b(n)},[n]),e.jsx(xe,{control:t,name:a,render:({field:h})=>{const I=y.find(A=>A.value===h.value),T=()=>{const A=S.trim();if(!A)return;if(y.some(V=>V.value===A)){const V=y.find(ce=>ce.value===A);V&&(h.onChange(V.value),i?.(V.value),j(""),g(!1),w(!1),v(""));return}const O={value:A,label:A,disabled:!0};b(V=>[...V,O]),h.onChange(A),i?.(A),j(""),g(!1),w(!1),v("")};return e.jsxs(fe,{className:l(c),children:[r&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{children:r}),e.jsx("br",{})]}),e.jsxs(J,{open:p,onOpenChange:A=>{w(A),A||(v(""),g(!1),j(""))},children:[e.jsx(Z,{asChild:!0,children:e.jsx(ge,{children:e.jsxs(R,{variant:"outline",role:"combobox","aria-expanded":p,className:l("w-full justify-between",!h.value&&"text-foreground/50",c),disabled:x||h.disabled,children:[e.jsx("span",{className:"line-clamp-1 text-left",children:h.value?I?I.label:h.value:s}),e.jsx(f.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),e.jsx(ee,{className:"p-0 w-[--radix-popover-trigger-width]",align:"start",children:e.jsxs(Q,{shouldFilter:!0,children:[e.jsx(ie,{placeholder:"Search...",value:N,onValueChange:v}),e.jsxs(le,{children:[e.jsx(de,{children:N&&y.length>0?"No results found.":o}),e.jsx(re,{children:y.filter(A=>A.label.toLowerCase().includes(N.toLowerCase())||A.value.toLowerCase().includes(N.toLowerCase())).map(A=>e.jsxs(X,{value:A.value,onSelect:O=>{h.onChange(O),i?.(O),w(!1),v("")},className:"cursor-pointer",disabled:A?.disabled,children:[e.jsx(f.Check,{className:l("mr-2 h-4 w-4",h.value===A.value?"opacity-100":"opacity-0")}),A.label]},A.value))})]}),e.jsx("div",{className:"border-t p-2",children:C?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{placeholder:u,value:S,onChange:A=>j(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),T()),A.key==="Escape"&&(g(!1),j(""))},autoFocus:!0,className:"h-8"}),e.jsx(R,{size:"sm",variant:"ghost",onClick:()=>{g(!1),j("")},className:"h-8",children:"Cancel"}),e.jsx(R,{size:"sm",variant:"default",onClick:T,className:"h-8",disabled:!S.trim()||y.some(A=>A.value===S.trim()),children:"Add"})]}):e.jsxs(R,{variant:"outline",className:"w-full justify-start",onClick:()=>g(!0),children:[e.jsx(f.Plus,{className:"mr-2 h-4 w-4"}),"Add new option"]})})]})})]}),d&&e.jsx(je,{children:d}),e.jsx(pe,{})]})}})}const me=m.forwardRef(({children:t,tooltip:a,side:r="bottom",className:n,...s},o)=>e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:e.jsxs(R,{variant:"ghost",size:"icon",...s,className:l("aui-button-icon size-6 p-1",n),ref:o,children:[e.jsx($t.Slottable,{children:t}),e.jsx("span",{className:"aui-sr-only sr-only",children:a})]})}),e.jsx(oe,{side:r,children:a})]}));me.displayName="TooltipIconButton";const Bl=()=>e.jsx(Dt.MarkdownTextPrimitive,{remarkPlugins:[Ps],className:"aui-md",components:$l}),Ul=m.memo(Bl),Vl=({language:t,code:a})=>{const{isCopied:r,copyToClipboard:n}=Gl(),s=()=>{!a||r||n(a)};return e.jsxs("div",{className:"aui-code-header-root mt-4 flex items-center justify-between gap-4 rounded-t-lg bg-muted-foreground/15 px-4 py-2 font-semibold text-foreground text-sm dark:bg-muted-foreground/20",children:[e.jsx("span",{className:"aui-code-header-language lowercase [&>span]:text-xs",children:t}),e.jsxs(me,{tooltip:"Copy",onClick:s,children:[!r&&e.jsx(f.CopyIcon,{}),r&&e.jsx(f.CheckIcon,{})]})]})},Gl=({copiedDuration:t=3e3}={})=>{const[a,r]=m.useState(!1);return{isCopied:a,copyToClipboard:s=>{s&&navigator.clipboard.writeText(s).then(()=>{r(!0),setTimeout(()=>r(!1),t)})}}},$l=Dt.unstable_memoizeMarkdownComponents({h1:({className:t,...a})=>e.jsx("h1",{className:l("aui-md-h1 mb-8 scroll-m-20 font-extrabold text-4xl tracking-tight last:mb-0",t),...a}),h2:({className:t,...a})=>e.jsx("h2",{className:l("aui-md-h2 mt-8 mb-4 scroll-m-20 font-semibold text-3xl tracking-tight first:mt-0 last:mb-0",t),...a}),h3:({className:t,...a})=>e.jsx("h3",{className:l("aui-md-h3 mt-6 mb-4 scroll-m-20 font-semibold text-2xl tracking-tight first:mt-0 last:mb-0",t),...a}),h4:({className:t,...a})=>e.jsx("h4",{className:l("aui-md-h4 mt-6 mb-4 scroll-m-20 font-semibold text-xl tracking-tight first:mt-0 last:mb-0",t),...a}),h5:({className:t,...a})=>e.jsx("h5",{className:l("aui-md-h5 my-4 font-semibold text-lg first:mt-0 last:mb-0",t),...a}),h6:({className:t,...a})=>e.jsx("h6",{className:l("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",t),...a}),p:({className:t,...a})=>e.jsx("p",{className:l("aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",t),...a}),a:({className:t,...a})=>e.jsx("a",{className:l("aui-md-a font-medium text-primary underline underline-offset-4",t),...a}),blockquote:({className:t,...a})=>e.jsx("blockquote",{className:l("aui-md-blockquote border-l-2 pl-6 italic",t),...a}),ul:({className:t,...a})=>e.jsx("ul",{className:l("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2",t),...a}),ol:({className:t,...a})=>e.jsx("ol",{className:l("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2",t),...a}),hr:({className:t,...a})=>e.jsx("hr",{className:l("aui-md-hr my-5 border-b",t),...a}),table:({className:t,...a})=>e.jsx("table",{className:l("aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",t),...a}),th:({className:t,...a})=>e.jsx("th",{className:l("aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [[align=center]]:text-center [[align=right]]:text-right",t),...a}),td:({className:t,...a})=>e.jsx("td",{className:l("aui-md-td border-b border-l px-4 py-2 text-left last:border-r [[align=center]]:text-center [[align=right]]:text-right",t),...a}),tr:({className:t,...a})=>e.jsx("tr",{className:l("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",t),...a}),sup:({className:t,...a})=>e.jsx("sup",{className:l("aui-md-sup [&>a]:text-xs [&>a]:no-underline",t),...a}),pre:({className:t,...a})=>e.jsx("pre",{className:l("aui-md-pre overflow-x-auto rounded-t-none!rounded-b-lg bg-black p-4 text-white",t),...a}),code:function({className:a,...r}){const n=Dt.useIsMarkdownCodeBlock();return e.jsx("code",{className:l(!n&&"aui-md-inline-code rounded border bg-muted font-semibold",a),...r})},CodeHeader:Vl}),ql=({toolName:t,argsText:a,result:r,status:n})=>{const[s,o]=m.useState(!0),i=n?.type==="incomplete"&&n.reason==="cancelled",c=i&&n.error?typeof n.error=="string"?n.error:JSON.stringify(n.error):null;return e.jsxs("div",{className:l("aui-tool-fallback-root mb-4 flex w-full flex-col gap-3 rounded-lg border py-3",i&&"border-muted-foreground/30 bg-muted/30"),children:[e.jsxs("div",{className:"aui-tool-fallback-header flex items-center gap-2 px-4",children:[i?e.jsx(f.XCircleIcon,{className:"aui-tool-fallback-icon size-4 text-muted-foreground"}):e.jsx(f.CheckIcon,{className:"aui-tool-fallback-icon size-4"}),e.jsxs("p",{className:l("aui-tool-fallback-title grow",i&&"text-muted-foreground line-through"),children:[i?"Cancelled tool: ":"Used tool: ",e.jsx("b",{children:t})]}),e.jsx(R,{onClick:()=>o(!s),children:s?e.jsx(f.ChevronUpIcon,{}):e.jsx(f.ChevronDownIcon,{})})]}),!s&&e.jsxs("div",{className:"aui-tool-fallback-content flex flex-col gap-2 border-t pt-2",children:[c&&e.jsxs("div",{className:"aui-tool-fallback-cancelled-root px-4",children:[e.jsx("p",{className:"aui-tool-fallback-cancelled-header font-semibold text-muted-foreground",children:"Cancelled reason:"}),e.jsx("p",{className:"aui-tool-fallback-cancelled-reason text-muted-foreground",children:c})]}),e.jsx("div",{className:l("aui-tool-fallback-args-root px-4",i&&"opacity-60"),children:e.jsx("pre",{className:"aui-tool-fallback-args-value whitespace-pre-wrap",children:a})}),!i&&r!==void 0&&e.jsxs("div",{className:"aui-tool-fallback-result-root border-t border-dashed px-4 pt-2",children:[e.jsx("p",{className:"aui-tool-fallback-result-header font-semibold",children:"Result:"}),e.jsx("pre",{className:"aui-tool-fallback-result-content whitespace-pre-wrap",children:typeof r=="string"?r:JSON.stringify(r,null,2)})]})]})]})},ga=t=>Symbol.iterator in t,pa=t=>"entries"in t,ha=(t,a)=>{const r=t instanceof Map?t:new Map(t.entries()),n=a instanceof Map?a:new Map(a.entries());if(r.size!==n.size)return!1;for(const[s,o]of r)if(!n.has(s)||!Object.is(o,n.get(s)))return!1;return!0},Wl=(t,a)=>{const r=t[Symbol.iterator](),n=a[Symbol.iterator]();let s=r.next(),o=n.next();for(;!s.done&&!o.done;){if(!Object.is(s.value,o.value))return!1;s=r.next(),o=n.next()}return!!s.done&&!!o.done};function Hl(t,a){return Object.is(t,a)?!0:typeof t!="object"||t===null||typeof a!="object"||a===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(a)?!1:ga(t)&&ga(a)?pa(t)&&pa(a)?ha(t,a):Wl(t,a):ha({entries:()=>Object.entries(t)},{entries:()=>Object.entries(a)})}function Kl(t){const a=m.useRef(void 0);return r=>{const n=t(r);return Hl(a.current,n)?a.current:a.current=n}}const Yl=t=>{const[a,r]=m.useState(void 0);return m.useEffect(()=>{if(!t){r(void 0);return}const n=URL.createObjectURL(t);return r(n),()=>{URL.revokeObjectURL(n)}},[t]),a},Xn=()=>{const{file:t,src:a}=z.useAssistantState(Kl(({attachment:r})=>{if(r.type!=="image")return{};if(r.file)return{file:r.file};const n=r.content?.filter(s=>s.type==="image")[0]?.image;return n?{src:n}:{}}));return Yl(t)??a},Xl=({src:t})=>{const[a,r]=m.useState(!1);return e.jsx("img",{src:t,alt:"Image Preview",width:1,height:1,className:a?"aui-attachment-preview-image-loaded block h-auto max-h-[80vh] w-auto max-w-full object-contain":"aui-attachment-preview-image-loading hidden",onLoad:()=>r(!0),loading:"lazy"})},Ql=({children:t})=>{const a=Xn();return a?e.jsxs(jt,{children:[e.jsx(qa,{className:"aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50",asChild:!0,children:t}),e.jsxs(wt,{className:"aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0! [&_svg]:text-background [&>button]:hover:[&_svg]:text-destructive",children:[e.jsx(Nt,{className:"aui-sr-only sr-only",children:"Image Attachment Preview"}),e.jsx("div",{className:"aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background",children:e.jsx(Xl,{src:a})})]})]}):t},Jl=()=>{const t=z.useAssistantState(({attachment:r})=>r.type==="image"),a=Xn();return e.jsxs(La,{className:"aui-attachment-tile-avatar h-full w-full rounded-none",children:[e.jsx(Oa,{src:a,alt:"Attachment preview",className:"aui-attachment-tile-image object-cover"}),e.jsx(Ba,{delayMs:t?200:0,children:e.jsx(f.FileText,{className:"aui-attachment-tile-fallback-icon size-8 text-muted-foreground"})})]})},Qn=()=>{const a=z.useAssistantApi().attachment.source==="composer",r=z.useAssistantState(({attachment:s})=>s.type==="image"),n=z.useAssistantState(({attachment:s})=>{const o=s.type;switch(o){case"image":return"Image";case"document":return"Document";case"file":return"File";default:{const i=o;throw new Error(`Unknown attachment type: ${i}`)}}});return e.jsxs(ne,{children:[e.jsxs(z.AttachmentPrimitive.Root,{className:l("aui-attachment-root relative",r&&"aui-attachment-root-composer only:[&>#attachment-tile]:size-24"),children:[e.jsx(Ql,{children:e.jsx(se,{asChild:!0,children:e.jsx("div",{className:l("aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[14px] border bg-muted transition-opacity hover:opacity-75",a&&"aui-attachment-tile-composer border-foreground/20"),role:"button",id:"attachment-tile","aria-label":`${n} attachment`,children:e.jsx(Jl,{})})})}),a&&e.jsx(Zl,{})]}),e.jsx(oe,{side:"top",children:e.jsx(z.AttachmentPrimitive.Name,{})})]})},Zl=()=>e.jsx(z.AttachmentPrimitive.Remove,{asChild:!0,children:e.jsx(me,{tooltip:"Remove file",className:"aui-attachment-tile-remove absolute top-1.5 right-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:bg-white! [&_svg]:text-black hover:[&_svg]:text-destructive",side:"top",children:e.jsx(f.XIcon,{className:"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]"})})}),ed=()=>e.jsx("div",{className:"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2",children:e.jsx(z.MessagePrimitive.Attachments,{components:{Attachment:Qn}})}),td=()=>e.jsx("div",{className:"aui-composer-attachments mb-2 flex w-full flex-row items-center gap-2 overflow-x-auto px-1.5 pt-0.5 pb-1 empty:hidden",children:e.jsx(z.ComposerPrimitive.Attachments,{components:{Attachment:Qn}})}),ad=()=>e.jsx(z.ComposerPrimitive.AddAttachment,{asChild:!0,children:e.jsx(me,{tooltip:"Add Attachment",side:"bottom",variant:"ghost",size:"icon",className:"aui-composer-add-attachment size-8.5 rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30","aria-label":"Add Attachment",children:e.jsx(f.PlusIcon,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})}),rd=({agents:t,selectedAgent:a,onSelectAgent:r,className:n,triggerClassName:s})=>{const[o,i]=m.useState(!1),c=a||null;return e.jsxs(ze,{open:o,onOpenChange:i,children:[e.jsx(_e,{asChild:!0,children:e.jsxs(R,{variant:"outline",className:l("gap-2 px-3 py-2 text-sm font-medium rounded-2xl",s),children:[e.jsx("span",{className:"truncate",children:c?.agentName||"Select Agent"}),e.jsx(f.ChevronDownIcon,{className:"size-4 shrink-0 opacity-50"})]})}),e.jsx(Fe,{align:"end",className:l("min-w-[200px]",n),children:t.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Zt,{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground",children:"Agents"}),e.jsx(yt,{}),e.jsx(Jt,{children:t.map(u=>e.jsxs(ue,{onClick:()=>{r(u),i(!1)},className:l("cursor-pointer flex flex-col gap-1",c?.agentID===u.agentID&&"bg-accent"),children:[e.jsx("div",{className:"font-medium text-sm",children:u.agentName}),u.agentDescription&&e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:u.agentDescription})]},u.agentID))})]}):e.jsx("div",{className:"px-2 py-1.5 text-sm text-muted-foreground text-center",children:"No agents available"})})]})},nd=({currentUserDetails:t,agents:a=[],initialAgentId:r="default-agent",initialAgentName:n="Default Agent",onAgentChange:s})=>{const[o,i]=m.useState(a.find(c=>c.agentID===r));return e.jsx(ct.LazyMotion,{features:ct.domAnimation,children:e.jsx(ct.MotionConfig,{reducedMotion:"user",children:e.jsx(z.ThreadPrimitive.Root,{className:"aui-root aui-thread-root @container flex h-full flex-col bg-background",style:{"--thread-max-width":"44rem"},children:e.jsxs(z.ThreadPrimitive.Viewport,{turnAnchor:"top",className:"aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",children:[e.jsx(z.ThreadPrimitive.If,{empty:!0,children:e.jsx(od,{currentUserDetails:t})}),e.jsx(z.ThreadPrimitive.Messages,{components:{UserMessage:xd,EditComposer:gd,AssistantMessage:ud}}),e.jsxs(z.ThreadPrimitive.ViewportFooter,{className:"aui-thread-viewport-footer sticky bottom-0 mx-auto mt-4 flex w-full max-w-[var(--thread-max-width)] flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6",children:[e.jsx(sd,{}),e.jsx(ld,{agents:a,selectedAgent:o,onSelectAgent:c=>{i(c),s?.(c)}})]})]})})})})},sd=()=>e.jsx(z.ThreadPrimitive.ScrollToBottom,{asChild:!0,children:e.jsx(me,{tooltip:"Scroll to bottom",variant:"outline",className:"aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:bg-background dark:hover:bg-accent",children:e.jsx(f.ArrowDownIcon,{})})}),od=({currentUserDetails:t})=>{const r=new Date().getHours();let n="";return r>=5&&r<12?n="Good Morning":r>=12&&r<17?n="Good Afternoon":r>=17&&r<21?n="Good Evening":n="Good Night",console.log(n),e.jsxs("div",{className:"aui-thread-welcome-root mx-auto my-auto flex w-full max-w-[var(--thread-max-width)] flex-grow flex-col",children:[e.jsx("div",{className:"aui-thread-welcome-center flex w-full flex-grow flex-col items-center justify-center",children:e.jsxs("div",{className:"aui-thread-welcome-message flex size-full flex-col justify-center px-8",children:[e.jsx(At.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:"aui-thread-welcome-message-motion-1 text-2xl font-semibold",children:`${n} ${t.userName.split(" ")[0]}`}),e.jsx(At.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{delay:.1},className:"aui-thread-welcome-message-motion-2 text-2xl text-muted-foreground/65",children:"How can I help you today?"})]})}),e.jsx(id,{})]})},id=()=>e.jsx("div",{className:"aui-thread-welcome-suggestions grid w-full gap-2 pb-4 @md:grid-cols-2",children:[{title:"What's the weather",label:"in San Francisco?",action:"What's the weather in San Francisco?"},{title:"Explain React hooks",label:"like useState and useEffect",action:"Explain React hooks like useState and useEffect"},{title:"Write a SQL query",label:"to find top customers",action:"Write a SQL query to find top customers"},{title:"Create a meal plan",label:"for healthy weight loss",action:"Create a meal plan for healthy weight loss"}].map((t,a)=>e.jsx(At.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{delay:.05*a},className:"aui-thread-welcome-suggestion-display [&:nth-child(n+3)]:hidden @md:[&:nth-child(n+3)]:block",children:e.jsx(z.ThreadPrimitive.Suggestion,{prompt:t.action,send:!0,asChild:!0,children:e.jsxs(R,{variant:"ghost",className:"aui-thread-welcome-suggestion h-auto w-full flex-1 flex-wrap items-start justify-start gap-1 rounded-3xl border px-5 py-4 text-left text-sm @md:flex-col dark:hover:bg-accent/60","aria-label":t.action,children:[e.jsx("span",{className:"aui-thread-welcome-suggestion-text-1 font-medium",children:t.title}),e.jsx("span",{className:"aui-thread-welcome-suggestion-text-2 text-muted-foreground",children:t.label})]})})},`suggested-action-${t.title}-${a}`))}),ld=({agents:t=[],selectedAgent:a,onSelectAgent:r})=>e.jsx(z.ComposerPrimitive.Root,{className:"aui-composer-root relative flex w-full flex-col",children:e.jsxs(z.ComposerPrimitive.AttachmentDropzone,{className:"aui-composer-attachment-dropzone group/input-group flex w-full flex-col rounded-3xl border border-input bg-background px-1 pt-2 shadow-xs transition-[color,box-shadow] outline-none has-[textarea:focus-visible]:border-ring has-[textarea:focus-visible]:ring-[3px] has-[textarea:focus-visible]:ring-ring/50 data-[dragging=true]:border-dashed data-[dragging=true]:border-ring data-[dragging=true]:bg-accent/50 dark:bg-background",children:[e.jsx(td,{}),e.jsx(z.ComposerPrimitive.Input,{placeholder:"Send a message...",className:"aui-composer-input mb-1 max-h-32 min-h-16 w-full resize-none bg-transparent px-3.5 pt-1.5 pb-3 text-base outline-none placeholder:text-muted-foreground focus-visible:ring-0",rows:1,autoFocus:!0,"aria-label":"Message input"}),e.jsx(dd,{agents:t,selectedAgent:a,onSelectAgent:r})]})}),dd=({agents:t=[],selectedAgent:a,onSelectAgent:r})=>e.jsxs("div",{className:"aui-composer-action-wrapper relative mx-1 mt-2 mb-2 flex items-center justify-between",children:[e.jsx(ad,{}),e.jsxs("div",{className:"flex gap-3",children:[t.length>0&&e.jsx(rd,{agents:t,selectedAgent:a,onSelectAgent:r??(()=>{}),triggerClassName:"h-9 text-xs"}),e.jsx(z.ThreadPrimitive.If,{running:!1,children:e.jsx(z.ComposerPrimitive.Send,{asChild:!0,children:e.jsx(me,{tooltip:"Send message",side:"bottom",type:"submit",variant:"default",size:"icon",className:"aui-composer-send size-[34px] rounded-full p-1","aria-label":"Send message",children:e.jsx(f.ArrowUpIcon,{className:"aui-composer-send-icon size-5"})})})}),e.jsx(z.ThreadPrimitive.If,{running:!0,children:e.jsx(z.ComposerPrimitive.Cancel,{asChild:!0,children:e.jsx(R,{type:"button",variant:"default",size:"icon",className:"aui-composer-cancel size-[34px] rounded-full border border-muted-foreground/60 hover:bg-primary/75 dark:border-muted-foreground/90","aria-label":"Stop generating",children:e.jsx(f.Square,{className:"aui-composer-cancel-icon size-3.5 fill-white dark:fill-black"})})})})]})]}),cd=()=>e.jsx(z.MessagePrimitive.Error,{children:e.jsx(z.ErrorPrimitive.Root,{className:"aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm text-destructive dark:bg-destructive/5 dark:text-red-200",children:e.jsx(z.ErrorPrimitive.Message,{className:"aui-message-error-message line-clamp-2"})})}),ud=()=>e.jsxs(z.MessagePrimitive.Root,{className:"aui-assistant-message-root relative mx-auto w-full max-w-[var(--thread-max-width)] animate-in py-4 duration-150 ease-out fade-in slide-in-from-bottom-1","data-role":"assistant",children:[e.jsxs("div",{className:"aui-assistant-message-content mx-2 leading-7 break-words text-foreground",children:[e.jsx(z.MessagePrimitive.Parts,{components:{Text:Ul,tools:{Fallback:ql}}}),e.jsx(cd,{})]}),e.jsxs("div",{className:"aui-assistant-message-footer mt-2 ml-2 flex",children:[e.jsx(Jn,{}),e.jsx(md,{})]})]}),md=()=>e.jsxs(z.ActionBarPrimitive.Root,{hideWhenRunning:!0,autohide:"not-last",autohideFloat:"single-branch",className:"aui-assistant-action-bar-root col-start-3 row-start-2 -ml-1 flex gap-1 text-muted-foreground data-floating:absolute data-floating:rounded-md data-floating:border data-floating:bg-background data-floating:p-1 data-floating:shadow-sm",children:[e.jsx(z.ActionBarPrimitive.Copy,{asChild:!0,children:e.jsxs(me,{tooltip:"Copy",children:[e.jsx(z.MessagePrimitive.If,{copied:!0,children:e.jsx(f.CheckIcon,{})}),e.jsx(z.MessagePrimitive.If,{copied:!1,children:e.jsx(f.CopyIcon,{})})]})}),e.jsx(z.ActionBarPrimitive.Reload,{asChild:!0,children:e.jsx(me,{tooltip:"Refresh",children:e.jsx(f.RefreshCwIcon,{})})})]}),xd=()=>e.jsxs(z.MessagePrimitive.Root,{className:"aui-user-message-root mx-auto grid w-full max-w-[var(--thread-max-width)] animate-in auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 py-4 duration-150 ease-out fade-in slide-in-from-bottom-1 [&:where(>*)]:col-start-2","data-role":"user",children:[e.jsx(ed,{}),e.jsxs("div",{className:"aui-user-message-content-wrapper relative col-start-2 min-w-0",children:[e.jsx("div",{className:"aui-user-message-content rounded-3xl bg-muted px-5 py-2.5 break-words text-foreground",children:e.jsx(z.MessagePrimitive.Parts,{})}),e.jsx("div",{className:"aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2",children:e.jsx(fd,{})})]}),e.jsx(Jn,{className:"aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end"})]}),fd=()=>e.jsx(z.ActionBarPrimitive.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-user-action-bar-root flex flex-col items-end",children:e.jsx(z.ActionBarPrimitive.Edit,{asChild:!0,children:e.jsx(me,{tooltip:"Edit",className:"aui-user-action-edit p-4",children:e.jsx(f.PencilIcon,{})})})}),gd=()=>e.jsx(z.MessagePrimitive.Root,{className:"aui-edit-composer-wrapper mx-auto flex w-full max-w-[var(--thread-max-width)] flex-col gap-4 px-2",children:e.jsxs(z.ComposerPrimitive.Root,{className:"aui-edit-composer-root ml-auto flex w-full max-w-7/8 flex-col rounded-xl bg-muted",children:[e.jsx(z.ComposerPrimitive.Input,{className:"aui-edit-composer-input flex min-h-[60px] w-full resize-none bg-transparent p-4 text-foreground outline-none",autoFocus:!0}),e.jsxs("div",{className:"aui-edit-composer-footer mx-3 mb-3 flex items-center justify-center gap-2 self-end",children:[e.jsx(z.ComposerPrimitive.Cancel,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"sm","aria-label":"Cancel edit",children:"Cancel"})}),e.jsx(z.ComposerPrimitive.Send,{asChild:!0,children:e.jsx(R,{size:"sm","aria-label":"Update message",children:"Update"})})]})]})}),Jn=({className:t,...a})=>e.jsxs(z.BranchPickerPrimitive.Root,{hideWhenSingleBranch:!0,className:l("aui-branch-picker-root mr-2 -ml-2 inline-flex items-center text-xs text-muted-foreground",t),...a,children:[e.jsx(z.BranchPickerPrimitive.Previous,{asChild:!0,children:e.jsx(me,{tooltip:"Previous",children:e.jsx(f.ChevronLeftIcon,{})})}),e.jsxs("span",{className:"aui-branch-picker-state font-medium",children:[e.jsx(z.BranchPickerPrimitive.Number,{})," / ",e.jsx(z.BranchPickerPrimitive.Count,{})]}),e.jsx(z.BranchPickerPrimitive.Next,{asChild:!0,children:e.jsx(me,{tooltip:"Next",children:e.jsx(f.ChevronRightIcon,{})})})]});class pd{agentConfig;baseUrl;chatIdMap=new Map;constructor(a){this.agentConfig=a,this.baseUrl=a.baseUrl||""}updateAgentConfig(a){this.agentConfig={...this.agentConfig,...a}}getChatId(a){return this.chatIdMap.has(a)?this.chatIdMap.get(a):la.v4()}async sendMessages(a){const{messages:r,chatId:n,abortSignal:s,headers:o,body:i}=a;console.log("sendMessages called with chatId:",n,"trigger:",a.trigger);const c=this.getChatId(n);console.log("Using server chatId:",c);const d={messages:r.map(w=>{const N=w.parts.filter(v=>v.type==="text").map(v=>v.text).join("");return{role:w.role,content:w.role==="user"&&this.agentConfig.additionalReferenceInfo&&Object.keys(this.agentConfig.additionalReferenceInfo).length>0?N+JSON.stringify(this.agentConfig.additionalReferenceInfo):N}}),provider:this.agentConfig.provider,model:this.agentConfig.model,agentId:this.agentConfig.agentId,agentName:this.agentConfig.agentName,temperature:this.agentConfig.temperature??.7,maxTokens:this.agentConfig.maxTokens??2048,stream:!0,useVoice:!1,...i},p={"Content-Type":"application/json",Authorization:`Bearer ${await st()}`,...o instanceof Headers?Object.fromEntries(o.entries()):o||{}};try{const w=await fetch(`${this.baseUrl}/api/chat/completions/${c}`,{method:"POST",headers:p,body:JSON.stringify(d),signal:s,cache:"no-store"});if(!w.ok)throw new Error(`HTTP error! status: ${w.status}`);if(!w.body)throw new Error("Response body is null");return this.processResponseStream(w.body)}catch(w){throw console.error("Error in sendMessages:",w),w}}async reconnectToStream(a){return null}processResponseStream(a){const r=new TextDecoder;let n="",s=null,o=!1,i=[],c=!1,u="",d=!1,x="";return new ReadableStream({async start(p){s=a.getReader()},async pull(p){if(!(!s||o)){if(i.length>0){p.enqueue(i.shift());return}try{const{done:w,value:N}=await s.read();if(w){if(c&&u)for(d&&x&&i.push({type:"text-end",id:x}),i.push({type:"finish",finishReason:"stop"});i.length>0;)p.enqueue(i.shift());o||(o=!0,p.close());return}n+=r.decode(N,{stream:!0});const v=n.split(`
|
|
6
|
+
`);n=v.pop()||"";for(const y of v){const b=y.trim();if(b&&b.startsWith("data:")){const C=b.slice(5).trim();if(!C)continue;try{const g=JSON.parse(C);if(o)return;g.id&&!u&&(u=g.id,c=!0,i.push({type:"start"}));let S=null;if(g.type==="ai"){const j=g.messages?.[0];j?.content&&(x||(x=la.v4()),d||(d=!0,i.push({type:"text-start",id:x})),S={type:"text-delta",delta:j.content,id:x})}else if(g.type==="tool"){const j=g.toolCall;j&&(S={type:"tool-input-available",toolCallId:j.callId,toolName:j.name,input:j.result})}S&&i.push(S)}catch{}}}i.length>0&&p.enqueue(i.shift())}catch(w){o||(o=!0,p.error(w))}}},cancel(){o=!0,i=[],s&&(s.releaseLock(),s=null)}})}}const hd=({provider:t="openai",model:a="gpt-4o-mini",agentId:r="default-agent",agentName:n="Default Agent",temperature:s=.7,maxTokens:o=2048,className:i,baseUrl:c="http://localhost:3000",additionalReferenceInfo:u={},appId:d="",currentUserDetails:x})=>{const[p,w]=m.useState([]),[N,v]=m.useState(),y=m.useMemo(()=>new pd({provider:t,model:a,agentId:N?N.agentID:r,agentName:N?N.agentName:n,temperature:s,maxTokens:o,baseUrl:c,additionalReferenceInfo:u}),[t,a,N,r,n,s,o,c,u]),b=As.useChatRuntime({transport:y}),C=async()=>{try{const S=await st(),j=await fetch(`${c}/api/agent/${d}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${S}`}});if(!j.ok)throw new Error(`HTTP error! status: ${j.status}`);const h=await j.json();console.log("Agent Data:",h),w(h)}catch(S){console.error("Error while fetching agents with the specific appId",S)}};m.useEffect(()=>{C()},[d,c]);const g=S=>{v(S),console.log("Agent changed to:",S.agentName)};return e.jsx(z.AssistantRuntimeProvider,{runtime:b,children:e.jsx("div",{className:i,children:e.jsx("div",{className:`flex flex-col h-full border rounded-lg overflow-hidden ${i}`,children:e.jsx(nd,{currentUserDetails:x,agents:p,initialAgentId:r,initialAgentName:n,onAgentChange:g})})})})};exports.Accordion=Ls;exports.AccordionContent=Us;exports.AccordionItem=Os;exports.AccordionTrigger=Bs;exports.ActionMenu=Bt;exports.ActivitySheet=Al;exports.Alert=uo;exports.AlertDescription=xo;exports.AlertDialog=Da;exports.AlertDialogAction=Rt;exports.AlertDialogCancel=Ea;exports.AlertDialogContent=Ra;exports.AlertDialogDescription=Ma;exports.AlertDialogFooter=_a;exports.AlertDialogHeader=za;exports.AlertDialogMedia=lo;exports.AlertDialogOverlay=Aa;exports.AlertDialogPortal=Pa;exports.AlertDialogTitle=Fa;exports.AlertDialogTrigger=io;exports.AlertTitle=mo;exports.AppBreadcrumb=In;exports.AppSidebar=Rn;exports.AspectRatio=Et;exports.AssistantComponent=hd;exports.Avatar=La;exports.AvatarBadge=fo;exports.AvatarFallback=Ba;exports.AvatarGroup=go;exports.AvatarGroupCount=po;exports.AvatarImage=Oa;exports.Badge=ut;exports.BigCalendar=Zi;exports.Breadcrumb=Br;exports.BreadcrumbEllipsis=Ot;exports.BreadcrumbItem=Ve;exports.BreadcrumbLink=Lt;exports.BreadcrumbList=Ur;exports.BreadcrumbPage=He;exports.BreadcrumbProvider=kn;exports.BreadcrumbSeparator=mt;exports.Button=R;exports.Calendar=Va;exports.CalendarDayButton=Ga;exports.Card=gt;exports.CardAction=jo;exports.CardContent=$a;exports.CardDescription=vo;exports.CardFooter=wo;exports.CardHeader=ho;exports.CardTitle=bo;exports.Checkbox=Ze;exports.Collapsible=Vr;exports.CollapsibleContent=$r;exports.CollapsibleTrigger=Gr;exports.ComboboxInput=Ni;exports.Command=Q;exports.CommandDialog=yo;exports.CommandEmpty=de;exports.CommandGroup=re;exports.CommandInput=ie;exports.CommandItem=X;exports.CommandList=le;exports.CommandSeparator=Xa;exports.CommandShortcut=Co;exports.CropperForm=Wn;exports.CropperFormWithModal=Hn;exports.CustomAlertDialog=cn;exports.CustomComboboxInput=Ol;exports.CustomTabs=yn;exports.DataTable=ki;exports.DataTableColumnFilter=xn;exports.DataTableFacetedFilter=fn;exports.DataTableFilterMenu=gn;exports.DataTableLayout=Fi;exports.DataTablePagination=hn;exports.DataTableToolbar=vn;exports.Dialog=jt;exports.DialogClose=No;exports.DialogContent=wt;exports.DialogDescription=Ya;exports.DialogFooter=Ka;exports.DialogHeader=Qt;exports.DialogOverlay=Ha;exports.DialogPortal=Wa;exports.DialogProvider=mn;exports.DialogTitle=Nt;exports.DialogTrigger=qa;exports.Drawer=qr;exports.DrawerClose=Kr;exports.DrawerContent=Xr;exports.DrawerDescription=en;exports.DrawerFooter=Jr;exports.DrawerHeader=Qr;exports.DrawerOverlay=Yr;exports.DrawerPortal=Hr;exports.DrawerTitle=Zr;exports.DrawerTrigger=Wr;exports.DropdownMenu=ze;exports.DropdownMenuCheckboxItem=So;exports.DropdownMenuContent=Fe;exports.DropdownMenuGroup=Jt;exports.DropdownMenuItem=ue;exports.DropdownMenuLabel=Zt;exports.DropdownMenuPortal=Qa;exports.DropdownMenuRadioGroup=ko;exports.DropdownMenuRadioItem=Io;exports.DropdownMenuSeparator=yt;exports.DropdownMenuShortcut=To;exports.DropdownMenuSub=Ja;exports.DropdownMenuSubContent=er;exports.DropdownMenuSubTrigger=Za;exports.DropdownMenuTrigger=_e;exports.EChart=Ei;exports.FileInput=wn;exports.FileUploader=Ci;exports.FontProvider=Un;exports.Footer=zn;exports.Form=tn;exports.FormComboboxInput=al;exports.FormComboboxInputWithValue=rl;exports.FormControl=ge;exports.FormDateInput=nl;exports.FormDescription=je;exports.FormField=xe;exports.FormFileInput=sl;exports.FormInput=ol;exports.FormItem=fe;exports.FormLabel=ve;exports.FormMessage=pe;exports.FormMultiComboboxInput=il;exports.FormOtpInput=ll;exports.FormPasswordInput=ul;exports.FormPhoneInput=dl;exports.FormTextarea=cl;exports.FrameworkItemDropdown=Hi;exports.GlowingEffect=Li;exports.GradeTableLoader=ml;exports.Header=_n;exports.HoverCard=Do;exports.HoverCardContent=Ao;exports.HoverCardTrigger=Po;exports.Icon=pt;exports.IconButton=dn;exports.IconButtonWithTooltip=Ie;exports.IconTextButton=rt;exports.IconTextButtonWithTooltip=ln;exports.ImageCropper=qn;exports.ImageCropperProvider=Fl;exports.Input=K;exports.InputOTP=nn;exports.InputOTPGroup=sn;exports.InputOTPSeparator=bi;exports.InputOTPSlot=Ke;exports.Label=Ne;exports.LoadingSpinner=Oi;exports.MainLayout=On;exports.MainSidebar=Ln;exports.MultiCombobox=Bi;exports.NavMain=Pn;exports.NavigationMenu=Ro;exports.NavigationMenuContent=Mo;exports.NavigationMenuIndicator=Lo;exports.NavigationMenuItem=_o;exports.NavigationMenuLink=Eo;exports.NavigationMenuList=zo;exports.NavigationMenuTrigger=Fo;exports.NavigationMenuViewport=ar;exports.NewCropperImg=Yn;exports.NewImageForm=El;exports.NoDataComponent=na;exports.PageWrapper=Ui;exports.PasswordStrengthMeter=Vi;exports.PhoneInput=Gi;exports.Popover=J;exports.PopoverAnchor=Oo;exports.PopoverContent=ee;exports.PopoverDescription=Vo;exports.PopoverHeader=Bo;exports.PopoverTitle=Uo;exports.PopoverTrigger=Z;exports.Progress=Ct;exports.ProviderWrapper=Pl;exports.RadioGroup=Go;exports.RadioGroupItem=$o;exports.RadiusProvider=Gn;exports.Reload=jn;exports.RenderAppBreadcrumb=el;exports.RenderSidebarNav=tl;exports.ScrollArea=qo;exports.ScrollBar=rr;exports.SearchInput=bn;exports.Select=nr;exports.SelectContent=ir;exports.SelectGroup=Wo;exports.SelectItem=lr;exports.SelectLabel=Ho;exports.SelectScrollDownButton=cr;exports.SelectScrollUpButton=dr;exports.SelectSeparator=Ko;exports.SelectTrigger=or;exports.SelectValue=sr;exports.Separator=St;exports.Sheet=ea;exports.SheetClose=Yo;exports.SheetComponent=Nn;exports.SheetContent=ta;exports.SheetDescription=xr;exports.SheetFooter=Jo;exports.SheetHeader=mr;exports.SheetTitle=aa;exports.SheetTrigger=ur;exports.Sidebar=pr;exports.SidebarContent=Nr;exports.SidebarFooter=wr;exports.SidebarGroup=yr;exports.SidebarGroupAction=li;exports.SidebarGroupContent=di;exports.SidebarGroupLabel=ii;exports.SidebarHeader=jr;exports.SidebarInput=si;exports.SidebarInset=vr;exports.SidebarMenu=Cr;exports.SidebarMenuAction=ui;exports.SidebarMenuBadge=mi;exports.SidebarMenuButton=_t;exports.SidebarMenuItem=zt;exports.SidebarMenuSkeleton=xi;exports.SidebarMenuSub=Sr;exports.SidebarMenuSubButton=Ir;exports.SidebarMenuSubItem=kr;exports.SidebarNavProvider=Dn;exports.SidebarProvider=gr;exports.SidebarRail=br;exports.SidebarSeparator=oi;exports.SidebarTrigger=hr;exports.SimpleWidget=qi;exports.Skeleton=Le;exports.SkeletonWidget=xl;exports.Slider=fi;exports.Switch=pi;exports.Table=Ar;exports.TableBody=zr;exports.TableCaption=hi;exports.TableCell=We;exports.TableFooter=_r;exports.TableHead=Ft;exports.TableHeader=Rr;exports.TableRow=Ue;exports.Tabs=Fr;exports.TabsContent=Mt;exports.TabsList=Er;exports.TabsTrigger=Lr;exports.TextButton=at;exports.TextButtonWithTooltip=ji;exports.Textarea=Or;exports.ThemeProvider=Dr;exports.ThemeToggleBtn=Cn;exports.TitleProgress=Wi;exports.Toaster=gi;exports.Toggle=vi;exports.ToggleGroup=Ee;exports.ToggleGroupItem=$;exports.Tooltip=ne;exports.TooltipComponent=De;exports.TooltipContent=oe;exports.TooltipProvider=Te;exports.TooltipTrigger=se;exports.UploadTab=An;exports.Widgets=Ki;exports.WorkInProgress=Ll;exports.axiosInstance=Pe;exports.badgeVariants=Ua;exports.buttonVariants=ft;exports.clearAllCookieSession=gl;exports.clearCookieSession=Vt;exports.cn=l;exports.convertFileToObject=pn;exports.getCookieSession=ht;exports.getDataTableColumnTitle=ye;exports.getImageFromObject=yi;exports.getValidAccessToken=st;exports.navigationMenuTriggerStyle=tr;exports.refreshAccessToken=Fn;exports.setCookieSession=Ut;exports.setIkonConfig=fl;exports.tabsListVariants=Mr;exports.toggleVariants=ra;exports.useBreadcrumb=sa;exports.useDialog=wi;exports.useFont=Cl;exports.useFormField=tt;exports.useImageCropper=ia;exports.useIsMobile=kt;exports.useRadius=Sl;exports.useRefresh=Il;exports.useSidebar=et;exports.useSidebarNav=nt;
|