Files
edr-platform/apps/edr-freight-web/backoffice/public/_um/assets/UserManagementPage-DR2Y3pv2.js
2026-06-13 14:32:26 +03:00

373 lines
525 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Wd=Object.defineProperty;var Kd=(e,n,t)=>n in e?Wd(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var mi=(e,n,t)=>Kd(e,typeof n!="symbol"?n+"":n,t);import{y as ns,C as Js,r as y,D as Yd,E as Ga,G as Qd,R as In,J as ul,K as ye,N as ge,O as An,P as Xd,j as s,Q as G,T as Zd,V as Be,W as Ye,X as At,Y as Vt,Z as kt,_ as Qe,$ as zn,a0 as Et,a1 as ss,a2 as Rs,a3 as xt,a4 as gl,a5 as Jd,a6 as qa,a7 as Wa,a8 as Ns,a9 as Ka,aa as Yt,ab as eu,ac as tu,ad as os,ae as Cs,af as ro,ag as Sn,ah as nu,ai as io,aj as je,ak as _n,al as Mn,am as ml,an as Ya,ao as hi,ap as su,aq as $n,ar as ou,as as hl,at as au,au as ru,av as pi,aw as iu,ax as lu,ay as Ks,az as Bt,v as R,aA as lo,aB as co,B as He,aC as uo,aD as Qa,aE as ut,d as Xa,A as cu,aF as Rt,aG as pl,aH as du,aI as uu,aJ as eo,aK as yt,aL as wt,aM as jt,aN as Ct,I as ze,t as Pe,aO as gu,aP as mu,aQ as hu,aR as Jt,k as pu,m as Tt,u as fl,n as zt,aS as fu,l as Na,w as fi,aT as vl,aU as Za,aV as Ce,aW as vu,aX as Zt,aY as We,aZ as ka,a_ as qe,a$ as xu,b0 as bu,b1 as xl,o as en,b2 as Ue,b3 as yu}from"./index-Db-xuq0b.js";import{u as bl}from"./use-toast-CdbbItn1.js";import{S as cn,a as dn,b as un,c as gn,d as Ot}from"./select-BoQxM42A.js";import{c as wn}from"./utils-BncSPdK1.js";import{E as Ja}from"./ellipsis-CbtaBcvT.js";import{P as Ss}from"./plus-BdjS2Pc-.js";import{T as yl,u as go}from"./useEmployeePostions-CMraotEg.js";import{U as wl}from"./user-plus-CBq7Z0dQ.js";import{P as wu}from"./pencil-BBczLcc3.js";import{B as jl}from"./badge-D7JvaQeJ.js";import{A as Zo,a as Jo,b as mo}from"./avatar-C2-XEZ4v.js";import{u as ju}from"./employeePositionsService-CkHoE9xG.js";import{C as Ft,m as Cu}from"./proxy-i8Py-I0x.js";import{M as Su}from"./mail-bwr0seHR.js";import{R as vi}from"./refresh-cw-JB7N413f.js";import{P as _u}from"./phone-Ce15UUGI.js";import{C as ks}from"./circle-alert-Cd_zeQMw.js";import{E as Mu}from"./ellipsis-vertical-Cs1B3vez.js";import{E as Ru}from"./eye-Bhud4znU.js";import{L as Ge}from"./label-CsFy6wpo.js";import{u as Ln,a as Nu}from"./usePosition-Y8Dhf3qk.js";import{u as er}from"./usePositionTypes-BW1bd5Uk.js";import{S as Mt}from"./search-CM5F2ZRy.js";import{u as ku,e as Du}from"./useEmployees-CygwM5u6.js";import{u as Tu}from"./useOrganizations-DiuNBweX.js";import{u as Vn}from"./useUnit-C4s9nepK.js";import{b as Iu}from"./Utils-BP0IYDrC.js";import{g as Fu}from"./positionService-JD0NEiGK.js";import{A as ho,a as po,b as fo,c as vo,d as xo,e as bo,f as yo}from"./alert-dialog-B5Y0wlSz.js";import{g as Pu}from"./organizationsService-BEVk8qa1.js";import{g as Eu,a as Cl}from"./unitService-CmGVtFHQ.js";import{u as tr}from"./useConfig-B72ZZHmV.js";import{u as Ou}from"./useQueries-XKsSk0XW.js";import{u as mt,w as Au}from"./xlsx-sUI8S2SR.js";import{u as zu}from"./useArchived-D2u5xEKl.js";import{D as $u}from"./download-CX6rsOqt.js";import{C as Lu}from"./chevron-left-DCpEaNzo.js";import{S as Sl}from"./Switch-DSHMk-sj.js";import{R as Vu}from"./Radio-C3SNvFel.js";import{C as Bu,a as _l}from"./Checkbox-IILksgz0.js";import{f as Uu,c as Hu}from"./create-scoped-keydown-handler-O-eo68DQ.js";import{P as Nt,u as Gu}from"./Popover-CzANYrEa.js";import{u as $t}from"./use-uncontrolled-C3HRHW6t.js";import{g as nr}from"./get-auto-contrast-value-Da6zqqWm.js";import{S as qu}from"./Skeleton-BJECajc_.js";import"./InputsGroupFieldset-COkNgcEo.js";/**
* @license lucide-react v0.513.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wu=[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]],xi=ns("dot",Wu);/**
* @license lucide-react v0.513.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ku=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Yu=ns("folder-plus",Ku);/**
* @license lucide-react v0.513.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qu=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]],Ml=ns("folder-x",Qu);/**
* @license lucide-react v0.513.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xu=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],Zu=ns("move",Xu);/**
* @license lucide-react v0.513.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ju=[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],eg=ns("phone-call",Ju);/**
* @license lucide-react v0.513.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tg=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ng=ns("user-minus",tg);function bt(e,n){return t=>{e==null||e(t),n==null||n(t)}}function sg(e,n){return e in n?Js(n[e]):Js(e)}function og(e,n){const t=e?.map(o=>({value:o,px:sg(o,n)}));return t.sort((o,a)=>o.px-a.px),t}function Kn(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function ag(e,n,t){var o;return t?Array.from(((o=Uu(t,n))==null?void 0:o.querySelectorAll(e))||[]).findIndex(a=>a===t):null}function rg(){const[e,n]=y.useState(-1);return[e,{setHovered:n,resetHovered:()=>n(-1)}]}function En(e,n,t){return n===void 0&&t===void 0?e:n!==void 0&&t===void 0?Math.max(e,n):Math.min(n===void 0&&t!==void 0?e:Math.max(e,n),t)}function ig({timeout:e=2e3}={}){const[n,t]=y.useState(null),[o,a]=y.useState(!1),[r,i]=y.useState(null),l=u=>{window.clearTimeout(r),i(window.setTimeout(()=>a(!1),e)),a(u)};return{copy:u=>{"clipboard"in navigator?navigator.clipboard.writeText(u).then(()=>l(!0)).catch(g=>t(g)):t(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{a(!1),t(null),window.clearTimeout(r)},error:n,copied:o}}function Rl(e,n,t={leading:!1}){const[o,a]=y.useState(e),r=y.useRef(!1),i=y.useRef(null),l=y.useRef(!1),d=()=>window.clearTimeout(i.current);return y.useEffect(()=>{r.current&&(!l.current&&t.leading?(l.current=!0,a(e)):(d(),i.current=window.setTimeout(()=>{l.current=!1,a(e)},n)))},[e,t.leading,n]),y.useEffect(()=>(r.current=!0,d),[]),[o,d]}function lg(e,n,t="ltr"){const o=y.useRef(null),a=y.useRef(!1),r=y.useRef(!1),i=y.useRef(0),[l,d]=y.useState(!1);return y.useEffect(()=>{a.current=!0},[]),y.useEffect(()=>{const c=o.current,u=({x:w,y:C})=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(()=>{if(a.current&&c){c.style.userSelect="none";const j=c.getBoundingClientRect();if(j.width&&j.height){const M=En((w-j.left)/j.width,0,1);e({x:t==="ltr"?M:1-M,y:En((C-j.top)/j.height,0,1)})}}})},g=()=>{document.addEventListener("mousemove",v),document.addEventListener("mouseup",p),document.addEventListener("touchmove",b),document.addEventListener("touchend",p)},m=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",p),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",p)},h=()=>{!r.current&&a.current&&(r.current=!0,typeof(n==null?void 0:n.onScrubStart)=="function"&&n.onScrubStart(),d(!0),g())},p=()=>{r.current&&a.current&&(r.current=!1,d(!1),m(),setTimeout(()=>{typeof(n==null?void 0:n.onScrubEnd)=="function"&&n.onScrubEnd()},0))},f=w=>{h(),w.preventDefault(),v(w)},v=w=>u({x:w.clientX,y:w.clientY}),x=w=>{w.cancelable&&w.preventDefault(),h(),b(w)},b=w=>{w.cancelable&&w.preventDefault(),u({x:w.changedTouches[0].clientX,y:w.changedTouches[0].clientY})};return c==null||c.addEventListener("mousedown",f),c==null||c.addEventListener("touchstart",x,{passive:!1}),()=>{c&&(c.removeEventListener("mousedown",f),c.removeEventListener("touchstart",x))}},[t,e]),{ref:o,active:l}}function hn(e,n){const t=n-e+1;return Array.from({length:t},(o,a)=>a+e)}const As="dots";function cg({total:e,siblings:n=1,boundaries:t=1,page:o,initialPage:a=1,onChange:r}){const i=Math.max(Math.trunc(e),0),[l,d]=$t({value:o,onChange:r,defaultValue:a,finalValue:a}),c=f=>{f<=0?d(1):f>i?d(i):d(f)},u=()=>c(l+1),g=()=>c(l-1),m=()=>c(1),h=()=>c(i);return{range:y.useMemo(()=>{if(n*2+3+t*2>=i)return hn(1,i);const v=Math.max(l-n,t),x=Math.min(l+n,i-t),b=v>t+2,w=x<i-(t+1);if(!b&&w){const C=n*2+t+2;return[...hn(1,C),As,...hn(i-(t-1),i)]}if(b&&!w){const C=t+1+2*n;return[...hn(1,t),As,...hn(i-C,i)]}return[...hn(1,t),As,...hn(v,x),As,...hn(i-t+1,i)]},[i,n,l]),active:l,setPage:c,next:u,previous:g,first:m,last:h}}function dg(){const[e,n]=y.useState(!1),t=y.useRef(null),o=y.useCallback(()=>n(!0),[]),a=y.useCallback(()=>n(!1),[]);return y.useEffect(()=>{const r=t.current;if(r)return r.addEventListener("mouseenter",o),r.addEventListener("mouseleave",a),()=>{r==null||r.removeEventListener("mouseenter",o),r==null||r.removeEventListener("mouseleave",a)}},[t.current]),{ref:t,hovered:e}}function ug(e){const n=y.useRef(void 0);return y.useEffect(()=>{n.current=e},[e]),n.current}function gg(e,n){return n.length===0?e:n.reduce((t,o)=>Math.abs(o-e)<Math.abs(t-e)?o:t)}function mg(e,n){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, white ${n*100}%)`;const{r:t,g:o,b:a,a:r}=Yd(e),i=l=>Math.round(l+(255-l)*n);return`rgba(${i(t)}, ${i(o)}, ${i(a)}, ${r})`}function hg(e){if(!e||typeof e=="string")return 0;const n=e/36;return Math.round((4+15*n**.25+n/5)*10)}function ea(e){return e!=null&&e.current?e.current.scrollHeight:"auto"}const gs=typeof window<"u"&&window.requestAnimationFrame;function pg({transitionDuration:e,transitionTimingFunction:n="ease",onTransitionEnd:t=()=>{},opened:o}){const a=y.useRef(null),r=0,i={height:0,overflow:"hidden"},[l,d]=y.useState(o?{}:i),c=p=>{ul.flushSync(()=>d(p))},u=p=>{c(f=>({...f,...p}))};function g(p){const f=e||hg(p);return{transition:`height ${f}ms ${n}, opacity ${f}ms ${n}`}}Ga(()=>{typeof gs=="function"&&gs(o?()=>{u({willChange:"height",display:"block",overflow:"hidden"}),gs(()=>{const p=ea(a);u({...g(p),height:p})})}:()=>{const p=ea(a);u({...g(p),willChange:"height",height:p}),gs(()=>u({height:r,overflow:"hidden"}))})},[o]);const m=p=>{if(!(p.target!==a.current||p.propertyName!=="height"))if(o){const f=ea(a);f===l.height?c({}):u({height:f}),t()}else l.height===r&&(c(i),t())};function h({style:p={},refKey:f="ref",...v}={}){const x=v[f],b={"aria-hidden":!o,...v,[f]:Qd(a,x),onTransitionEnd:m,style:{boxSizing:"border-box",...p,...l}};return In.version.startsWith("18")?o||(b.inert=""):b.inert=!o,b}return h}const fg={transitionDuration:200,transitionTimingFunction:"ease",animateOpacity:!0},as=ye((e,n)=>{const{children:t,in:o,transitionDuration:a,transitionTimingFunction:r,style:i,onTransitionEnd:l,animateOpacity:d,...c}=ge("Collapse",fg,e),u=An(),g=Xd(),h=(u.respectReducedMotion?g:!1)?0:a,p=pg({opened:o,transitionDuration:h,transitionTimingFunction:r,onTransitionEnd:l});return h===0?o?s.jsx(G,{...c,children:t}):null:s.jsx(G,{...p({style:{opacity:o||!d?1:0,transition:d?`opacity ${h}ms ${r}`:"none",...Zd(i,u)},ref:n,...c}),children:t})});as.displayName="@mantine/core/Collapse";var rs={root:"m_8d3f4000",icon:"m_8d3afb97",loader:"m_302b9fb1",group:"m_1a0f1b21",groupSection:"m_437b6484"};const bi={orientation:"horizontal"},vg=Ye((e,{borderWidth:n})=>({group:{"--ai-border-width":At(n)}})),sr=ye((e,n)=>{const t=ge("ActionIconGroup",bi,e),{className:o,style:a,classNames:r,styles:i,unstyled:l,orientation:d,vars:c,borderWidth:u,variant:g,mod:m,...h}=ge("ActionIconGroup",bi,e),p=Be({name:"ActionIconGroup",props:t,classes:rs,className:o,style:a,classNames:r,styles:i,unstyled:l,vars:c,varsResolver:vg,rootSelector:"group"});return s.jsx(G,{...p("group"),ref:n,variant:g,mod:[{"data-orientation":d},m],role:"group",...h})});sr.classes=rs;sr.displayName="@mantine/core/ActionIconGroup";const yi={},xg=Ye((e,{radius:n,color:t,gradient:o,variant:a,autoContrast:r,size:i})=>{const l=e.variantColorResolver({color:t||e.primaryColor,theme:e,gradient:o,variant:a||"filled",autoContrast:r});return{groupSection:{"--section-height":Qe(i,"section-height"),"--section-padding-x":Qe(i,"section-padding-x"),"--section-fz":kt(i),"--section-radius":n===void 0?void 0:Vt(n),"--section-bg":t||a?l.background:void 0,"--section-color":l.color,"--section-bd":t||a?l.border:void 0}}}),or=ye((e,n)=>{const t=ge("ActionIconGroupSection",yi,e),{className:o,style:a,classNames:r,styles:i,unstyled:l,vars:d,variant:c,gradient:u,radius:g,autoContrast:m,...h}=ge("ActionIconGroupSection",yi,e),p=Be({name:"ActionIconGroupSection",props:t,classes:rs,className:o,style:a,classNames:r,styles:i,unstyled:l,vars:d,varsResolver:xg,rootSelector:"groupSection"});return s.jsx(G,{...p("groupSection"),ref:n,variant:c,...h})});or.classes=rs;or.displayName="@mantine/core/ActionIconGroupSection";const bg={},yg=Ye((e,{size:n,radius:t,variant:o,gradient:a,color:r,autoContrast:i})=>{const l=e.variantColorResolver({color:r||e.primaryColor,theme:e,gradient:a,variant:o||"filled",autoContrast:i});return{root:{"--ai-size":Qe(n,"ai-size"),"--ai-radius":t===void 0?void 0:Vt(t),"--ai-bg":r||o?l.background:void 0,"--ai-hover":r||o?l.hover:void 0,"--ai-hover-color":r||o?l.hoverColor:void 0,"--ai-color":l.color,"--ai-bd":r||o?l.border:void 0}}}),Ee=zn((e,n)=>{const t=ge("ActionIcon",bg,e),{className:o,unstyled:a,variant:r,classNames:i,styles:l,style:d,loading:c,loaderProps:u,size:g,color:m,radius:h,__staticSelector:p,gradient:f,vars:v,children:x,disabled:b,"data-disabled":w,autoContrast:C,mod:j,...M}=t,k=Be({name:["ActionIcon",p],props:t,className:o,style:d,classes:rs,classNames:i,styles:l,unstyled:a,vars:v,varsResolver:yg});return s.jsxs(Et,{...k("root",{active:!b&&!c&&!w}),...M,unstyled:a,variant:r,size:g,disabled:b||c,ref:n,mod:[{loading:c,disabled:b||w},j],children:[s.jsx(ss,{mounted:!!c,transition:"slide-down",duration:150,children:S=>s.jsx(G,{component:"span",...k("loader",{style:S}),"aria-hidden":!0,children:s.jsx(Rs,{color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...u})})}),s.jsx(G,{component:"span",mod:{loading:c},...k("icon"),children:x})]})});Ee.classes=rs;Ee.displayName="@mantine/core/ActionIcon";Ee.Group=sr;Ee.GroupSection=or;function wg(e){return y.Children.toArray(e).filter(Boolean)}var Nl={root:"m_4081bf90"};const jg={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},Cg=Ye((e,{grow:n,preventGrowOverflow:t,gap:o,align:a,justify:r,wrap:i},{childWidth:l})=>({root:{"--group-child-width":n&&t?l:void 0,"--group-gap":xt(o),"--group-align":a,"--group-justify":r,"--group-wrap":i}})),Fe=ye((e,n)=>{const t=ge("Group",jg,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,children:d,gap:c,align:u,justify:g,wrap:m,grow:h,preventGrowOverflow:p,vars:f,variant:v,__size:x,mod:b,...w}=t,C=wg(d),j=C.length,M=xt(c??"md"),S={childWidth:`calc(${100/j}% - (${M} - ${M} / ${j}))`},T=Be({name:"Group",props:t,stylesCtx:S,className:a,style:r,classes:Nl,classNames:o,styles:i,unstyled:l,vars:f,varsResolver:Cg});return s.jsx(G,{...T("root"),ref:n,variant:v,mod:[{grow:h},b],size:x,...w,children:C})});Fe.classes=Nl;Fe.displayName="@mantine/core/Group";const Sg={gap:{type:"spacing",property:"gap"},rowGap:{type:"spacing",property:"rowGap"},columnGap:{type:"spacing",property:"columnGap"},align:{type:"identity",property:"alignItems"},justify:{type:"identity",property:"justifyContent"},wrap:{type:"identity",property:"flexWrap"},direction:{type:"identity",property:"flexDirection"}};var kl={root:"m_8bffd616"};const _g={},st=zn((e,n)=>{const t=ge("Flex",_g,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,gap:c,rowGap:u,columnGap:g,align:m,justify:h,wrap:p,direction:f,...v}=t,x=Be({name:"Flex",classes:kl,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d}),b=An(),w=gl(),C=Jd({styleProps:{gap:c,rowGap:u,columnGap:g,align:m,justify:h,wrap:p,direction:f},theme:b,data:Sg});return s.jsxs(s.Fragment,{children:[C.hasResponsiveStyles&&s.jsx(qa,{selector:`.${w}`,styles:C.styles,media:C.media}),s.jsx(G,{ref:n,...x("root",{className:w,style:Wa(C.inlineStyles)}),...v})]})});st.classes=kl;st.displayName="@mantine/core/Flex";function Da({style:e,size:n=16,...t}){return s.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...e,width:At(n),height:At(n),display:"block"},...t,children:s.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}Da.displayName="@mantine/core/AccordionChevron";var Dl={root:"m_66836ed3",wrapper:"m_a5d60502",body:"m_667c2793",title:"m_6a03f287",label:"m_698f4f23",icon:"m_667f2a6a",message:"m_7fa78076",closeButton:"m_87f54839"};const Mg={},Rg=Ye((e,{radius:n,color:t,variant:o,autoContrast:a})=>{const r=e.variantColorResolver({color:t||e.primaryColor,theme:e,variant:o||"light",autoContrast:a});return{root:{"--alert-radius":n===void 0?void 0:Vt(n),"--alert-bg":t||o?r.background:void 0,"--alert-color":r.color,"--alert-bd":t||o?r.border:void 0}}}),wo=ye((e,n)=>{const t=ge("Alert",Mg,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,radius:c,color:u,title:g,children:m,id:h,icon:p,withCloseButton:f,onClose:v,closeButtonLabel:x,variant:b,autoContrast:w,...C}=t,j=Be({name:"Alert",classes:Dl,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Rg}),M=Ns(h),k=g&&`${M}-title`||void 0,S=`${M}-body`;return s.jsx(G,{id:M,...j("root",{variant:b}),variant:b,ref:n,...C,role:"alert","aria-describedby":S,"aria-labelledby":k,children:s.jsxs("div",{...j("wrapper"),children:[p&&s.jsx("div",{...j("icon"),children:p}),s.jsxs("div",{...j("body"),children:[g&&s.jsx("div",{...j("title"),"data-with-close-button":f||void 0,children:s.jsx("span",{id:k,...j("label"),children:g})}),m&&s.jsx("div",{id:S,...j("message"),"data-variant":b,children:m})]}),f&&s.jsx(Ka,{...j("closeButton"),onClick:v,variant:"transparent",size:16,iconSize:16,"aria-label":x,unstyled:l})]})})});wo.classes=Dl;wo.displayName="@mantine/core/Alert";var Tl={root:"m_b6d8b162"};function Ng(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const kg={inherit:!1},Dg=Ye((e,{variant:n,lineClamp:t,gradient:o,size:a,color:r})=>({root:{"--text-fz":kt(a),"--text-lh":tu(a),"--text-gradient":n==="gradient"?eu(o,e):void 0,"--text-line-clamp":typeof t=="number"?t.toString():void 0,"--text-color":r?Yt(r,e):void 0}})),ue=zn((e,n)=>{const t=ge("Text",kg,e),{lineClamp:o,truncate:a,inline:r,inherit:i,gradient:l,span:d,__staticSelector:c,vars:u,className:g,style:m,classNames:h,styles:p,unstyled:f,variant:v,mod:x,size:b,...w}=t,C=Be({name:["Text",c],props:t,classes:Tl,className:g,style:m,classNames:h,styles:p,unstyled:f,vars:u,varsResolver:Dg});return s.jsx(G,{...C("root",{focusable:!0}),ref:n,component:d?"span":"p",variant:v,mod:[{"data-truncate":Ng(a),"data-line-clamp":typeof o=="number","data-inline":r,"data-inherit":i},x],size:b,...w})});ue.classes=Tl;ue.displayName="@mantine/core/Text";function Il(e){return typeof e=="string"?{value:e,label:e}:"value"in e&&!("label"in e)?{value:e.value,label:e.value,disabled:e.disabled}:typeof e=="number"?{value:e.toString(),label:e.toString()}:"group"in e?{group:e.group,items:e.items?.map(n=>Il(n))}:e}function ar(e){return e?e?.map(n=>Il(n)):[]}function jo(e){return e.reduce((n,t)=>"group"in t?{...n,...jo(t.items)}:(n[t.value]=t,n),{})}var St={dropdown:"m_88b62a41",search:"m_985517d8",options:"m_b2821a6e",option:"m_92253aa5",empty:"m_2530cd1d",header:"m_858f94bd",footer:"m_82b967cb",group:"m_254f3e4f",groupLabel:"m_2bb2e9e5",chevron:"m_2943220b",optionsDropdownOption:"m_390b5f4",optionsDropdownCheckIcon:"m_8ee53fc2"};const Tg={error:null},Ig=Ye((e,{size:n,color:t})=>({chevron:{"--combobox-chevron-size":Qe(n,"combobox-chevron-size"),"--combobox-chevron-color":t?Yt(t,e):void 0}})),rr=ye((e,n)=>{const t=ge("ComboboxChevron",Tg,e),{size:o,error:a,style:r,className:i,classNames:l,styles:d,unstyled:c,vars:u,mod:g,...m}=t,h=Be({name:"ComboboxChevron",classes:St,props:t,style:r,className:i,classNames:l,styles:d,unstyled:c,vars:u,varsResolver:Ig,rootSelector:"chevron"});return s.jsx(G,{component:"svg",...m,...h("chevron"),size:o,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:a},g],ref:n,children:s.jsx("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})});rr.classes=St;rr.displayName="@mantine/core/ComboboxChevron";const[Fg,Ut]=os("Combobox component was not found in tree"),Fl=y.forwardRef(({size:e,onMouseDown:n,onClick:t,onClear:o,...a},r)=>s.jsx(Cs.ClearButton,{ref:r,tabIndex:-1,"aria-hidden":!0,...a,onMouseDown:i=>{i.preventDefault(),n==null||n(i)},onClick:i=>{o(),t==null||t(i)}}));Fl.displayName="@mantine/core/ComboboxClearButton";const Pg={},ir=ye((e,n)=>{const{classNames:t,styles:o,className:a,style:r,hidden:i,...l}=ge("ComboboxDropdown",Pg,e),d=Ut();return s.jsx(Nt.Dropdown,{...l,ref:n,role:"presentation","data-hidden":i||void 0,...d.getStyles("dropdown",{className:a,style:r,classNames:t,styles:o})})});ir.classes=St;ir.displayName="@mantine/core/ComboboxDropdown";const Eg={refProp:"ref"},Pl=ye((e,n)=>{const{children:t,refProp:o}=ge("ComboboxDropdownTarget",Eg,e);if(Ut(),!ro(t))throw new Error("Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return s.jsx(Nt.Target,{ref:n,refProp:o,children:t})});Pl.displayName="@mantine/core/ComboboxDropdownTarget";const Og={},lr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("ComboboxEmpty",Og,e),d=Ut();return s.jsx(G,{ref:n,...d.getStyles("empty",{className:o,classNames:t,styles:r,style:a}),...l})});lr.classes=St;lr.displayName="@mantine/core/ComboboxEmpty";function cr({onKeyDown:e,withKeyboardNavigation:n,withAriaAttributes:t,withExpandedAttribute:o,targetType:a,autoComplete:r}){const i=Ut(),[l,d]=y.useState(null),c=g=>{if(e==null||e(g),!i.readOnly&&n){if(g.nativeEvent.isComposing)return;if(g.nativeEvent.code==="ArrowDown"&&(g.preventDefault(),i.store.dropdownOpened?d(i.store.selectNextOption()):(i.store.openDropdown("keyboard"),d(i.store.selectActiveOption()),i.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),g.nativeEvent.code==="ArrowUp"&&(g.preventDefault(),i.store.dropdownOpened?d(i.store.selectPreviousOption()):(i.store.openDropdown("keyboard"),d(i.store.selectActiveOption()),i.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),g.nativeEvent.code==="Enter"||g.nativeEvent.code==="NumpadEnter"){if(g.nativeEvent.keyCode===229)return;const m=i.store.getSelectedOptionIndex();i.store.dropdownOpened&&m!==-1?(g.preventDefault(),i.store.clickSelectedOption()):a==="button"&&(g.preventDefault(),i.store.openDropdown("keyboard"))}g.key==="Escape"&&i.store.closeDropdown("keyboard"),g.nativeEvent.code==="Space"&&a==="button"&&(g.preventDefault(),i.store.toggleDropdown("keyboard"))}};return{...t?{"aria-haspopup":"listbox","aria-expanded":o&&!!(i.store.listId&&i.store.dropdownOpened)||void 0,"aria-controls":i.store.dropdownOpened?i.store.listId:void 0,"aria-activedescendant":i.store.dropdownOpened&&l||void 0,autoComplete:r,"data-expanded":i.store.dropdownOpened||void 0,"data-mantine-stop-propagation":i.store.dropdownOpened||void 0}:{},onKeyDown:c}}const Ag={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},El=ye((e,n)=>{const{children:t,refProp:o,withKeyboardNavigation:a,withAriaAttributes:r,withExpandedAttribute:i,targetType:l,autoComplete:d,...c}=ge("ComboboxEventsTarget",Ag,e);if(!ro(t))throw new Error("Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const u=Ut(),g=cr({targetType:l,withAriaAttributes:r,withKeyboardNavigation:a,withExpandedAttribute:i,onKeyDown:t.props.onKeyDown,autoComplete:d});return y.cloneElement(t,{...g,...c,[o]:Sn(n,u.store.targetRef,nu(t))})});El.displayName="@mantine/core/ComboboxEventsTarget";const zg={},dr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("ComboboxFooter",zg,e),d=Ut();return s.jsx(G,{ref:n,...d.getStyles("footer",{className:o,classNames:t,style:a,styles:r}),...l,onMouseDown:c=>{c.preventDefault()}})});dr.classes=St;dr.displayName="@mantine/core/ComboboxFooter";const $g={},ur=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,children:l,label:d,...c}=ge("ComboboxGroup",$g,e),u=Ut();return s.jsxs(G,{ref:n,...u.getStyles("group",{className:o,classNames:t,style:a,styles:r}),...c,children:[d&&s.jsx("div",{...u.getStyles("groupLabel",{classNames:t,styles:r}),children:d}),l]})});ur.classes=St;ur.displayName="@mantine/core/ComboboxGroup";const Lg={},gr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("ComboboxHeader",Lg,e),d=Ut();return s.jsx(G,{ref:n,...d.getStyles("header",{className:o,classNames:t,style:a,styles:r}),...l,onMouseDown:c=>{c.preventDefault()}})});gr.classes=St;gr.displayName="@mantine/core/ComboboxHeader";function Ol({value:e,valuesDivider:n=",",...t}){return s.jsx("input",{type:"hidden",value:Array.isArray(e)?e.join(n):e||"",...t})}Ol.displayName="@mantine/core/ComboboxHiddenInput";const Vg={},mr=ye((e,n)=>{const t=ge("ComboboxOption",Vg,e),{classNames:o,className:a,style:r,styles:i,vars:l,onClick:d,id:c,active:u,onMouseDown:g,onMouseOver:m,disabled:h,selected:p,mod:f,...v}=t,x=Ut(),b=y.useId(),w=c||b;return s.jsx(G,{...x.getStyles("option",{className:a,classNames:o,styles:i,style:r}),...v,ref:n,id:w,mod:["combobox-option",{"combobox-active":u,"combobox-disabled":h,"combobox-selected":p},f],role:"option",onClick:C=>{var j;h?C.preventDefault():((j=x.onOptionSubmit)==null||j.call(x,t.value,t),d==null||d(C))},onMouseDown:C=>{C.preventDefault(),g==null||g(C)},onMouseOver:C=>{x.resetSelectionOnOptionHover&&x.store.resetSelectedOption(),m==null||m(C)}})});mr.classes=St;mr.displayName="@mantine/core/ComboboxOption";const Bg={},hr=ye((e,n)=>{const t=ge("ComboboxOptions",Bg,e),{classNames:o,className:a,style:r,styles:i,id:l,onMouseDown:d,labelledBy:c,...u}=t,g=Ut(),m=Ns(l);return y.useEffect(()=>{g.store.setListId(m)},[m]),s.jsx(G,{ref:n,...g.getStyles("options",{className:a,style:r,classNames:o,styles:i}),...u,id:m,role:"listbox","aria-labelledby":c,onMouseDown:h=>{h.preventDefault(),d==null||d(h)}})});hr.classes=St;hr.displayName="@mantine/core/ComboboxOptions";const Ug={withAriaAttributes:!0,withKeyboardNavigation:!0},pr=ye((e,n)=>{const t=ge("ComboboxSearch",Ug,e),{classNames:o,styles:a,unstyled:r,vars:i,withAriaAttributes:l,onKeyDown:d,withKeyboardNavigation:c,size:u,...g}=t,m=Ut(),h=m.getStyles("search"),p=cr({targetType:"input",withAriaAttributes:l,withKeyboardNavigation:c,withExpandedAttribute:!1,onKeyDown:d,autoComplete:"off"});return s.jsx(Cs,{ref:Sn(n,m.store.searchRef),classNames:[{input:h.className},o],styles:[{input:h.style},a],size:u||m.size,...p,...g,__staticSelector:"Combobox"})});pr.classes=St;pr.displayName="@mantine/core/ComboboxSearch";const Hg={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},Al=ye((e,n)=>{const{children:t,refProp:o,withKeyboardNavigation:a,withAriaAttributes:r,withExpandedAttribute:i,targetType:l,autoComplete:d,...c}=ge("ComboboxTarget",Hg,e);if(!ro(t))throw new Error("Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const u=Ut(),g=cr({targetType:l,withAriaAttributes:r,withKeyboardNavigation:a,withExpandedAttribute:i,onKeyDown:t.props.onKeyDown,autoComplete:d}),m=y.cloneElement(t,{...g,...c});return s.jsx(Nt.Target,{ref:Sn(n,u.store.targetRef),children:m})});Al.displayName="@mantine/core/ComboboxTarget";function Gg(e,n,t){for(let o=e-1;o>=0;o-=1)if(!n[o].hasAttribute("data-combobox-disabled"))return o;if(t){for(let o=n.length-1;o>-1;o-=1)if(!n[o].hasAttribute("data-combobox-disabled"))return o}return e}function qg(e,n,t){for(let o=e+1;o<n.length;o+=1)if(!n[o].hasAttribute("data-combobox-disabled"))return o;if(t){for(let o=0;o<n.length;o+=1)if(!n[o].hasAttribute("data-combobox-disabled"))return o}return e}function Wg(e){for(let n=0;n<e.length;n+=1)if(!e[n].hasAttribute("data-combobox-disabled"))return n;return-1}function Co({defaultOpened:e,opened:n,onOpenedChange:t,onDropdownClose:o,onDropdownOpen:a,loop:r=!0,scrollBehavior:i="instant"}={}){const[l,d]=$t({value:n,defaultValue:e,finalValue:!1,onChange:t}),c=y.useRef(null),u=y.useRef(-1),g=y.useRef(null),m=y.useRef(null),h=y.useRef(-1),p=y.useRef(-1),f=y.useRef(-1),v=y.useCallback((_="unknown")=>{l||(d(!0),a==null||a(_))},[d,a,l]),x=y.useCallback((_="unknown")=>{l&&(d(!1),o==null||o(_))},[d,o,l]),b=y.useCallback((_="unknown")=>{l?x(_):v(_)},[x,v,l]),w=y.useCallback(()=>{const _=document.querySelector(`#${c.current} [data-combobox-selected]`);_==null||_.removeAttribute("data-combobox-selected"),_==null||_.removeAttribute("aria-selected")},[]),C=y.useCallback(_=>{const D=document.getElementById(c.current),O=D==null?void 0:D.querySelectorAll("[data-combobox-option]");if(!O)return null;const P=_>=O.length?0:_<0?O.length-1:_;return u.current=P,O!=null&&O[P]&&!O[P].hasAttribute("data-combobox-disabled")?(w(),O[P].setAttribute("data-combobox-selected","true"),O[P].setAttribute("aria-selected","true"),O[P].scrollIntoView({block:"nearest",behavior:i}),O[P].id):null},[i,w]),j=y.useCallback(()=>{const _=document.querySelector(`#${c.current} [data-combobox-active]`);if(_){const D=document.querySelectorAll(`#${c.current} [data-combobox-option]`),O=Array.from(D).findIndex(P=>P===_);return C(O)}return C(0)},[C]),M=y.useCallback(()=>C(qg(u.current,document.querySelectorAll(`#${c.current} [data-combobox-option]`),r)),[C,r]),k=y.useCallback(()=>C(Gg(u.current,document.querySelectorAll(`#${c.current} [data-combobox-option]`),r)),[C,r]),S=y.useCallback(()=>C(Wg(document.querySelectorAll(`#${c.current} [data-combobox-option]`))),[C]),T=y.useCallback((_="selected",D)=>{f.current=window.setTimeout(()=>{var $;const O=document.querySelectorAll(`#${c.current} [data-combobox-option]`),P=Array.from(O).findIndex(z=>z.hasAttribute(`data-combobox-${_}`));u.current=P,D!=null&&D.scrollIntoView&&(($=O[P])==null||$.scrollIntoView({block:"nearest",behavior:i}))},0)},[]),N=y.useCallback(()=>{u.current=-1,w()},[w]),F=y.useCallback(()=>{const _=document.querySelectorAll(`#${c.current} [data-combobox-option]`),D=_==null?void 0:_[u.current];D==null||D.click()},[]),E=y.useCallback(_=>{c.current=_},[]),V=y.useCallback(()=>{h.current=window.setTimeout(()=>g.current.focus(),0)},[]),L=y.useCallback(()=>{p.current=window.setTimeout(()=>m.current.focus(),0)},[]),B=y.useCallback(()=>u.current,[]);return y.useEffect(()=>()=>{window.clearTimeout(h.current),window.clearTimeout(p.current),window.clearTimeout(f.current)},[]),{dropdownOpened:l,openDropdown:v,closeDropdown:x,toggleDropdown:b,selectedOptionIndex:u.current,getSelectedOptionIndex:B,selectOption:C,selectFirstOption:S,selectActiveOption:j,selectNextOption:M,selectPreviousOption:k,resetSelectedOption:N,updateSelectedOptionIndex:T,listId:c.current,setListId:E,clickSelectedOption:F,searchRef:g,focusSearchInput:V,targetRef:m,focusTarget:L}}const Kg={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0}},Yg=Ye((e,{size:n,dropdownPadding:t})=>({options:{"--combobox-option-fz":kt(n),"--combobox-option-padding":Qe(n,"combobox-option-padding")},dropdown:{"--combobox-padding":t===void 0?void 0:At(t),"--combobox-option-fz":kt(n),"--combobox-option-padding":Qe(n,"combobox-option-padding")}}));function Ve(e){const n=ge("Combobox",Kg,e),{classNames:t,styles:o,unstyled:a,children:r,store:i,vars:l,onOptionSubmit:d,onClose:c,size:u,dropdownPadding:g,resetSelectionOnOptionHover:m,__staticSelector:h,readOnly:p,...f}=n,v=Co(),x=i||v,b=Be({name:h||"Combobox",classes:St,props:n,classNames:t,styles:o,unstyled:a,vars:l,varsResolver:Yg}),w=()=>{c==null||c(),x.closeDropdown()};return s.jsx(Fg,{value:{getStyles:b,store:x,onOptionSubmit:d,size:u,resetSelectionOnOptionHover:m,readOnly:p},children:s.jsx(Nt,{opened:x.dropdownOpened,...f,onChange:C=>!C&&w(),withRoles:!1,unstyled:a,children:r})})}const Qg=e=>e;Ve.extend=Qg;Ve.classes=St;Ve.displayName="@mantine/core/Combobox";Ve.Target=Al;Ve.Dropdown=ir;Ve.Options=hr;Ve.Option=mr;Ve.Search=pr;Ve.Empty=lr;Ve.Chevron=rr;Ve.Footer=dr;Ve.Header=gr;Ve.EventsTarget=El;Ve.DropdownTarget=Pl;Ve.Group=ur;Ve.ClearButton=Fl;Ve.HiddenInput=Ol;function Jn(e){return"group"in e}function zl({options:e,search:n,limit:t}){const o=n.trim().toLowerCase(),a=[];for(let r=0;r<e.length;r+=1){const i=e[r];if(a.length===t)return a;Jn(i)&&a.push({group:i.group,items:zl({options:i.items,search:n,limit:t-a.length})}),Jn(i)||i.label.toLowerCase().includes(o)&&a.push(i)}return a}function Xg(e){if(e.length===0)return!0;for(const n of e)if(!("group"in n)||n.items.length>0)return!1;return!0}function $l(e,n=new Set){if(Array.isArray(e))for(const t of e)if(Jn(t))$l(t.items,n);else{if(typeof t.value>"u")throw new Error("[@mantine/core] Each option must have value property");if(typeof t.value!="string")throw new Error(`[@mantine/core] Option value must be a string, other data formats are not supported, got ${typeof t.value}`);if(n.has(t.value))throw new Error(`[@mantine/core] Duplicate options are not supported. Option with value "${t.value}" was provided more than once`);n.add(t.value)}}function Zg(e,n){return Array.isArray(e)?e.includes(n):e===n}function Ll({data:e,withCheckIcon:n,value:t,checkIconPosition:o,unstyled:a,renderOption:r}){if(!Jn(e)){const l=Zg(t,e.value),d=n&&l&&s.jsx(Bu,{className:St.optionsDropdownCheckIcon}),c=s.jsxs(s.Fragment,{children:[o==="left"&&d,s.jsx("span",{children:e.label}),o==="right"&&d]});return s.jsx(Ve.Option,{value:e.value,disabled:e.disabled,className:je({[St.optionsDropdownOption]:!a}),"data-reverse":o==="right"||void 0,"data-checked":l||void 0,"aria-selected":l,active:l,children:typeof r=="function"?r({option:e,checked:l}):c})}const i=e.items?.map(l=>s.jsx(Ll,{data:l,value:t,unstyled:a,withCheckIcon:n,checkIconPosition:o,renderOption:r},l.value));return s.jsx(Ve.Group,{label:e.group,children:i})}function fr({data:e,hidden:n,hiddenWhenEmpty:t,filter:o,search:a,limit:r,maxDropdownHeight:i,withScrollArea:l=!0,filterOptions:d=!0,withCheckIcon:c=!1,value:u,checkIconPosition:g,nothingFoundMessage:m,unstyled:h,labelId:p,renderOption:f,scrollAreaProps:v,"aria-label":x}){$l(e);const w=typeof a=="string"?(o||zl)({options:e,search:d?a:"",limit:r??1/0}):e,C=Xg(w),j=w?.map(M=>s.jsx(Ll,{data:M,withCheckIcon:c,value:u,checkIconPosition:g,unstyled:h,renderOption:f},Jn(M)?M.group:M.value));return s.jsx(Ve.Dropdown,{hidden:n||t&&C,"data-composed":!0,children:s.jsxs(Ve.Options,{labelledBy:p,"aria-label":x,children:[l?s.jsx(io.Autosize,{mah:i??220,type:"scroll",scrollbarSize:"var(--combobox-padding)",offsetScrollbars:"y",...v,children:j}):j,C&&m&&s.jsx(Ve.Empty,{children:m})]})})}const Jg={},vr=ye((e,n)=>{const t=ge("Autocomplete",Jg,e),{classNames:o,styles:a,unstyled:r,vars:i,dropdownOpened:l,defaultDropdownOpened:d,onDropdownClose:c,onDropdownOpen:u,onFocus:g,onBlur:m,onClick:h,onChange:p,data:f,value:v,defaultValue:x,selectFirstOptionOnChange:b,onOptionSubmit:w,comboboxProps:C,readOnly:j,disabled:M,filter:k,limit:S,withScrollArea:T,maxDropdownHeight:N,size:F,id:E,renderOption:V,autoComplete:L,scrollAreaProps:B,onClear:_,clearButtonProps:D,error:O,clearable:P,rightSection:$,...z}=t,H=Ns(E),ae=ar(f),ie=jo(ae),[Q,se]=$t({value:v,defaultValue:x,finalValue:"",onChange:p}),te=Co({opened:l,defaultOpened:d,onDropdownOpen:u,onDropdownClose:()=>{c==null||c(),te.resetSelectedOption()}}),Z=ee=>{se(ee),te.resetSelectedOption()},{resolvedClassNames:I,resolvedStyles:Y}=_n({props:t,styles:a,classNames:o});y.useEffect(()=>{b&&te.selectFirstOption()},[b,Q]);const ce=s.jsx(Ve.ClearButton,{...D,onClear:()=>{Z(""),_==null||_()}});return s.jsxs(Ve,{store:te,__staticSelector:"Autocomplete",classNames:I,styles:Y,unstyled:r,readOnly:j,onOptionSubmit:ee=>{w==null||w(ee),Z(ie[ee].label),te.closeDropdown()},size:F,...C,children:[s.jsx(Ve.Target,{autoComplete:L,children:s.jsx(Mn,{ref:n,...z,size:F,__staticSelector:"Autocomplete",__clearSection:ce,__clearable:P&&!!Q&&!M&&!j,rightSection:$,disabled:M,readOnly:j,value:Q,error:O,onChange:ee=>{Z(ee.currentTarget.value),te.openDropdown(),b&&te.selectFirstOption()},onFocus:ee=>{te.openDropdown(),g==null||g(ee)},onBlur:ee=>{te.closeDropdown(),m==null||m(ee)},onClick:ee=>{te.openDropdown(),h==null||h(ee)},classNames:I,styles:Y,unstyled:r,id:H})}),s.jsx(fr,{data:ae,hidden:j||M,filter:k,search:Q,limit:S,hiddenWhenEmpty:!0,withScrollArea:T,maxDropdownHeight:N,unstyled:r,labelId:z.label?`${H}-label`:void 0,"aria-label":z.label?void 0:z["aria-label"],renderOption:V,scrollAreaProps:B})]})});vr.classes={...Mn.classes,...Ve.classes};vr.displayName="@mantine/core/Autocomplete";var Vl={root:"m_347db0ec","root--dot":"m_fbd81e3d",label:"m_5add502a",section:"m_91fdda9b"};const em={},tm=Ye((e,{radius:n,color:t,gradient:o,variant:a,size:r,autoContrast:i})=>{const l=e.variantColorResolver({color:t||e.primaryColor,theme:e,gradient:o,variant:a||"filled",autoContrast:i});return{root:{"--badge-height":Qe(r,"badge-height"),"--badge-padding-x":Qe(r,"badge-padding-x"),"--badge-fz":Qe(r,"badge-fz"),"--badge-radius":n===void 0?void 0:Vt(n),"--badge-bg":t||a?l.background:void 0,"--badge-color":t||a?l.color:void 0,"--badge-bd":t||a?l.border:void 0,"--badge-dot-color":a==="dot"?Yt(t,e):void 0}}}),nt=zn((e,n)=>{const t=ge("Badge",em,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,radius:c,color:u,gradient:g,leftSection:m,rightSection:h,children:p,variant:f,fullWidth:v,autoContrast:x,circle:b,mod:w,...C}=t,j=Be({name:"Badge",props:t,classes:Vl,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:tm});return s.jsxs(G,{variant:f,mod:[{block:v,circle:b,"with-right-section":!!h,"with-left-section":!!m},w],...j("root",{variant:f}),ref:n,...C,children:[m&&s.jsx("span",{...j("section"),"data-position":"left",children:m}),s.jsx("span",{...j("label"),children:p}),h&&s.jsx("span",{...j("section"),"data-position":"right",children:h})]})});nt.classes=Vl;nt.displayName="@mantine/core/Badge";var is={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844",groupSection:"m_70be2a01"};const wi={orientation:"horizontal"},nm=Ye((e,{borderWidth:n})=>({group:{"--button-border-width":At(n)}})),xr=ye((e,n)=>{const t=ge("ButtonGroup",wi,e),{className:o,style:a,classNames:r,styles:i,unstyled:l,orientation:d,vars:c,borderWidth:u,variant:g,mod:m,...h}=ge("ButtonGroup",wi,e),p=Be({name:"ButtonGroup",props:t,classes:is,className:o,style:a,classNames:r,styles:i,unstyled:l,vars:c,varsResolver:nm,rootSelector:"group"});return s.jsx(G,{...p("group"),ref:n,variant:g,mod:[{"data-orientation":d},m],role:"group",...h})});xr.classes=is;xr.displayName="@mantine/core/ButtonGroup";const ji={},sm=Ye((e,{radius:n,color:t,gradient:o,variant:a,autoContrast:r,size:i})=>{const l=e.variantColorResolver({color:t||e.primaryColor,theme:e,gradient:o,variant:a||"filled",autoContrast:r});return{groupSection:{"--section-height":Qe(i,"section-height"),"--section-padding-x":Qe(i,"section-padding-x"),"--section-fz":i!=null&&i.includes("compact")?kt(i.replace("compact-","")):kt(i),"--section-radius":n===void 0?void 0:Vt(n),"--section-bg":t||a?l.background:void 0,"--section-color":l.color,"--section-bd":t||a?l.border:void 0}}}),br=ye((e,n)=>{const t=ge("ButtonGroupSection",ji,e),{className:o,style:a,classNames:r,styles:i,unstyled:l,vars:d,variant:c,gradient:u,radius:g,autoContrast:m,...h}=ge("ButtonGroupSection",ji,e),p=Be({name:"ButtonGroupSection",props:t,classes:is,className:o,style:a,classNames:r,styles:i,unstyled:l,vars:d,varsResolver:sm,rootSelector:"groupSection"});return s.jsx(G,{...p("groupSection"),ref:n,variant:c,...h})});br.classes=is;br.displayName="@mantine/core/ButtonGroupSection";const om={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${At(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},am={},rm=Ye((e,{radius:n,color:t,gradient:o,variant:a,size:r,justify:i,autoContrast:l})=>{const d=e.variantColorResolver({color:t||e.primaryColor,theme:e,gradient:o,variant:a||"filled",autoContrast:l});return{root:{"--button-justify":i,"--button-height":Qe(r,"button-height"),"--button-padding-x":Qe(r,"button-padding-x"),"--button-fz":r!=null&&r.includes("compact")?kt(r.replace("compact-","")):kt(r),"--button-radius":n===void 0?void 0:Vt(n),"--button-bg":t||a?d.background:void 0,"--button-hover":t||a?d.hover:void 0,"--button-color":d.color,"--button-bd":t||a?d.border:void 0,"--button-hover-color":t||a?d.hoverColor:void 0}}}),pt=zn((e,n)=>{const t=ge("Button",am,e),{style:o,vars:a,className:r,color:i,disabled:l,children:d,leftSection:c,rightSection:u,fullWidth:g,variant:m,radius:h,loading:p,loaderProps:f,gradient:v,classNames:x,styles:b,unstyled:w,"data-disabled":C,autoContrast:j,mod:M,...k}=t,S=Be({name:"Button",props:t,classes:is,className:r,style:o,classNames:x,styles:b,unstyled:w,vars:a,varsResolver:rm}),T=!!c,N=!!u;return s.jsxs(Et,{ref:n,...S("root",{active:!l&&!p&&!C}),unstyled:w,variant:m,disabled:l||p,mod:[{disabled:l||C,loading:p,block:g,"with-left-section":T,"with-right-section":N},M],...k,children:[s.jsx(ss,{mounted:!!p,transition:om,duration:150,children:F=>s.jsx(G,{component:"span",...S("loader",{style:F}),"aria-hidden":!0,children:s.jsx(Rs,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...f})})}),s.jsxs("span",{...S("inner"),children:[c&&s.jsx(G,{component:"span",...S("section"),mod:{position:"left"},children:c}),s.jsx(G,{component:"span",mod:{loading:p},...S("label"),children:d}),u&&s.jsx(G,{component:"span",...S("section"),mod:{position:"right"},children:u})]})]})});pt.classes=is;pt.displayName="@mantine/core/Button";pt.Group=xr;pt.GroupSection=br;const im={timeout:1e3};function Bl(e){const{children:n,timeout:t,value:o,...a}=ge("CopyButton",im,e),r=ig({timeout:t}),i=()=>r.copy(o);return s.jsx(s.Fragment,{children:n({copy:i,copied:r.copied,...a})})}Bl.displayName="@mantine/core/CopyButton";var Ul={root:"m_3eebeb36",label:"m_9e365f20"};const lm={orientation:"horizontal"},cm=Ye((e,{color:n,variant:t,size:o})=>({root:{"--divider-color":n?Yt(n,e):void 0,"--divider-border-style":t,"--divider-size":Qe(o,"divider-size")}})),yr=ye((e,n)=>{const t=ge("Divider",lm,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,color:c,orientation:u,label:g,labelPosition:m,mod:h,...p}=t,f=Be({name:"Divider",classes:Ul,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:cm});return s.jsx(G,{ref:n,mod:[{orientation:u,"with-label":!!g},h],...f("root"),...p,role:"separator",children:g&&s.jsx(G,{component:"span",mod:{position:m},...f("label"),children:g})})});yr.classes=Ul;yr.displayName="@mantine/core/Divider";function dm({open:e,close:n,openDelay:t,closeDelay:o}){const a=y.useRef(-1),r=y.useRef(-1),i=()=>{window.clearTimeout(a.current),window.clearTimeout(r.current)},l=()=>{i(),t===0||t===void 0?e():a.current=window.setTimeout(e,t)},d=()=>{i(),o===0||o===void 0?n():r.current=window.setTimeout(n,o)};return y.useEffect(()=>i,[]),{openDropdown:l,closeDropdown:d}}function Ci({color:e,theme:n,defaultShade:t}){const o=ml({color:e,theme:n});return o.isThemeColor?o.shade===void 0?`var(--mantine-color-${o.color}-${t})`:`var(${o.variable})`:e}var Hl={root:"m_bcb3f3c2"};const um={color:"yellow"},gm=Ye((e,{color:n})=>({root:{"--mark-bg-dark":Ci({color:n,theme:e,defaultShade:5}),"--mark-bg-light":Ci({color:n,theme:e,defaultShade:2})}})),wr=ye((e,n)=>{const t=ge("Mark",um,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,color:c,variant:u,...g}=t,m=Be({name:"Mark",props:t,className:a,style:r,classes:Hl,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:gm});return s.jsx(G,{component:"mark",ref:n,variant:u,...m("root"),...g})});wr.classes=Hl;wr.displayName="@mantine/core/Mark";function Si(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")}function mm(e,n){if(n==null)return[{chunk:e,highlighted:!1}];const t=Array.isArray(n)?n?.map(Si):Si(n);if(!(Array.isArray(t)?t.filter(l=>l.trim().length>0).length>0:t.trim()!==""))return[{chunk:e,highlighted:!1}];const a=typeof t=="string"?t.trim():t.filter(l=>l.trim().length!==0)?.map(l=>l.trim()).sort((l,d)=>d.length-l.length).join("|"),r=new RegExp(`(${a})`,"gi");return e.split(r)?.map(l=>({chunk:l,highlighted:r.test(l)})).filter(({chunk:l})=>l)}const hm={},jr=zn((e,n)=>{const{unstyled:t,children:o,highlight:a,highlightStyles:r,color:i,...l}=ge("Highlight",hm,e),d=mm(o,a);return s.jsx(ue,{unstyled:t,ref:n,...l,__staticSelector:"Highlight",children:d?.map(({chunk:c,highlighted:u},g)=>u?s.jsx(wr,{unstyled:t,color:i,style:r,"data-highlight":c,children:c},g):s.jsx("span",{children:c},g))})});jr.classes=ue.classes;jr.displayName="@mantine/core/Highlight";function pm(e="top-end",n=0){const t={"--indicator-top":void 0,"--indicator-bottom":void 0,"--indicator-left":void 0,"--indicator-right":void 0,"--indicator-translate-x":void 0,"--indicator-translate-y":void 0},o=At(n),[a,r]=e.split("-");return a==="top"&&(t["--indicator-top"]=o,t["--indicator-translate-y"]="-50%"),a==="middle"&&(t["--indicator-top"]="50%",t["--indicator-translate-y"]="-50%"),a==="bottom"&&(t["--indicator-bottom"]=o,t["--indicator-translate-y"]="50%"),r==="start"&&(t["--indicator-left"]=o,t["--indicator-translate-x"]="-50%"),r==="center"&&(t["--indicator-left"]="50%",t["--indicator-translate-x"]="-50%"),r==="end"&&(t["--indicator-right"]=o,t["--indicator-translate-x"]="50%"),t}var Gl={root:"m_e5262200",indicator:"m_760d1fb1",processing:"m_885901b1"};const fm={position:"top-end",offset:0,inline:!1,withBorder:!1,disabled:!1,processing:!1},vm=Ye((e,{color:n,position:t,offset:o,size:a,radius:r,zIndex:i,autoContrast:l})=>({root:{"--indicator-color":n?Yt(n,e):void 0,"--indicator-text-color":nr(l,e)?Ya({color:n,theme:e,autoContrast:l}):void 0,"--indicator-size":At(a),"--indicator-radius":r===void 0?void 0:Vt(r),"--indicator-z-index":i==null?void 0:i.toString(),...pm(t,o)}})),Cr=ye((e,n)=>{const t=ge("Indicator",fm,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,children:c,position:u,offset:g,inline:m,label:h,radius:p,color:f,withBorder:v,disabled:x,processing:b,zIndex:w,autoContrast:C,mod:j,...M}=t,k=Be({name:"Indicator",classes:Gl,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:vm});return s.jsxs(G,{ref:n,...k("root"),mod:[{inline:m},j],...M,children:[!x&&s.jsx(G,{mod:{"with-label":!!h,"with-border":v,processing:b},...k("indicator"),children:h}),c]})});Cr.classes=Gl;Cr.displayName="@mantine/core/Indicator";var ql={root:"m_6e45937b",loader:"m_e8eb006c",overlay:"m_df587f17"};const _i={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:su("overlay")},xm=Ye((e,{zIndex:n})=>({root:{"--lo-z-index":n==null?void 0:n.toString()}})),Sr=ye((e,n)=>{const t=ge("LoadingOverlay",_i,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,transitionProps:c,loaderProps:u,overlayProps:g,visible:m,zIndex:h,...p}=t,f=An(),v=Be({name:"LoadingOverlay",classes:ql,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:xm}),x={..._i.overlayProps,...g};return s.jsx(ss,{transition:"fade",...c,mounted:!!m,children:b=>s.jsxs(G,{...v("root",{style:b}),ref:n,...p,children:[s.jsx(Rs,{...v("loader"),unstyled:l,...u}),s.jsx(hi,{...x,...v("overlay"),darkHidden:!0,unstyled:l,color:(g==null?void 0:g.color)||f.white}),s.jsx(hi,{...x,...v("overlay"),lightHidden:!0,unstyled:l,color:(g==null?void 0:g.color)||f.colors.dark[5]})]})})});Sr.classes=ql;Sr.displayName="@mantine/core/LoadingOverlay";const[bm,Ds]=os("Menu component was not found in the tree");var ls={dropdown:"m_dc9b7c9f",label:"m_9bfac126",divider:"m_efdf90cb",item:"m_99ac2aa1",itemLabel:"m_5476e0d3",itemSection:"m_8b75e504"};const ym={},_r=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("MenuDivider",ym,e),d=Ds();return s.jsx(G,{ref:n,...d.getStyles("divider",{className:o,style:a,styles:r,classNames:t}),...l})});_r.classes=ls;_r.displayName="@mantine/core/MenuDivider";const wm={},Mr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,onMouseEnter:l,onMouseLeave:d,onKeyDown:c,children:u,...g}=ge("MenuDropdown",wm,e),m=y.useRef(null),h=Ds(),p=bt(c,x=>{var b,w;(x.key==="ArrowUp"||x.key==="ArrowDown")&&(x.preventDefault(),(w=(b=m.current)==null?void 0:b.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||w.focus())}),f=bt(l,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.openDropdown()),v=bt(d,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.closeDropdown());return s.jsxs(Nt.Dropdown,{...g,onMouseEnter:f,onMouseLeave:v,role:"menu","aria-orientation":"vertical",ref:Sn(n,m),...h.getStyles("dropdown",{className:o,style:a,styles:r,classNames:t,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:p,children:[h.withInitialFocusPlaceholder&&s.jsx("div",{tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),u]})});Mr.classes=ls;Mr.displayName="@mantine/core/MenuDropdown";const jm={},Rr=zn((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,color:l,closeMenuOnClick:d,leftSection:c,rightSection:u,children:g,disabled:m,"data-disabled":h,...p}=ge("MenuItem",jm,e),f=Ds(),v=An(),{dir:x}=$n(),b=y.useRef(null),w=f.getItemIndex(b.current),C=p,j=bt(C.onMouseLeave,()=>f.setHovered(-1)),M=bt(C.onMouseEnter,()=>f.setHovered(f.getItemIndex(b.current))),k=bt(C.onClick,()=>{h||(typeof d=="boolean"?d&&f.closeDropdownImmediately():f.closeOnItemClick&&f.closeDropdownImmediately())}),S=bt(C.onFocus,()=>f.setHovered(f.getItemIndex(b.current))),T=l?v.variantColorResolver({color:l,theme:v,variant:"light"}):void 0,N=l?ml({color:l,theme:v}):null;return s.jsxs(Et,{...p,unstyled:f.unstyled,tabIndex:f.menuItemTabIndex,onFocus:S,...f.getStyles("item",{className:o,style:a,styles:r,classNames:t}),ref:Sn(b,n),role:"menuitem",disabled:m,"data-menu-item":!0,"data-disabled":m||h||void 0,"data-hovered":f.hovered===w?!0:void 0,"data-mantine-stop-propagation":!0,onMouseEnter:M,onMouseLeave:j,onClick:k,onKeyDown:Hu({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:f.loop,dir:x,orientation:"vertical",onKeyDown:C.onKeyDown}),__vars:{"--menu-item-color":N!=null&&N.isThemeColor&&(N==null?void 0:N.shade)===void 0?`var(--mantine-color-${N.color}-6)`:T==null?void 0:T.color,"--menu-item-hover":T==null?void 0:T.hover},children:[c&&s.jsx("div",{...f.getStyles("itemSection",{styles:r,classNames:t}),"data-position":"left",children:c}),g&&s.jsx("div",{...f.getStyles("itemLabel",{styles:r,classNames:t}),children:g}),u&&s.jsx("div",{...f.getStyles("itemSection",{styles:r,classNames:t}),"data-position":"right",children:u})]})});Rr.classes=ls;Rr.displayName="@mantine/core/MenuItem";const Cm={},Nr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("MenuLabel",Cm,e),d=Ds();return s.jsx(G,{ref:n,...d.getStyles("label",{className:o,style:a,styles:r,classNames:t}),...l})});Nr.classes=ls;Nr.displayName="@mantine/core/MenuLabel";const Sm={refProp:"ref"},Wl=y.forwardRef((e,n)=>{const{children:t,refProp:o,...a}=ge("MenuTarget",Sm,e);if(!ro(t))throw new Error("Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const r=Ds(),i=t.props,l=bt(i.onClick,()=>{r.trigger==="click"?r.toggleDropdown():r.trigger==="click-hover"&&(r.setOpenedViaClick(!0),r.opened||r.openDropdown())}),d=bt(i.onMouseEnter,()=>(r.trigger==="hover"||r.trigger==="click-hover")&&r.openDropdown()),c=bt(i.onMouseLeave,()=>{(r.trigger==="hover"||r.trigger==="click-hover"&&!r.openedViaClick)&&r.closeDropdown()});return s.jsx(Nt.Target,{refProp:o,popupType:"menu",ref:n,...a,children:y.cloneElement(t,{onClick:l,onMouseEnter:d,onMouseLeave:c,"data-expanded":r.opened?!0:void 0})})});Wl.displayName="@mantine/core/MenuTarget";const _m={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function De(e){const n=ge("Menu",_m,e),{children:t,onOpen:o,onClose:a,opened:r,defaultOpened:i,trapFocus:l,onChange:d,closeOnItemClick:c,loop:u,closeOnEscape:g,trigger:m,openDelay:h,closeDelay:p,classNames:f,styles:v,unstyled:x,variant:b,vars:w,menuItemTabIndex:C,keepMounted:j,withInitialFocusPlaceholder:M,...k}=n,S=Be({name:"Menu",classes:ls,props:n,classNames:f,styles:v,unstyled:x}),[T,{setHovered:N,resetHovered:F}]=rg(),[E,V]=$t({value:r,defaultValue:i,finalValue:!1,onChange:d}),[L,B]=y.useState(!1),_=()=>{V(!1),B(!1),E&&(a==null||a())},D=()=>{V(!0),!E&&(o==null||o())},O=()=>{E?_():D()},{openDropdown:P,closeDropdown:$}=dm({open:D,close:_,closeDelay:p,openDelay:h}),z=ie=>ag("[data-menu-item]","[data-menu-dropdown]",ie),{resolvedClassNames:H,resolvedStyles:ae}=_n({classNames:f,styles:v,props:n});return Ga(()=>{F()},[E]),s.jsx(bm,{value:{getStyles:S,opened:E,toggleDropdown:O,getItemIndex:z,hovered:T,setHovered:N,openedViaClick:L,setOpenedViaClick:B,closeOnItemClick:c,closeDropdown:m==="click"?_:$,openDropdown:m==="click"?D:P,closeDropdownImmediately:_,loop:u,trigger:m,unstyled:x,menuItemTabIndex:C,withInitialFocusPlaceholder:M},children:s.jsx(Nt,{...k,opened:E,onChange:O,defaultOpened:i,trapFocus:j?!1:l,closeOnEscape:g,__staticSelector:"Menu",classNames:H,styles:ae,unstyled:x,variant:b,keepMounted:j,children:t})})}De.extend=e=>e;De.withProps=ou(De);De.classes=ls;De.displayName="@mantine/core/Menu";De.Item=Rr;De.Label=Nr;De.Dropdown=Mr;De.Target=Wl;De.Divider=_r;const[Mm,kr]=hl(),[Rm,Nm]=hl();var So={root:"m_7cda1cd6","root--default":"m_44da308b","root--contrast":"m_e3a01f8",label:"m_1e0e6180",remove:"m_ae386778",group:"m_1dcfd90b"};const km={},Dm=Ye((e,{gap:n},{size:t})=>({group:{"--pg-gap":n!==void 0?Qe(n):Qe(t,"pg-gap")}})),Dr=ye((e,n)=>{const t=ge("PillGroup",km,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,size:c,disabled:u,...g}=t,m=kr(),h=(m==null?void 0:m.size)||c||void 0,p=Be({name:"PillGroup",classes:So,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Dm,stylesCtx:{size:h},rootSelector:"group"});return s.jsx(Rm,{value:{size:h,disabled:u},children:s.jsx(G,{ref:n,size:h,...p("group"),...g})})});Dr.classes=So;Dr.displayName="@mantine/core/PillGroup";const Tm={variant:"default"},Im=Ye((e,{radius:n},{size:t})=>({root:{"--pill-fz":Qe(t,"pill-fz"),"--pill-height":Qe(t,"pill-height"),"--pill-radius":n===void 0?void 0:Vt(n)}})),_s=ye((e,n)=>{const t=ge("Pill",Tm,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,variant:c,children:u,withRemoveButton:g,onRemove:m,removeButtonProps:h,radius:p,size:f,disabled:v,mod:x,...b}=t,w=Nm(),C=kr(),j=f||(w==null?void 0:w.size)||void 0,M=(C==null?void 0:C.variant)==="filled"?"contrast":c||"default",k=Be({name:"Pill",classes:So,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Im,stylesCtx:{size:j}});return s.jsxs(G,{component:"span",ref:n,variant:M,size:j,...k("root",{variant:M}),mod:[{"with-remove":g&&!v,disabled:v||(w==null?void 0:w.disabled)},x],...b,children:[s.jsx("span",{...k("label"),children:u}),g&&s.jsx(Ka,{variant:"transparent",radius:p,tabIndex:-1,"aria-hidden":!0,unstyled:l,...h,...k("remove",{className:h==null?void 0:h.className,style:h==null?void 0:h.style}),onMouseDown:S=>{var T;S.preventDefault(),S.stopPropagation(),(T=h==null?void 0:h.onMouseDown)==null||T.call(h,S)},onClick:S=>{var T;S.stopPropagation(),m==null||m(),(T=h==null?void 0:h.onClick)==null||T.call(h,S)}})]})});_s.classes=So;_s.displayName="@mantine/core/Pill";_s.Group=Dr;var Kl={field:"m_45c4369d"};const Fm={type:"visible"},Tr=ye((e,n)=>{const t=ge("PillsInputField",Fm,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,type:c,disabled:u,id:g,pointer:m,mod:h,...p}=t,f=kr(),v=au(),x=Be({name:"PillsInputField",classes:Kl,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,rootSelector:"field"}),b=u||(f==null?void 0:f.disabled);return s.jsx(G,{component:"input",ref:Sn(n,f==null?void 0:f.fieldRef),"data-type":c,disabled:b,mod:[{disabled:b,pointer:m},h],...x("field"),...p,id:(v==null?void 0:v.inputId)||g,"aria-invalid":f==null?void 0:f.hasError,"aria-describedby":v==null?void 0:v.describedBy,type:"text",onMouseDown:w=>!m&&w.stopPropagation()})});Tr.classes=Kl;Tr.displayName="@mantine/core/PillsInputField";const Pm={},to=ye((e,n)=>{const t=ge("PillsInput",Pm,e),{children:o,onMouseDown:a,onClick:r,size:i,disabled:l,__staticSelector:d,error:c,variant:u,...g}=t,m=y.useRef(null);return s.jsx(Mm,{value:{fieldRef:m,size:i,disabled:l,hasError:!!c,variant:u},children:s.jsx(Mn,{size:i,error:c,variant:u,component:"div",ref:n,onMouseDown:h=>{var p;h.preventDefault(),a==null||a(h),(p=m.current)==null||p.focus()},onClick:h=>{var f;h.preventDefault();const p=h.currentTarget.closest("fieldset");p!=null&&p.disabled||((f=m.current)==null||f.focus(),r==null||r(h))},...g,multiline:!0,disabled:l,__staticSelector:d||"PillsInput",withAria:!1,children:o})})});to.displayName="@mantine/core/PillsInput";to.Field=Tr;function Em({data:e,value:n}){const t=n?.map(a=>a.trim().toLowerCase());return e.reduce((a,r)=>(Jn(r)?a.push({group:r.group,items:r.items.filter(i=>t.indexOf(i.value.toLowerCase().trim())===-1)}):t.indexOf(r.value.toLowerCase().trim())===-1&&a.push(r),a),[])}const Om={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:","},_o=ye((e,n)=>{const t=ge("MultiSelect",Om,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,size:c,value:u,defaultValue:g,onChange:m,onKeyDown:h,variant:p,data:f,dropdownOpened:v,defaultDropdownOpened:x,onDropdownOpen:b,onDropdownClose:w,selectFirstOptionOnChange:C,onOptionSubmit:j,comboboxProps:M,filter:k,limit:S,withScrollArea:T,maxDropdownHeight:N,searchValue:F,defaultSearchValue:E,onSearchChange:V,readOnly:L,disabled:B,onFocus:_,onBlur:D,radius:O,rightSection:P,rightSectionWidth:$,rightSectionPointerEvents:z,rightSectionProps:H,leftSection:ae,leftSectionWidth:ie,leftSectionPointerEvents:Q,leftSectionProps:se,inputContainer:te,inputWrapperOrder:Z,withAsterisk:I,labelProps:Y,descriptionProps:ce,errorProps:ee,wrapperProps:W,description:me,label:le,error:de,maxValues:K,searchable:A,nothingFoundMessage:ne,withCheckIcon:be,checkIconPosition:ve,hidePickedOptions:Se,withErrorStyles:we,name:U,form:q,id:oe,clearable:Ie,clearButtonProps:he,hiddenInputProps:X,placeholder:_e,hiddenInputValuesDivider:Oe,required:Xe,mod:ot,renderOption:et,onRemove:J,onClear:Ae,scrollAreaProps:$e,chevronColor:re,...Ke}=t,Le=Ns(oe),lt=ar(f),It=jo(lt),at=Co({opened:v,defaultOpened:x,onDropdownOpen:b,onDropdownClose:()=>{w==null||w(),at.resetSelectedOption()}}),{styleProps:kn,rest:{type:it,autoComplete:us,...tt}}=ru(Ke),[xe,mn]=$t({value:u,defaultValue:g,finalValue:[],onChange:m}),[Je,ct]=$t({value:F,defaultValue:E,finalValue:"",onChange:V}),gt=Ze=>{ct(Ze),at.resetSelectedOption()},Wt=Be({name:"MultiSelect",classes:{},props:t,classNames:o,styles:i,unstyled:l}),{resolvedClassNames:Kt,resolvedStyles:Hn}=_n({props:t,styles:i,classNames:o}),Ud=Ze=>{h==null||h(Ze),Ze.key===" "&&!A&&(Ze.preventDefault(),at.toggleDropdown()),Ze.key==="Backspace"&&Je.length===0&&xe.length>0&&(J==null||J(xe[xe.length-1]),mn(xe.slice(0,xe.length-1)))},Hd=xe?.map((Ze,Xo)=>{var ui,gi;return s.jsx(_s,{withRemoveButton:!L&&!((ui=It[Ze])!=null&&ui.disabled),onRemove:()=>{mn(xe.filter(qd=>Ze!==qd)),J==null||J(Ze)},unstyled:l,disabled:B,...Wt("pill"),children:((gi=It[Ze])==null?void 0:gi.label)||Ze},`${Ze}-${Xo}`)});y.useEffect(()=>{C&&at.selectFirstOption()},[C,Je]);const ci=s.jsx(Ve.ClearButton,{...he,onClear:()=>{Ae==null||Ae(),mn([]),gt("")}}),Gd=Em({data:lt,value:xe}),di=Ie&&xe.length>0&&!B&&!L;return s.jsxs(s.Fragment,{children:[s.jsxs(Ve,{store:at,classNames:Kt,styles:Hn,unstyled:l,size:c,readOnly:L,__staticSelector:"MultiSelect",onOptionSubmit:Ze=>{j==null||j(Ze),gt(""),at.updateSelectedOptionIndex("selected"),xe.includes(It[Ze].value)?(mn(xe.filter(Xo=>Xo!==It[Ze].value)),J==null||J(It[Ze].value)):xe.length<K&&mn([...xe,It[Ze].value])},...M,children:[s.jsx(Ve.DropdownTarget,{children:s.jsx(to,{...kn,__staticSelector:"MultiSelect",classNames:Kt,styles:Hn,unstyled:l,size:c,className:a,style:r,variant:p,disabled:B,radius:O,__defaultRightSection:s.jsx(Ve.Chevron,{size:c,error:de,unstyled:l,color:re}),__clearSection:ci,__clearable:di,rightSection:P,rightSectionPointerEvents:z||(ci?"all":"none"),rightSectionWidth:$,rightSectionProps:H,leftSection:ae,leftSectionWidth:ie,leftSectionPointerEvents:Q,leftSectionProps:se,inputContainer:te,inputWrapperOrder:Z,withAsterisk:I,labelProps:Y,descriptionProps:ce,errorProps:ee,wrapperProps:W,description:me,label:le,error:de,withErrorStyles:we,__stylesApiProps:{...t,rightSectionPointerEvents:z||(di?"all":"none"),multiline:!0},pointer:!A,onClick:()=>A?at.openDropdown():at.toggleDropdown(),"data-expanded":at.dropdownOpened||void 0,id:Le,required:Xe,mod:ot,children:s.jsxs(_s.Group,{disabled:B,unstyled:l,...Wt("pillsList"),children:[Hd,s.jsx(Ve.EventsTarget,{autoComplete:us,children:s.jsx(to.Field,{...tt,ref:n,id:Le,placeholder:_e,type:!A&&!_e?"hidden":"visible",...Wt("inputField"),unstyled:l,onFocus:Ze=>{_==null||_(Ze),A&&at.openDropdown()},onBlur:Ze=>{D==null||D(Ze),at.closeDropdown(),gt("")},onKeyDown:Ud,value:Je,onChange:Ze=>{gt(Ze.currentTarget.value),A&&at.openDropdown(),C&&at.selectFirstOption()},disabled:B,readOnly:L||!A,pointer:!A})})]})})}),s.jsx(fr,{data:Se?Gd:lt,hidden:L||B,filter:k,search:Je,limit:S,hiddenWhenEmpty:!ne,withScrollArea:T,maxDropdownHeight:N,filterOptions:A,value:xe,checkIconPosition:ve,withCheckIcon:be,nothingFoundMessage:ne,unstyled:l,labelId:le?`${Le}-label`:void 0,"aria-label":le?void 0:Ke["aria-label"],renderOption:et,scrollAreaProps:$e})]}),s.jsx(Ve.HiddenInput,{name:U,valuesDivider:Oe,value:xe,form:q,disabled:B,...X})]})});_o.classes={...Mn.classes,...Ve.classes};_o.displayName="@mantine/core/MultiSelect";function Yl(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(e);a<o.length;a++)n.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t}var es;(function(e){e.event="event",e.props="prop"})(es||(es={}));function vn(){}function Am(e){var n,t=void 0;return function(){for(var o=[],a=arguments.length;a--;)o[a]=arguments[a];return n&&o.length===n.length&&o.every(function(r,i){return r===n[i]})||(n=o,t=e.apply(void 0,o)),t}}function Ms(e){return!!(e||"").match(/\d/)}function xn(e){return e==null}function zm(e){return typeof e=="number"&&isNaN(e)}function Ql(e){return xn(e)||zm(e)||typeof e=="number"&&!isFinite(e)}function Xl(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function $m(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Lm(e,n,t){var o=$m(t),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(o,"$1"+n)}function Mi(e){var n=y.useRef(e);n.current=e;var t=y.useRef(function(){for(var o=[],a=arguments.length;a--;)o[a]=arguments[a];return n.current.apply(n,o)});return t.current}function Ir(e,n){n===void 0&&(n=!0);var t=e[0]==="-",o=t&&n;e=e.replace("-","");var a=e.split("."),r=a[0],i=a[1]||"";return{beforeDecimal:r,afterDecimal:i,hasNegation:t,addNegation:o}}function Vm(e){if(!e)return e;var n=e[0]==="-";n&&(e=e.substring(1,e.length));var t=e.split("."),o=t[0].replace(/^0+/,"")||"0",a=t[1]||"";return(n?"-":"")+o+(a?"."+a:"")}function Zl(e,n,t){for(var o="",a=t?"0":"",r=0;r<=n-1;r++)o+=e[r]||a;return o}function Ri(e,n){return Array(n+1).join(e)}function Jl(e){var n=e+"",t=n[0]==="-"?"-":"";t&&(n=n.substring(1));var o=n.split(/[eE]/g),a=o[0],r=o[1];if(r=Number(r),!r)return t+a;a=a.replace(".","");var i=1+r,l=a.length;return i<0?a="0."+Ri("0",Math.abs(i))+a:i>=l?a=a+Ri("0",i-l):a=(a.substring(0,i)||"0")+"."+a.substring(i),t+a}function Ni(e,n,t){if(["","-"].indexOf(e)!==-1)return e;var o=(e.indexOf(".")!==-1||t)&&n,a=Ir(e),r=a.beforeDecimal,i=a.afterDecimal,l=a.hasNegation,d=parseFloat("0."+(i||"0")),c=i.length<=n?"0."+i:d.toFixed(n),u=c.split("."),g=r;r&&Number(u[0])&&(g=r.split("").reverse().reduce(function(f,v,x){return f.length>x?(Number(f[0])+Number(v)).toString()+f.substring(1,f.length):v+f},u[0]));var m=Zl(u[1]||"",n,t),h=l?"-":"",p=o?".":"";return""+h+g+p+m}function Fn(e,n){if(e.value=e.value,e!==null){if(e.createTextRange){var t=e.createTextRange();return t.move("character",n),t.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(n,n),!0):(e.focus(),!1)}}var ec=Am(function(e,n){for(var t=0,o=0,a=e.length,r=n.length;e[t]===n[t]&&t<a;)t++;for(;e[a-1-o]===n[r-1-o]&&r-o>t&&a-o>t;)o++;return{from:{start:t,end:a-o},to:{start:t,end:r-o}}}),Bm=function(e,n){var t=Math.min(e.selectionStart,n);return{from:{start:t,end:e.selectionEnd},to:{start:t,end:n}}};function Um(e,n,t){return Math.min(Math.max(e,n),t)}function ta(e){return Math.max(e.selectionStart,e.selectionEnd)}function Hm(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Gm(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function qm(e){var n=e.currentValue,t=e.formattedValue,o=e.currentValueIndex,a=e.formattedValueIndex;return n[o]===t[a]}function Wm(e,n,t,o,a,r,i){i===void 0&&(i=qm);var l=a.findIndex(function(C){return C}),d=e.slice(0,l);!n&&!t.startsWith(d)&&(n=d,t=d+t,o=o+d.length);for(var c=t.length,u=e.length,g={},m=new Array(c),h=0;h<c;h++){m[h]=-1;for(var p=0,f=u;p<f;p++){var v=i({currentValue:t,lastValue:n,formattedValue:e,currentValueIndex:h,formattedValueIndex:p});if(v&&g[p]!==!0){m[h]=p,g[p]=!0;break}}}for(var x=o;x<c&&(m[x]===-1||!r(t[x]));)x++;var b=x===c||m[x]===-1?u:m[x];for(x=o-1;x>0&&m[x]===-1;)x--;var w=x===-1||m[x]===-1?0:m[x]+1;return w>b?b:o-w<b-o?w:b}function ki(e,n,t,o){var a=e.length;if(n=Um(n,0,a),o==="left"){for(;n>=0&&!t[n];)n--;n===-1&&(n=t.indexOf(!0))}else{for(;n<=a&&!t[n];)n++;n>a&&(n=t.lastIndexOf(!0))}return n===-1&&(n=a),n}function Km(e){for(var n=Array.from({length:e.length+1})?.map(function(){return!0}),t=0,o=n.length;t<o;t++)n[t]=!!(Ms(e[t])||Ms(e[t-1]));return n}function tc(e,n,t,o,a,r){r===void 0&&(r=vn);var i=Mi(function(p,f){var v,x;return Ql(p)?(x="",v=""):typeof p=="number"||f?(x=typeof p=="number"?Jl(p):p,v=o(x)):(x=a(p,void 0),v=o(x)),{formattedValue:v,numAsString:x}}),l=y.useState(function(){return i(xn(e)?n:e,t)}),d=l[0],c=l[1],u=Mi(function(p,f){p.formattedValue!==d.formattedValue&&c({formattedValue:p.formattedValue,numAsString:p.value}),r(p,f)}),g=e,m=t;xn(e)&&(g=d.numAsString,m=!0);var h=i(g,m);return y.useMemo(function(){c(h)},[h.formattedValue]),y.useEffect(function(){if(!xn(n)&&xn(e)&&d.formattedValue!==""){var p=parseFloat(d.numAsString);u({formattedValue:d.formattedValue,value:d.numAsString,floatValue:isNaN(p)?void 0:p},{event:void 0,source:es.props})}},[]),[d,u]}function Ym(e){return e.replace(/[^0-9]/g,"")}function Qm(e){return e}function Xm(e){var n=e.type;n===void 0&&(n="text");var t=e.displayType;t===void 0&&(t="input");var o=e.customInput,a=e.renderText,r=e.getInputRef,i=e.format;i===void 0&&(i=Qm);var l=e.removeFormatting;l===void 0&&(l=Ym);var d=e.defaultValue,c=e.valueIsNumericString,u=e.onValueChange,g=e.isAllowed,m=e.onChange;m===void 0&&(m=vn);var h=e.onKeyDown;h===void 0&&(h=vn);var p=e.onMouseUp;p===void 0&&(p=vn);var f=e.onFocus;f===void 0&&(f=vn);var v=e.onBlur;v===void 0&&(v=vn);var x=e.value,b=e.getCaretBoundary;b===void 0&&(b=Km);var w=e.isValidInputCharacter;w===void 0&&(w=Ms);var C=e.isCharacterSame,j=Yl(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),M=tc(x,d,!!c,i,l,u),k=M[0],S=k.formattedValue,T=k.numAsString,N=M[1],F=y.useRef(),E=y.useRef({formattedValue:S,numAsString:T}),V=function(K,A){E.current={formattedValue:K.formattedValue,numAsString:K.value},N(K,A)},L=y.useState(!1),B=L[0],_=L[1],D=y.useRef(null),O=y.useRef({setCaretTimeout:null,focusTimeout:null});y.useEffect(function(){return _(!0),function(){clearTimeout(O.current.setCaretTimeout),clearTimeout(O.current.focusTimeout)}},[]);var P=i,$=function(K,A){var ne=parseFloat(A);return{formattedValue:K,value:A,floatValue:isNaN(ne)?void 0:ne}},z=function(K,A,ne){K.selectionStart===0&&K.selectionEnd===K.value.length||(Fn(K,A),O.current.setCaretTimeout=setTimeout(function(){K.value===ne&&K.selectionStart!==A&&Fn(K,A)},0))},H=function(K,A,ne){return ki(K,A,b(K),ne)},ae=function(K,A,ne){var be=b(A),ve=Wm(A,S,K,ne,be,w,C);return ve=ki(A,ve,be),ve},ie=function(K){var A=K.formattedValue;A===void 0&&(A="");var ne=K.input,be=K.source,ve=K.event,Se=K.numAsString,we;if(ne){var U=K.inputValue||ne.value,q=ta(ne);ne.value=A,we=ae(U,A,q),we!==void 0&&z(ne,we,A)}A!==S&&V($(A,Se),{event:ve,source:be})};y.useEffect(function(){var K=E.current,A=K.formattedValue,ne=K.numAsString;(S!==A||T!==ne)&&V($(S,T),{event:void 0,source:es.props})},[S,T]);var Q=D.current?ta(D.current):void 0,se=typeof window<"u"?y.useLayoutEffect:y.useEffect;se(function(){var K=D.current;if(S!==E.current.formattedValue&&K){var A=ae(E.current.formattedValue,S,Q);K.value=S,z(K,A,S)}},[S]);var te=function(K,A,ne){var be=A.target,ve=F.current?Bm(F.current,be.selectionEnd):ec(S,K),Se=Object.assign(Object.assign({},ve),{lastValue:S}),we=l(K,Se),U=P(we);if(we=l(U,void 0),g&&!g($(U,we))){var q=A.target,oe=ta(q),Ie=ae(K,S,oe);return q.value=S,z(q,Ie,S),!1}return ie({formattedValue:U,numAsString:we,inputValue:K,event:A,source:ne,input:A.target}),!0},Z=function(K,A){A===void 0&&(A=0);var ne=K.selectionStart,be=K.selectionEnd;F.current={selectionStart:ne,selectionEnd:be+A}},I=function(K){var A=K.target,ne=A.value,be=te(ne,K,es.event);be&&m(K),F.current=void 0},Y=function(K){var A=K.target,ne=K.key,be=A.selectionStart,ve=A.selectionEnd,Se=A.value;Se===void 0&&(Se="");var we;ne==="ArrowLeft"||ne==="Backspace"?we=Math.max(be-1,0):ne==="ArrowRight"?we=Math.min(be+1,Se.length):ne==="Delete"&&(we=be);var U=0;ne==="Delete"&&be===ve&&(U=1);var q=ne==="ArrowLeft"||ne==="ArrowRight";if(we===void 0||be!==ve&&!q){h(K),Z(A,U);return}var oe=we;if(q){var Ie=ne==="ArrowLeft"?"left":"right";oe=H(Se,we,Ie),oe!==we&&K.preventDefault()}else ne==="Delete"&&!w(Se[we])?oe=H(Se,we,"right"):ne==="Backspace"&&!w(Se[we])&&(oe=H(Se,we,"left"));oe!==we&&z(A,oe,Se),h(K),Z(A,U)},ce=function(K){var A=K.target,ne=function(){var be=A.selectionStart,ve=A.selectionEnd,Se=A.value;if(Se===void 0&&(Se=""),be===ve){var we=H(Se,be);we!==be&&z(A,we,Se)}};ne(),requestAnimationFrame(function(){ne()}),p(K),Z(A)},ee=function(K){K.persist&&K.persist();var A=K.target,ne=K.currentTarget;D.current=A,O.current.focusTimeout=setTimeout(function(){var be=A.selectionStart,ve=A.selectionEnd,Se=A.value;Se===void 0&&(Se="");var we=H(Se,be);we!==be&&!(be===0&&ve===Se.length)&&z(A,we,Se),f(Object.assign(Object.assign({},K),{currentTarget:ne}))},0)},W=function(K){D.current=null,clearTimeout(O.current.focusTimeout),clearTimeout(O.current.setCaretTimeout),v(K)},me=B&&Hm()?"numeric":void 0,le=Object.assign({inputMode:me},j,{type:n,value:S,onChange:I,onKeyDown:Y,onMouseUp:ce,onFocus:ee,onBlur:W});if(t==="text")return a?In.createElement(In.Fragment,null,a(S,j)||null):In.createElement("span",Object.assign({},j,{ref:r}),S);if(o){var de=o;return In.createElement(de,Object.assign({},le,{ref:r}))}return In.createElement("input",Object.assign({},le,{ref:r}))}function Di(e,n){var t=n.decimalScale,o=n.fixedDecimalScale,a=n.prefix;a===void 0&&(a="");var r=n.suffix;r===void 0&&(r="");var i=n.allowNegative,l=n.thousandsGroupStyle;if(l===void 0&&(l="thousand"),e===""||e==="-")return e;var d=Mo(n),c=d.thousandSeparator,u=d.decimalSeparator,g=t!==0&&e.indexOf(".")!==-1||t&&o,m=Ir(e,i),h=m.beforeDecimal,p=m.afterDecimal,f=m.addNegation;return t!==void 0&&(p=Zl(p,t,!!o)),c&&(h=Lm(h,c,l)),a&&(h=a+h),r&&(p=p+r),f&&(h="-"+h),e=h+(g&&u||"")+p,e}function Mo(e){var n=e.decimalSeparator;n===void 0&&(n=".");var t=e.thousandSeparator,o=e.allowedDecimalSeparators;return t===!0&&(t=","),o||(o=[n,"."]),{decimalSeparator:n,thousandSeparator:t,allowedDecimalSeparators:o}}function Zm(e,n){e===void 0&&(e="");var t=new RegExp("(-)"),o=new RegExp("(-)(.)*(-)"),a=t.test(e),r=o.test(e);return e=e.replace(/-/g,""),a&&!r&&n&&(e="-"+e),e}function Jm(e,n){return new RegExp("(^-)|[0-9]|"+Xl(e),"g")}function eh(e,n,t){return e===""?!0:!(n!=null&&n.match(/\d/))&&!(t!=null&&t.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function th(e,n,t){var o;n===void 0&&(n=Gm(e));var a=t.allowNegative,r=t.prefix;r===void 0&&(r="");var i=t.suffix;i===void 0&&(i="");var l=t.decimalScale,d=n.from,c=n.to,u=c.start,g=c.end,m=Mo(t),h=m.allowedDecimalSeparators,p=m.decimalSeparator,f=e[g]===p;if(Ms(e)&&(e===r||e===i)&&n.lastValue==="")return e;if(g-u===1&&h.indexOf(e[u])!==-1){var v=l===0?"":p;e=e.substring(0,u)+v+e.substring(u+1,e.length)}var x=function(D,O,P){var $=!1,z=!1;r.startsWith("-")?$=!1:D.startsWith("--")?($=!1,z=!0):i.startsWith("-")&&D.length===i.length?$=!1:D[0]==="-"&&($=!0);var H=$?1:0;return z&&(H=2),H&&(D=D.substring(H),O-=H,P-=H),{value:D,start:O,end:P,hasNegation:$}},b=x(e,u,g),w=b.hasNegation;o=b,e=o.value,u=o.start,g=o.end;var C=x(n.lastValue,d.start,d.end),j=C.start,M=C.end,k=C.value,S=e.substring(u,g);e.length&&k.length&&(j>k.length-i.length||M<r.length)&&!(S&&i.startsWith(S))&&(e=k);var T=0;e.startsWith(r)?T+=r.length:u<r.length&&(T=u),e=e.substring(T),g-=T;var N=e.length,F=e.length-i.length;e.endsWith(i)?N=F:(g>F||g>e.length-i.length)&&(N=g),e=e.substring(0,N),e=Zm(w?"-"+e:e,a),e=(e.match(Jm(p))||[]).join("");var E=e.indexOf(p);e=e.replace(new RegExp(Xl(p),"g"),function(D,O){return O===E?".":""});var V=Ir(e,a),L=V.beforeDecimal,B=V.afterDecimal,_=V.addNegation;return c.end-c.start<d.end-d.start&&L===""&&f&&!parseFloat(B)&&(e=_?"-":""),e}function nh(e,n){var t=n.prefix;t===void 0&&(t="");var o=n.suffix;o===void 0&&(o="");var a=Array.from({length:e.length+1})?.map(function(){return!0}),r=e[0]==="-";a.fill(!1,0,Math.min(t.length+(r?1:0),e.length));var i=e.length;return a.fill(!1,i-o.length+1,i+1),a}function sh(e){var n=Mo(e),t=n.thousandSeparator,o=n.decimalSeparator,a=e.prefix;a===void 0&&(a="");var r=e.allowNegative;if(r===void 0&&(r=!0),t===o)throw new Error(`
Decimal separator can't be same as thousand separator.
thousandSeparator: `+t+` (thousandSeparator = {true} is same as thousandSeparator = ",")
decimalSeparator: `+o+` (default value for decimalSeparator is .)
`);return a.startsWith("-")&&r&&(r=!1),Object.assign(Object.assign({},e),{allowNegative:r})}function oh(e){e=sh(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var n=e.suffix,t=e.allowNegative,o=e.allowLeadingZeros,a=e.onKeyDown;a===void 0&&(a=vn);var r=e.onBlur;r===void 0&&(r=vn);var i=e.thousandSeparator,l=e.decimalScale,d=e.fixedDecimalScale,c=e.prefix;c===void 0&&(c="");var u=e.defaultValue,g=e.value,m=e.valueIsNumericString,h=e.onValueChange,p=Yl(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),f=Mo(e),v=f.decimalSeparator,x=f.allowedDecimalSeparators,b=function(_){return Di(_,e)},w=function(_,D){return th(_,D,e)},C=xn(g)?u:g,j=m??eh(C,c,n);xn(g)?xn(u)||(j=j||typeof u=="number"):j=j||typeof g=="number";var M=function(_){return Ql(_)?_:(typeof _=="number"&&(_=Jl(_)),j&&typeof l=="number"?Ni(_,l,!!d):_)},k=tc(M(g),M(u),!!j,b,w,h),S=k[0],T=S.numAsString,N=S.formattedValue,F=k[1],E=function(_){var D=_.target,O=_.key,P=D.selectionStart,$=D.selectionEnd,z=D.value;if(z===void 0&&(z=""),(O==="Backspace"||O==="Delete")&&$<c.length&&z!=="-"){_.preventDefault();return}if(P!==$){a(_);return}O==="Backspace"&&z[0]==="-"&&P===c.length+1&&t&&Fn(D,1),l&&d&&(O==="Backspace"&&z[P-1]===v?(Fn(D,P-1),_.preventDefault()):O==="Delete"&&z[P]===v&&_.preventDefault()),x!=null&&x.includes(O)&&z[P]===v&&Fn(D,P+1);var H=i===!0?",":i;O==="Backspace"&&z[P-1]===H&&Fn(D,P-1),O==="Delete"&&z[P]===H&&Fn(D,P+1),a(_)},V=function(_){var D=T;if(D.match(/\d/g)||(D=""),o||(D=Vm(D)),d&&l&&(D=Ni(D,l,d)),D!==T){var O=Di(D,e);F({formattedValue:O,value:D,floatValue:parseFloat(D)},{event:_,source:es.event})}r(_)},L=function(_){return _===v?!0:Ms(_)},B=function(_){var D=_.currentValue,O=_.lastValue,P=_.formattedValue,$=_.currentValueIndex,z=_.formattedValueIndex,H=D[$],ae=P[z],ie=ec(O,D),Q=ie.to,se=function(te){return w(te).indexOf(".")+c.length};return g===0&&d&&l&&D[Q.start]===v&&se(D)<$&&se(P)>z?!1:$>=Q.start&&$<Q.end&&x&&x.includes(H)&&ae===v?!0:H===ae};return Object.assign(Object.assign({},p),{value:N,valueIsNumericString:!1,isValidInputCharacter:L,isCharacterSame:B,onValueChange:F,format:b,removeFormatting:w,getCaretBoundary:function(_){return nh(_,e)},onKeyDown:E,onBlur:V})}function ah(e){var n=oh(e);return In.createElement(Xm,Object.assign({},n))}function Ti({direction:e,style:n,...t}){return s.jsx("svg",{style:{width:"var(--ni-chevron-size)",height:"var(--ni-chevron-size)",transform:e==="up"?"rotate(180deg)":void 0,...n},viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:s.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}var Ta={root:"m_e2f5cd4e",controls:"m_95e17d22",control:"m_80b4b171"};const rh=/^(0\.0*|-0(\.0*)?)$/,ih=/^-?0\d+(\.\d+)?\.?$/;function Ia(e){return typeof e=="string"&&e!==""&&!Number.isNaN(Number(e))}function na(e){return typeof e=="number"?e<Number.MAX_SAFE_INTEGER:e===""||Ia(e)&&Number(e)<Number.MAX_SAFE_INTEGER}function lh(e){return e.toString().replace(".","").length}function ch(e,n){return(typeof e=="number"?e<Number.MAX_SAFE_INTEGER:!Number.isNaN(Number(e)))&&!Number.isNaN(e)&&lh(n)<14&&n!==""}function Ii(e,n,t){if(e===void 0)return!0;const o=n===void 0||e>=n,a=t===void 0||e<=t;return o&&a}const dh={step:1,clampBehavior:"blur",allowDecimal:!0,allowNegative:!0,withKeyboardEvents:!0,allowLeadingZeros:!0,trimLeadingZeroesOnBlur:!0,startValue:0},uh=Ye((e,{size:n})=>({controls:{"--ni-chevron-size":Qe(n,"ni-chevron-size")}}));function gh(e,n,t){const o=e.toString().replace(/^0+/,""),a=parseFloat(o);return Number.isNaN(a)?o:a>Number.MAX_SAFE_INTEGER?n!==void 0?String(n):o:En(a,t,n)}const Fr=ye((e,n)=>{const t=ge("NumberInput",dh,e),{className:o,classNames:a,styles:r,unstyled:i,vars:l,onChange:d,onValueChange:c,value:u,defaultValue:g,max:m,min:h,step:p,hideControls:f,rightSection:v,isAllowed:x,clampBehavior:b,onBlur:w,allowDecimal:C,decimalScale:j,onKeyDown:M,onKeyDownCapture:k,handlersRef:S,startValue:T,disabled:N,rightSectionPointerEvents:F,allowNegative:E,readOnly:V,size:L,rightSectionWidth:B,stepHoldInterval:_,stepHoldDelay:D,allowLeadingZeros:O,withKeyboardEvents:P,trimLeadingZeroesOnBlur:$,...z}=t,H=Be({name:"NumberInput",classes:Ta,props:t,classNames:a,styles:r,unstyled:i,vars:l,varsResolver:uh}),{resolvedClassNames:ae,resolvedStyles:ie}=_n({classNames:a,styles:r,props:t}),[Q,se]=$t({value:u,defaultValue:g,finalValue:"",onChange:d}),te=D!==void 0&&_!==void 0,Z=y.useRef(null),I=y.useRef(null),Y=y.useRef(0),ce=(U,q)=>{q.source==="event"&&se(ch(U.floatValue,U.value)&&!rh.test(U.value)&&!(O&&ih.test(U.value))?U.floatValue:U.value),c==null||c(U,q)},ee=U=>{const q=String(U).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return q?Math.max(0,(q[1]?q[1].length:0)-(q[2]?+q[2]:0)):0},W=U=>{Z.current&&typeof U<"u"&&Z.current.setSelectionRange(U,U)},me=y.useRef(pi);me.current=()=>{if(!na(Q))return;let U;const q=ee(Q),oe=ee(p),Ie=Math.max(q,oe),he=10**Ie;if(!Ia(Q)&&(typeof Q!="number"||Number.isNaN(Q)))U=En(T,h,m);else if(m!==void 0){const _e=(Math.round(Number(Q)*he)+Math.round(p*he))/he;U=_e<=m?_e:m}else U=(Math.round(Number(Q)*he)+Math.round(p*he))/he;const X=U.toFixed(Ie);se(parseFloat(X)),c==null||c({floatValue:parseFloat(X),formattedValue:X,value:X},{source:"increment"}),setTimeout(()=>{var _e;return W((_e=Z.current)==null?void 0:_e.value.length)},0)};const le=y.useRef(pi);le.current=()=>{if(!na(Q))return;let U;const q=h!==void 0?h:E?Number.MIN_SAFE_INTEGER:0,oe=ee(Q),Ie=ee(p),he=Math.max(oe,Ie),X=10**he;if(!Ia(Q)&&typeof Q!="number"||Number.isNaN(Q))U=En(T,q,m);else{const Oe=(Math.round(Number(Q)*X)-Math.round(p*X))/X;U=q!==void 0&&Oe<q?q:Oe}const _e=U.toFixed(he);se(parseFloat(_e)),c==null||c({floatValue:parseFloat(_e),formattedValue:_e,value:_e},{source:"decrement"}),setTimeout(()=>{var Oe;return W((Oe=Z.current)==null?void 0:Oe.value.length)},0)};const de=U=>{M==null||M(U),!(V||!P)&&(U.key==="ArrowUp"&&(U.preventDefault(),me.current()),U.key==="ArrowDown"&&(U.preventDefault(),le.current()))},K=U=>{if(k==null||k(U),U.key==="Backspace"){const q=Z.current;q.selectionStart===0&&q.selectionStart===q.selectionEnd&&(U.preventDefault(),window.setTimeout(()=>W(0),0))}},A=U=>{let q=Q;b==="blur"&&typeof q=="number"&&(q=En(q,h,m)),$&&typeof q=="string"&&ee(q)<15&&(q=gh(q,m,h)),Q!==q&&se(q),w==null||w(U)};iu(S,{increment:me.current,decrement:le.current});const ne=U=>{U?me.current():le.current(),Y.current+=1},be=U=>{if(ne(U),te){const q=typeof _=="number"?_:_(Y.current);I.current=window.setTimeout(()=>be(U),q)}},ve=(U,q)=>{var oe;U.preventDefault(),(oe=Z.current)==null||oe.focus(),ne(q),te&&(I.current=window.setTimeout(()=>be(q),D))},Se=()=>{I.current&&window.clearTimeout(I.current),I.current=null,Y.current=0},we=s.jsxs("div",{...H("controls"),children:[s.jsx(Et,{...H("control"),tabIndex:-1,"aria-hidden":!0,disabled:N||typeof Q=="number"&&m!==void 0&&Q>=m,mod:{direction:"up"},onMouseDown:U=>U.preventDefault(),onPointerDown:U=>{ve(U,!0)},onPointerUp:Se,onPointerLeave:Se,children:s.jsx(Ti,{direction:"up"})}),s.jsx(Et,{...H("control"),tabIndex:-1,"aria-hidden":!0,disabled:N||typeof Q=="number"&&h!==void 0&&Q<=h,mod:{direction:"down"},onMouseDown:U=>U.preventDefault(),onPointerDown:U=>{ve(U,!1)},onPointerUp:Se,onPointerLeave:Se,children:s.jsx(Ti,{direction:"down"})})]});return s.jsx(Mn,{component:ah,allowNegative:E,className:je(Ta.root,o),size:L,...z,readOnly:V,disabled:N,value:Q,getInputRef:Sn(n,Z),onValueChange:ce,rightSection:f||V||!na(Q)?v:v||we,classNames:ae,styles:ie,unstyled:i,__staticSelector:"NumberInput",decimalScale:C?j:0,onKeyDown:de,onKeyDownCapture:K,rightSectionPointerEvents:F??(N?"none":void 0),rightSectionWidth:B??`var(--ni-right-section-width-${L||"sm"})`,allowLeadingZeros:O,onBlur:A,isAllowed:U=>b==="strict"?x?x(U)&&Ii(U.floatValue,h,m):Ii(U.floatValue,h,m):x?x(U):!0})});Fr.classes={...Mn.classes,...Ta};Fr.displayName="@mantine/core/NumberInput";const[mh,Ro]=os("Pagination.Root component was not found in tree");var Ts={root:"m_4addd315",control:"m_326d024a",dots:"m_4ad7767d"};const hh={withPadding:!0},Is=ye((e,n)=>{const t=ge("PaginationControl",hh,e),{classNames:o,className:a,style:r,styles:i,vars:l,active:d,disabled:c,withPadding:u,mod:g,...m}=t,h=Ro(),p=c||h.disabled;return s.jsx(Et,{ref:n,disabled:p,mod:[{active:d,disabled:p,"with-padding":u},g],...h.getStyles("control",{className:a,style:r,classNames:o,styles:i,active:!p}),...m})});Is.classes=Ts;Is.displayName="@mantine/core/PaginationControl";function Fs({style:e,children:n,path:t,...o}){return s.jsx("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)",...e},...o,children:s.jsx("path",{d:t,fill:"currentColor"})})}const ph=e=>s.jsx(Fs,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),fh=e=>s.jsx(Fs,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),vh=e=>s.jsx(Fs,{...e,path:"M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z"}),xh=e=>s.jsx(Fs,{...e,path:"M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z"}),bh=e=>s.jsx(Fs,{...e,path:"M2 8c0-.733.6-1.333 1.333-1.333.734 0 1.334.6 1.334 1.333s-.6 1.333-1.334 1.333C2.6 9.333 2 8.733 2 8zm9.333 0c0-.733.6-1.333 1.334-1.333C13.4 6.667 14 7.267 14 8s-.6 1.333-1.333 1.333c-.734 0-1.334-.6-1.334-1.333zM6.667 8c0-.733.6-1.333 1.333-1.333s1.333.6 1.333 1.333S8.733 9.333 8 9.333 6.667 8.733 6.667 8z"}),yh={icon:bh},No=ye((e,n)=>{const t=ge("PaginationDots",yh,e),{classNames:o,className:a,style:r,styles:i,vars:l,icon:d,...c}=t,u=Ro(),g=d;return s.jsx(G,{ref:n,...u.getStyles("dots",{className:a,style:r,styles:i,classNames:o}),...c,children:s.jsx(g,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}})})});No.classes=Ts;No.displayName="@mantine/core/PaginationDots";function ko({icon:e,name:n,action:t,type:o}){const a={icon:e},r=y.forwardRef((i,l)=>{const{icon:d,...c}=ge(n,a,i),u=d,g=Ro(),m=o==="next"?g.active===g.total:g.active===1;return s.jsx(Is,{disabled:g.disabled||m,ref:l,onClick:g[t],withPadding:!1,...c,children:s.jsx(u,{className:"mantine-rotate-rtl",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}})})});return r.displayName=`@mantine/core/${n}`,lu(r)}const nc=ko({icon:ph,name:"PaginationNext",action:"onNext",type:"next"}),sc=ko({icon:fh,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),oc=ko({icon:vh,name:"PaginationFirst",action:"onFirst",type:"previous"}),ac=ko({icon:xh,name:"PaginationLast",action:"onLast",type:"next"});function Pr({dotsIcon:e}){const n=Ro(),t=n.range?.map((o,a)=>{var r,i,l;return o==="dots"?s.jsx(No,{icon:e},a):s.jsx(Is,{active:o===n.active,"aria-current":o===n.active?"page":void 0,onClick:()=>n.onChange(o),disabled:n.disabled,...(r=n.getItemProps)==null?void 0:r.call(n,o),children:((l=(i=n.getItemProps)==null?void 0:i.call(n,o))==null?void 0:l.children)??o},a)});return s.jsx(s.Fragment,{children:t})}Pr.displayName="@mantine/core/PaginationItems";const wh={siblings:1,boundaries:1},jh=Ye((e,{size:n,radius:t,color:o,autoContrast:a})=>({root:{"--pagination-control-radius":t===void 0?void 0:Vt(t),"--pagination-control-size":Qe(n,"pagination-control-size"),"--pagination-control-fz":kt(n),"--pagination-active-bg":o?Yt(o,e):void 0,"--pagination-active-color":nr(a,e)?Ya({color:o,theme:e,autoContrast:a}):void 0}})),Do=ye((e,n)=>{const t=ge("PaginationRoot",wh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,total:c,value:u,defaultValue:g,onChange:m,disabled:h,siblings:p,boundaries:f,color:v,radius:x,onNextPage:b,onPreviousPage:w,onFirstPage:C,onLastPage:j,getItemProps:M,autoContrast:k,...S}=t,T=Be({name:"Pagination",classes:Ts,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:jh}),{range:N,setPage:F,next:E,previous:V,active:L,first:B,last:_}=cg({page:u,initialPage:g,onChange:m,total:c,siblings:p,boundaries:f}),D=bt(b,E),O=bt(w,V),P=bt(C,B),$=bt(j,_);return s.jsx(mh,{value:{total:c,range:N,active:L,disabled:h,getItemProps:M,onChange:F,onNext:D,onPrevious:O,onFirst:P,onLast:$,getStyles:T},children:s.jsx(G,{ref:n,...T("root"),...S})})});Do.classes=Ts;Do.displayName="@mantine/core/PaginationRoot";const Ch={withControls:!0,withPages:!0,siblings:1,boundaries:1,gap:8},Ht=ye((e,n)=>{const t=ge("Pagination",Ch,e),{withEdges:o,withControls:a,getControlProps:r,nextIcon:i,previousIcon:l,lastIcon:d,firstIcon:c,dotsIcon:u,total:g,gap:m,hideWithOnePage:h,withPages:p,...f}=t;return g<=0||h&&g===1?null:s.jsx(Do,{ref:n,total:g,...f,children:s.jsxs(Fe,{gap:m,children:[o&&s.jsx(oc,{icon:c,...r==null?void 0:r("first")}),a&&s.jsx(sc,{icon:l,...r==null?void 0:r("previous")}),p&&s.jsx(Pr,{dotsIcon:u}),a&&s.jsx(nc,{icon:i,...r==null?void 0:r("next")}),o&&s.jsx(ac,{icon:d,...r==null?void 0:r("last")})]})})});Ht.classes=Ts;Ht.displayName="@mantine/core/Pagination";Ht.Root=Do;Ht.Control=Is;Ht.Dots=No;Ht.First=oc;Ht.Last=ac;Ht.Next=nc;Ht.Previous=sc;Ht.Items=Pr;const[Sh,rc]=os("Progress.Root component was not found in tree");var Ps={root:"m_db6d6462",section:"m_2242eb65","stripes-animation":"m_81a374bd",label:"m_91e40b74"};const _h={},Er=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("ProgressLabel",_h,e),d=rc();return s.jsx(G,{ref:n,...d.getStyles("label",{className:o,style:a,classNames:t,styles:r}),...l})});Er.classes=Ps;Er.displayName="@mantine/core/ProgressLabel";const Mh={},Rh=Ye((e,{size:n,radius:t,transitionDuration:o})=>({root:{"--progress-size":Qe(n,"progress-size"),"--progress-radius":t===void 0?void 0:Vt(t),"--progress-transition-duration":typeof o=="number"?`${o}ms`:void 0}})),To=ye((e,n)=>{const t=ge("ProgressRoot",Mh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,autoContrast:c,transitionDuration:u,...g}=t,m=Be({name:"Progress",classes:Ps,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Rh});return s.jsx(Sh,{value:{getStyles:m,autoContrast:c},children:s.jsx(G,{ref:n,...m("root"),...g})})});To.classes=Ps;To.displayName="@mantine/core/ProgressRoot";const Nh={withAria:!0},Io=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,value:l,withAria:d,color:c,striped:u,animated:g,mod:m,...h}=ge("ProgressSection",Nh,e),p=rc(),f=An(),v=d?{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":l,"aria-valuetext":`${l}%`}:{};return s.jsx(G,{ref:n,...p.getStyles("section",{className:o,classNames:t,styles:r,style:a}),...h,...v,mod:[{striped:u||g,animated:g},m],__vars:{"--progress-section-width":`${l}%`,"--progress-section-color":Yt(c,f),"--progress-label-color":nr(p.autoContrast,f)?Ya({color:c,theme:f,autoContrast:p.autoContrast}):void 0}})});Io.classes=Ps;Io.displayName="@mantine/core/ProgressSection";const kh={},cs=ye((e,n)=>{const t=ge("Progress",kh,e),{value:o,classNames:a,styles:r,vars:i,color:l,striped:d,animated:c,"aria-label":u,...g}=t,{resolvedClassNames:m,resolvedStyles:h}=_n({classNames:a,styles:r,props:t});return s.jsx(To,{ref:n,classNames:m,styles:h,vars:i,...g,children:s.jsx(Io,{value:o,color:l,striped:d,animated:c,"aria-label":u})})});cs.classes=Ps;cs.displayName="@mantine/core/Progress";cs.Section=Io;cs.Root=To;cs.Label=Er;const Dh={searchable:!1,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:"left"},tn=ye((e,n)=>{const t=ge("Select",Dh,e),{classNames:o,styles:a,unstyled:r,vars:i,dropdownOpened:l,defaultDropdownOpened:d,onDropdownClose:c,onDropdownOpen:u,onFocus:g,onBlur:m,onClick:h,onChange:p,data:f,value:v,defaultValue:x,selectFirstOptionOnChange:b,onOptionSubmit:w,comboboxProps:C,readOnly:j,disabled:M,filter:k,limit:S,withScrollArea:T,maxDropdownHeight:N,size:F,searchable:E,rightSection:V,checkIconPosition:L,withCheckIcon:B,nothingFoundMessage:_,name:D,form:O,searchValue:P,defaultSearchValue:$,onSearchChange:z,allowDeselect:H,error:ae,rightSectionPointerEvents:ie,id:Q,clearable:se,clearButtonProps:te,hiddenInputProps:Z,renderOption:I,onClear:Y,autoComplete:ce,scrollAreaProps:ee,__defaultRightSection:W,__clearSection:me,__clearable:le,chevronColor:de,...K}=t,A=y.useMemo(()=>ar(f),[f]),ne=y.useMemo(()=>jo(A),[A]),be=Ns(Q),[ve,Se,we]=$t({value:v,defaultValue:x,finalValue:null,onChange:p}),U=typeof ve=="string"?ne[ve]:void 0,q=ug(U),[oe,Ie,he]=$t({value:P,defaultValue:$,finalValue:U?U.label:"",onChange:z}),X=Co({opened:l,defaultOpened:d,onDropdownOpen:()=>{u==null||u(),X.updateSelectedOptionIndex("active",{scrollIntoView:!0})},onDropdownClose:()=>{c==null||c(),X.resetSelectedOption()}}),_e=J=>{Ie(J),X.resetSelectedOption()},{resolvedClassNames:Oe,resolvedStyles:Xe}=_n({props:t,styles:a,classNames:o});y.useEffect(()=>{b&&X.selectFirstOption()},[b,oe]),y.useEffect(()=>{v===null&&_e(""),typeof v=="string"&&U&&((q==null?void 0:q.value)!==U.value||(q==null?void 0:q.label)!==U.label)&&_e(U.label)},[v,U]),y.useEffect(()=>{var J;!we&&!he&&_e(typeof ve=="string"&&((J=ne[ve])==null?void 0:J.label)||"")},[f,ve]);const ot=s.jsx(Ve.ClearButton,{...te,onClear:()=>{Se(null,null),_e(""),Y==null||Y()}}),et=se&&!!ve&&!M&&!j;return s.jsxs(s.Fragment,{children:[s.jsxs(Ve,{store:X,__staticSelector:"Select",classNames:Oe,styles:Xe,unstyled:r,readOnly:j,onOptionSubmit:J=>{w==null||w(J);const Ae=H&&ne[J].value===ve?null:ne[J],$e=Ae?Ae.value:null;$e!==ve&&Se($e,Ae),!we&&_e(typeof $e=="string"&&(Ae==null?void 0:Ae.label)||""),X.closeDropdown()},size:F,...C,children:[s.jsx(Ve.Target,{targetType:E?"input":"button",autoComplete:ce,children:s.jsx(Mn,{id:be,ref:n,__defaultRightSection:s.jsx(Ve.Chevron,{size:F,error:ae,unstyled:r,color:de}),__clearSection:ot,__clearable:et,rightSection:V,rightSectionPointerEvents:ie||(et?"all":"none"),...K,size:F,__staticSelector:"Select",disabled:M,readOnly:j||!E,value:oe,onChange:J=>{_e(J.currentTarget.value),X.openDropdown(),b&&X.selectFirstOption()},onFocus:J=>{E&&X.openDropdown(),g==null||g(J)},onBlur:J=>{var Ae;E&&X.closeDropdown(),_e(ve!=null&&((Ae=ne[ve])==null?void 0:Ae.label)||""),m==null||m(J)},onClick:J=>{E?X.openDropdown():X.toggleDropdown(),h==null||h(J)},classNames:Oe,styles:Xe,unstyled:r,pointer:!E,error:ae})}),s.jsx(fr,{data:A,hidden:j||M,filter:k,search:oe,limit:S,hiddenWhenEmpty:!_,withScrollArea:T,maxDropdownHeight:N,filterOptions:E&&(U==null?void 0:U.label)!==oe,value:ve,checkIconPosition:L,withCheckIcon:B,nothingFoundMessage:_,unstyled:r,labelId:K.label?`${be}-label`:void 0,"aria-label":K.label?void 0:K["aria-label"],renderOption:I,scrollAreaProps:ee})]}),s.jsx(Ve.HiddenInput,{value:ve,name:D,form:O,disabled:M,...Z})]})});tn.classes={...Mn.classes,...Ve.classes};tn.displayName="@mantine/core/Select";function Th({spacing:e,verticalSpacing:n,cols:t,selector:o}){var u;const a=An(),r=n===void 0?e:n,i=Wa({"--sg-spacing-x":xt(Kn(e)),"--sg-spacing-y":xt(Kn(r)),"--sg-cols":(u=Kn(t))==null?void 0:u.toString()}),l=Ks(a.breakpoints).reduce((g,m)=>(g[m]||(g[m]={}),typeof e=="object"&&e[m]!==void 0&&(g[m]["--sg-spacing-x"]=xt(e[m])),typeof r=="object"&&r[m]!==void 0&&(g[m]["--sg-spacing-y"]=xt(r[m])),typeof t=="object"&&t[m]!==void 0&&(g[m]["--sg-cols"]=t[m]),g),{}),c=og(Ks(l),a.breakpoints).filter(g=>Ks(l[g.value]).length>0)?.map(g=>({query:`(min-width: ${a.breakpoints[g.value]})`,styles:l[g.value]}));return s.jsx(qa,{styles:i,media:c,selector:o})}function sa(e){return typeof e=="object"&&e!==null?Ks(e):[]}function Ih(e){return e.sort((n,t)=>Js(n)-Js(t))}function Fh({spacing:e,verticalSpacing:n,cols:t}){const o=Array.from(new Set([...sa(e),...sa(n),...sa(t)]));return Ih(o)}function Ph({spacing:e,verticalSpacing:n,cols:t,selector:o}){var c;const a=n===void 0?e:n,r=Wa({"--sg-spacing-x":xt(Kn(e)),"--sg-spacing-y":xt(Kn(a)),"--sg-cols":(c=Kn(t))==null?void 0:c.toString()}),i=Fh({spacing:e,verticalSpacing:n,cols:t}),l=i.reduce((u,g)=>(u[g]||(u[g]={}),typeof e=="object"&&e[g]!==void 0&&(u[g]["--sg-spacing-x"]=xt(e[g])),typeof a=="object"&&a[g]!==void 0&&(u[g]["--sg-spacing-y"]=xt(a[g])),typeof t=="object"&&t[g]!==void 0&&(u[g]["--sg-cols"]=t[g]),u),{}),d=i?.map(u=>({query:`simple-grid (min-width: ${u})`,styles:l[u]}));return s.jsx(qa,{styles:r,container:d,selector:o})}var ic={container:"m_925c2d2c",root:"m_2415a157"};const Eh={cols:1,spacing:"md",type:"media"},bn=ye((e,n)=>{const t=ge("SimpleGrid",Eh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,cols:c,verticalSpacing:u,spacing:g,type:m,...h}=t,p=Be({name:"SimpleGrid",classes:ic,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d}),f=gl();return m==="container"?s.jsxs(s.Fragment,{children:[s.jsx(Ph,{...t,selector:`.${f}`}),s.jsx("div",{...p("container"),children:s.jsx(G,{ref:n,...p("root",{className:f}),...h})})]}):s.jsxs(s.Fragment,{children:[s.jsx(Th,{...t,selector:`.${f}`}),s.jsx(G,{ref:n,...p("root",{className:f}),...h})]})});bn.classes=ic;bn.displayName="@mantine/core/SimpleGrid";const[Oh,Fo]=os("SliderProvider was not found in tree"),lc=y.forwardRef(({size:e,disabled:n,variant:t,color:o,thumbSize:a,radius:r,...i},l)=>{const{getStyles:d}=Fo();return s.jsx(G,{tabIndex:-1,variant:t,size:e,ref:l,...d("root"),...i})});lc.displayName="@mantine/core/SliderRoot";const Fa=y.forwardRef(({max:e,min:n,value:t,position:o,label:a,dragging:r,onMouseDown:i,onKeyDownCapture:l,labelTransitionProps:d,labelAlwaysOn:c,thumbLabel:u,onFocus:g,onBlur:m,showLabelOnHover:h,isHovered:p,children:f=null,disabled:v},x)=>{const{getStyles:b}=Fo(),[w,C]=y.useState(!1),j=c||r||w||h&&p;return s.jsxs(G,{tabIndex:0,role:"slider","aria-label":u,"aria-valuemax":e,"aria-valuemin":n,"aria-valuenow":t,ref:x,__vars:{"--slider-thumb-offset":`${o}%`},...b("thumb",{focusable:!0}),mod:{dragging:r,disabled:v},onFocus:M=>{C(!0),typeof g=="function"&&g(M)},onBlur:M=>{C(!1),typeof m=="function"&&m(M)},onTouchStart:i,onMouseDown:i,onKeyDownCapture:l,onClick:M=>M.stopPropagation(),children:[f,s.jsx(ss,{mounted:a!=null&&!!j,transition:"fade",duration:0,...d,children:M=>s.jsx("div",{...b("label",{style:M}),children:a})})]})});Fa.displayName="@mantine/core/SliderThumb";function Pa({value:e,min:n,max:t}){const o=(e-n)/(t-n)*100;return Math.min(Math.max(o,0),100)}function Ah({mark:e,offset:n,value:t,inverted:o=!1}){return o?typeof n=="number"&&e.value<=n||e.value>=t:typeof n=="number"?e.value>=n&&e.value<=t:e.value<=t}function cc({marks:e,min:n,max:t,disabled:o,value:a,offset:r,inverted:i}){const{getStyles:l}=Fo();if(!e)return null;const d=e?.map((c,u)=>y.createElement(G,{...l("markWrapper"),__vars:{"--mark-offset":`${Pa({value:c.value,min:n,max:t})}%`},key:u},s.jsx(G,{...l("mark"),mod:{filled:Ah({mark:c,value:a,offset:r,inverted:i}),disabled:o}}),c.label&&s.jsx("div",{...l("markLabel"),children:c.label})));return s.jsx("div",{children:d})}cc.displayName="@mantine/core/SliderMarks";function dc({filled:e,children:n,offset:t,disabled:o,marksOffset:a,inverted:r,containerProps:i,...l}){const{getStyles:d}=Fo();return s.jsx(G,{...d("trackContainer"),mod:{disabled:o},...i,children:s.jsxs(G,{...d("track"),mod:{inverted:r,disabled:o},children:[s.jsx(G,{mod:{inverted:r,disabled:o},__vars:{"--slider-bar-width":`calc(${e}% + var(--slider-size))`,"--slider-bar-offset":`calc(${t}% - var(--slider-size))`},...d("bar")}),n,s.jsx(cc,{...l,offset:a,disabled:o,inverted:r})]})})}dc.displayName="@mantine/core/SliderTrack";function Fi({value:e,containerWidth:n,min:t,max:o,step:a,precision:r}){const l=(n?Math.min(Math.max(e,0),n)/n:e)*(o-t),d=(l!==0?Math.round(l/a)*a:0)+t,c=Math.max(d,t);return r!==void 0?Number(c.toFixed(r)):c}function pn(e,n){return parseFloat(e.toFixed(n))}function zh(e){if(!e)return 0;const n=e.toString().split(".");return n.length>1?n[1].length:0}function zs(e,n){const o=[...n].sort((a,r)=>a.value-r.value).find(a=>a.value>e);return o?o.value:e}function $s(e,n){const o=[...n].sort((a,r)=>r.value-a.value).find(a=>a.value<e);return o?o.value:e}function $h(e){const n=[...e].sort((t,o)=>t.value-o.value);return n.length>0?n[0].value:0}function Lh(e){const n=[...e].sort((t,o)=>t.value-o.value);return n.length>0?n[n.length-1].value:100}var uc={root:"m_dd36362e",label:"m_c9357328",thumb:"m_c9a9a60a",trackContainer:"m_a8645c2",track:"m_c9ade57f",bar:"m_38aeed47",markWrapper:"m_b7b0423a",mark:"m_dd33bc19",markLabel:"m_68c77a5b"};function Vh(e){return"TouchEvent"in window&&e instanceof window.TouchEvent?e.touches[0].clientX:e.clientX}const Bh=Ye((e,{size:n,color:t,thumbSize:o,radius:a})=>({root:{"--slider-size":Qe(n,"slider-size"),"--slider-color":t?Yt(t,e):void 0,"--slider-radius":a===void 0?void 0:Vt(a),"--slider-thumb-size":o!==void 0?At(o):"calc(var(--slider-size) * 2)"}})),Uh={min:0,max:100,minRange:10,step:1,marks:[],label:e=>e,labelTransitionProps:{transition:"fade",duration:0},labelAlwaysOn:!1,showLabelOnHover:!0,disabled:!1,scale:e=>e},Or=ye((e,n)=>{const t=ge("RangeSlider",Uh,e),{classNames:o,styles:a,value:r,onChange:i,onChangeEnd:l,size:d,min:c,max:u,minRange:g,maxRange:m,step:h,precision:p,defaultValue:f,name:v,marks:x,label:b,labelTransitionProps:w,labelAlwaysOn:C,thumbFromLabel:j,thumbToLabel:M,showLabelOnHover:k,thumbChildren:S,disabled:T,unstyled:N,scale:F,inverted:E,className:V,style:L,vars:B,hiddenInputProps:_,restrictToMarks:D,thumbProps:O,...P}=t,$=Be({name:"Slider",props:t,classes:uc,classNames:o,className:V,styles:a,style:L,vars:B,varsResolver:Bh,unstyled:N}),{dir:z}=$n(),[H,ae]=y.useState(-1),[ie,Q]=y.useState(!1),[se,te]=$t({value:r,defaultValue:f,finalValue:[c,u],onChange:i}),Z=y.useRef(se),I=y.useRef([]),Y=y.useRef(null),ce=y.useRef(void 0),ee=[Pa({value:se[0],min:c,max:u}),Pa({value:se[1],min:c,max:u})],W=p??zh(h),me=q=>{te(q),Z.current=q};y.useEffect(()=>{Array.isArray(r)&&(Z.current=r)},Array.isArray(r)?[r[0],r[1]]:[null,null]);const le=(q,oe,Ie)=>{if(oe===-1)return;const he=[...Z.current];if(D&&x){const X=gg(q,x?.map(et=>et.value)),_e=he[oe];he[oe]=X;const Oe=oe===0?1:0,Xe=Lh(x),ot=$h(x);X===Xe&&he[Oe]===Xe||X===ot&&he[Oe]===ot?he[oe]=_e:X===he[Oe]&&(_e>he[Oe]?he[Oe]=$s(X,x):he[Oe]=zs(X,x))}else he[oe]=q,oe===0&&(q>he[1]-(g-1e-9)&&(he[1]=Math.min(q+g,u)),q>(u-(g-1e-9)||c)&&(he[oe]=Z.current[oe]),he[1]-q>m&&(he[1]=q+m)),oe===1&&(q<he[0]+g&&(he[0]=Math.max(q-g,c)),q<he[0]+g&&(he[oe]=Z.current[oe]),q-he[0]>m&&(he[0]=q-m));if(he[0]=pn(he[0],W),he[1]=pn(he[1],W),he[0]>he[1]){const X=he[0];he[0]=he[1],he[1]=X}me(he),Ie&&(l==null||l(Z.current))},de=q=>{if(!T){const oe=Fi({value:q,min:c,max:u,step:h,precision:W});le(oe,ce.current,!1)}},{ref:K,active:A}=lg(({x:q})=>de(q),{onScrubEnd:()=>!T&&(l==null?void 0:l(Z.current))},z);function ne(q){ce.current=q}const be=q=>{K.current.focus();const oe=K.current.getBoundingClientRect(),Ie=Vh(q.nativeEvent),he=Fi({value:Ie-oe.left,max:u,min:c,step:h,containerWidth:oe.width}),X=Math.abs(se[0]-he)>Math.abs(se[1]-he)?1:0,_e=z==="ltr"?X:X===1?0:1;ce.current=_e},ve=()=>H!==1&&H!==0?(ae(0),0):H,Se=q=>{if(!T)switch(q.key){case"ArrowUp":{q.preventDefault();const oe=ve();I.current[oe].focus();const Ie=D&&x?zs(Z.current[oe],x):Math.min(Math.max(Z.current[oe]+h,c),u);le(pn(Ie,W),oe,!0);break}case"ArrowRight":{q.preventDefault();const oe=ve();I.current[oe].focus();const Ie=D&&x?(z==="rtl"?$s:zs)(Z.current[oe],x):Math.min(Math.max(z==="rtl"?Z.current[oe]-h:Z.current[oe]+h,c),u);le(pn(Ie,W),oe,!0);break}case"ArrowDown":{q.preventDefault();const oe=ve();I.current[oe].focus();const Ie=D&&x?$s(Z.current[oe],x):Math.min(Math.max(Z.current[oe]-h,c),u);le(pn(Ie,W),oe,!0);break}case"ArrowLeft":{q.preventDefault();const oe=ve();I.current[oe].focus();const Ie=D&&x?(z==="rtl"?zs:$s)(Z.current[oe],x):Math.min(Math.max(z==="rtl"?Z.current[oe]+h:Z.current[oe]-h,c),u);le(pn(Ie,W),oe,!0);break}}},we={max:u,min:c,size:d,labelTransitionProps:w,labelAlwaysOn:C,onBlur:()=>ae(-1)},U=Array.isArray(S);return s.jsx(Oh,{value:{getStyles:$},children:s.jsxs(lc,{...P,size:d,ref:Sn(n,Y),disabled:T,onMouseDownCapture:()=>{var q;return(q=Y.current)==null?void 0:q.focus()},onKeyDownCapture:()=>{var q,oe,Ie;(oe=(q=I.current[0])==null?void 0:q.parentElement)!=null&&oe.contains(document.activeElement)||(Ie=I.current[0])==null||Ie.focus()},children:[s.jsxs(dc,{offset:ee[0],marksOffset:se[0],filled:ee[1]-ee[0],marks:x,inverted:E,min:c,max:u,value:se[1],disabled:T,containerProps:{ref:K,onMouseEnter:k?()=>Q(!0):void 0,onMouseLeave:k?()=>Q(!1):void 0,onTouchStartCapture:be,onTouchEndCapture:()=>{ce.current=-1},onMouseDownCapture:be,onMouseUpCapture:()=>{ce.current=-1},onKeyDownCapture:Se},children:[s.jsx(Fa,{...we,value:F(se[0]),position:ee[0],dragging:A,label:typeof b=="function"?b(pn(F(se[0]),W)):b,ref:q=>{I.current[0]=q},thumbLabel:j,onMouseDown:()=>ne(0),onFocus:()=>ae(0),showLabelOnHover:k,isHovered:ie,disabled:T,...O==null?void 0:O(0),children:U?S[0]:S}),s.jsx(Fa,{...we,thumbLabel:M,value:F(se[1]),position:ee[1],dragging:A,label:typeof b=="function"?b(pn(F(se[1]),W)):b,ref:q=>{I.current[1]=q},onMouseDown:()=>ne(1),onFocus:()=>ae(1),showLabelOnHover:k,isHovered:ie,disabled:T,...O==null?void 0:O(1),children:U?S[1]:S})]}),s.jsx("input",{type:"hidden",name:`${v}_from`,value:se[0],..._}),s.jsx("input",{type:"hidden",name:`${v}_to`,value:se[1],..._})]})})});Or.classes=uc;Or.displayName="@mantine/core/RangeSlider";var gc={root:"m_6d731127"};const Hh={gap:"md",align:"stretch",justify:"flex-start"},Gh=Ye((e,{gap:n,align:t,justify:o})=>({root:{"--stack-gap":xt(n),"--stack-align":t,"--stack-justify":o}})),fe=ye((e,n)=>{const t=ge("Stack",Hh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,align:c,justify:u,gap:g,variant:m,...h}=t,p=Be({name:"Stack",props:t,classes:gc,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Gh});return s.jsx(G,{ref:n,...p("root"),variant:m,...h})});fe.classes=gc;fe.displayName="@mantine/core/Stack";const[qh,Wh]=os("Table component was not found in the tree");var Es={table:"m_b23fa0ef",th:"m_4e7aa4f3",tr:"m_4e7aa4fd",td:"m_4e7aa4ef",tbody:"m_b2404537",thead:"m_b242d975",caption:"m_9e5a3ac7",scrollContainer:"m_a100c15",scrollContainerInner:"m_62259741"};function Kh(e,n){if(!n)return;const t={};return n.columnBorder&&e.withColumnBorders&&(t["data-with-column-border"]=!0),n.rowBorder&&e.withRowBorders&&(t["data-with-row-border"]=!0),n.striped&&e.striped&&(t["data-striped"]=e.striped),n.highlightOnHover&&e.highlightOnHover&&(t["data-hover"]=!0),n.captionSide&&e.captionSide&&(t["data-side"]=e.captionSide),n.stickyHeader&&e.stickyHeader&&(t["data-sticky"]=!0),t}function Bn(e,n){const t=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,o=ye((a,r)=>{const i=ge(t,{},a),{classNames:l,className:d,style:c,styles:u,...g}=i,m=Wh();return s.jsx(G,{component:e,ref:r,...Kh(m,n),...m.getStyles(e,{className:d,classNames:l,style:c,styles:u,props:i}),...g})});return o.displayName=`@mantine/core/${t}`,o.classes=Es,o}const ts=Bn("th",{columnBorder:!0}),Os=Bn("td",{columnBorder:!0}),an=Bn("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),Ar=Bn("thead",{stickyHeader:!0}),bs=Bn("tbody"),zr=Bn("tfoot"),mc=Bn("caption",{captionSide:!0});function $r({data:e}){return s.jsxs(s.Fragment,{children:[e.caption&&s.jsx(mc,{children:e.caption}),e.head&&s.jsx(Ar,{children:s.jsx(an,{children:e.head?.map((n,t)=>s.jsx(ts,{children:n},t))})}),e.body&&s.jsx(bs,{children:e.body?.map((n,t)=>s.jsx(an,{children:n?.map((o,a)=>s.jsx(Os,{children:o},a))},t))}),e.foot&&s.jsx(zr,{children:s.jsx(an,{children:e.foot?.map((n,t)=>s.jsx(ts,{children:n},t))})})]})}$r.displayName="@mantine/core/TableDataRenderer";const Yh={type:"scrollarea"},Qh=Ye((e,{minWidth:n,maxHeight:t,type:o})=>({scrollContainer:{"--table-min-width":At(n),"--table-max-height":At(t),"--table-overflow":o==="native"?"auto":void 0}})),Lr=ye((e,n)=>{const t=ge("TableScrollContainer",Yh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,children:c,minWidth:u,maxHeight:g,type:m,scrollAreaProps:h,...p}=t,f=Be({name:"TableScrollContainer",classes:Es,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Qh,rootSelector:"scrollContainer"});return s.jsx(G,{component:m==="scrollarea"?io:"div",...m==="scrollarea"?g?{offsetScrollbars:"xy",...h}:{offsetScrollbars:"x",...h}:{},ref:n,...f("scrollContainer"),...p,children:s.jsx("div",{...f("scrollContainerInner"),children:c})})});Lr.classes=Es;Lr.displayName="@mantine/core/TableScrollContainer";const Xh={withRowBorders:!0,verticalSpacing:7},Zh=Ye((e,{layout:n,captionSide:t,horizontalSpacing:o,verticalSpacing:a,borderColor:r,stripedColor:i,highlightOnHoverColor:l,striped:d,highlightOnHover:c,stickyHeaderOffset:u,stickyHeader:g})=>({table:{"--table-layout":n,"--table-caption-side":t,"--table-horizontal-spacing":xt(o),"--table-vertical-spacing":xt(a),"--table-border-color":r?Yt(r,e):void 0,"--table-striped-color":d&&i?Yt(i,e):void 0,"--table-highlight-on-hover-color":c&&l?Yt(l,e):void 0,"--table-sticky-header-offset":g?At(u):void 0}})),Gt=ye((e,n)=>{const t=ge("Table",Xh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,horizontalSpacing:c,verticalSpacing:u,captionSide:g,stripedColor:m,highlightOnHoverColor:h,striped:p,highlightOnHover:f,withColumnBorders:v,withRowBorders:x,withTableBorder:b,borderColor:w,layout:C,variant:j,data:M,children:k,stickyHeader:S,stickyHeaderOffset:T,mod:N,tabularNums:F,...E}=t,V=Be({name:"Table",props:t,className:a,style:r,classes:Es,classNames:o,styles:i,unstyled:l,rootSelector:"table",vars:d,varsResolver:Zh});return s.jsx(qh,{value:{getStyles:V,stickyHeader:S,striped:p===!0?"odd":p||void 0,highlightOnHover:f,withColumnBorders:v,withRowBorders:x,captionSide:g||"bottom"},children:s.jsx(G,{component:"table",variant:j,ref:n,mod:[{"data-with-table-border":b,"data-tabular-nums":F},N],...V("table"),...E,children:k||!!M&&s.jsx($r,{data:M})})})});Gt.classes=Es;Gt.displayName="@mantine/core/Table";Gt.Td=Os;Gt.Th=ts;Gt.Tr=an;Gt.Thead=Ar;Gt.Tbody=bs;Gt.Tfoot=zr;Gt.Caption=mc;Gt.ScrollContainer=Lr;Gt.DataRenderer=$r;var hc={root:"m_7341320d"};const Jh={},ep=Ye((e,{size:n,radius:t,variant:o,gradient:a,color:r,autoContrast:i})=>{const l=e.variantColorResolver({color:r||e.primaryColor,theme:e,gradient:a,variant:o||"filled",autoContrast:i});return{root:{"--ti-size":Qe(n,"ti-size"),"--ti-radius":t===void 0?void 0:Vt(t),"--ti-bg":r||o?l.background:void 0,"--ti-color":r||o?l.color:void 0,"--ti-bd":r||o?l.border:void 0}}}),Vr=ye((e,n)=>{const t=ge("ThemeIcon",Jh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,autoContrast:c,...u}=t,g=Be({name:"ThemeIcon",classes:hc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:ep});return s.jsx(G,{ref:n,...g("root"),...u})});Vr.classes=hc;Vr.displayName="@mantine/core/ThemeIcon";const Pi=({selectedOrgId:e,onSelectOrganization:n,organizations:t=[],isLoading:o=!1,searchQuery:a="",onCreateUnit:r,canCreateUnitForOrg:i})=>{const l=Bt(),[d,c]=y.useState(null),u=t.filter(g=>a?l(g.name).toLowerCase().includes(a.toLowerCase()):!0);return s.jsx("div",{className:"flex flex-col gap-2 min-h-[400px]",children:o?s.jsx("div",{className:"flex justify-center items-center h-full",children:s.jsx("p",{children:R("organization.loading")})}):u.length>0?u?.map(g=>{const m=i?i(g.id):!1;return s.jsxs("div",{className:wn("flex items-center justify-between p-2 rounded-md cursor-pointer group",g.id===e?"bg-primary-50 text-primary-700":"hover:bg-primary-50 hover:text-primary-700"),onClick:()=>n(g.id),children:[s.jsx("div",{className:"flex-1",children:s.jsx("span",{className:wn("text-sm",g.id===e?"font-medium":""),children:l(g.name)})}),r&&s.jsxs(lo,{open:d===g.id,onOpenChange:h=>c(h?g.id:null),children:[s.jsx(co,{asChild:!0,children:s.jsx(He,{variant:"ghost",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",onClick:h=>h.stopPropagation(),children:s.jsx(Ja,{className:"h-4 w-4"})})}),s.jsxs(uo,{align:"end",className:"w-[180px]",onClick:h=>h.stopPropagation(),children:[s.jsx(Qa,{children:"Actions"}),s.jsxs(ut,{disabled:!m,onClick:()=>{c(null),r(g.id)},children:[s.jsx(Ss,{className:"mr-2 h-4 w-4"}),R("contentManagement.createUnit","Create Unit")]})]})]})]},g.id)}):s.jsx("div",{className:"flex flex-col items-center justify-center h-full text-gray-400",children:s.jsx("p",{className:"text-sm",children:R("contentManagement.noOrg")})})})},tp=({unit:e,onAddDepartment:n,onEditUnit:t,onDeleteUnit:o,onAddFromSubCity:a,showAlways:r=!1})=>{var h;const{user:i}=Xa(),l=(h=i==null?void 0:i.roles)==null?void 0:h?.some(p=>p.key==="unit_admin"),[d,c]=y.useState(!1),u=Bt(),g=p=>{c(!1),p&&p(e.id)},m=p=>{if(c(!1),p){const f=u(e.name);p(e.id,f)}};return s.jsx("div",{className:r?"opacity-100":"opacity-0 group-hover:opacity-100",children:s.jsxs(lo,{open:d,onOpenChange:c,children:[s.jsx(co,{asChild:!0,children:s.jsx(He,{variant:"ghost",className:"h-8 w-8 p-0",children:s.jsx(Ja,{className:"h-4 w-4"})})}),s.jsxs(uo,{align:"end",className:"w-[160px]",children:[s.jsx(Qa,{children:"Actions"}),s.jsxs(ut,{onClick:()=>g(n),children:[s.jsx(Ss,{className:"mr-2 h-4 w-4"}),R("contentManagement.addDepartment")]}),s.jsxs(ut,{onClick:()=>g(t),children:[s.jsx(Ss,{className:"mr-2 h-4 w-4"}),R("contentManagement.editUnit")]}),l&&a&&s.jsxs(ut,{onClick:()=>g(a),children:[s.jsx(cu,{className:"mr-2 h-4 w-4"}),R("contentManagement.addFromSubCity","Add From Sub City")]}),o&&s.jsxs(ut,{onClick:()=>m(o),className:"text-red-600 focus:text-red-700",children:[s.jsx(yl,{className:"mr-2 h-4 w-4"}),R("contentManagement.deleteUnit")]})]})]})})},Ei=({selectedUnitId:e,onSelectUnit:n,units:t=[],isLoading:o=!1,searchQuery:a="",onAddDepartment:r,onEditUnit:i,onDeleteUnit:l,onAddFromSubCity:d})=>{const[c,u]=y.useState(null),[g,m]=y.useState(null),h=y.useRef(null),p=Bt(),f=t.filter(x=>a?p(x.name).toLowerCase().includes(a.toLowerCase()):!0),v=(x,b)=>{if(x===e)return;g&&clearTimeout(g);const w=setTimeout(()=>{n(x,b)},200);m(w)};return s.jsxs("div",{className:"flex flex-col gap-2 h-[50vh] overflow-y-auto",ref:h,children:[o&&f.length===0?s.jsxs("div",{className:"flex justify-center items-center h-full gap-2 text-gray-500 dark:text-gray-400",children:[s.jsx(Rt,{className:"w-4 h-4 animate-spin"}),s.jsx("p",{children:R("organization.loading")})]}):f.length>0?f?.map(x=>s.jsxs("div",{className:wn("flex items-center justify-between p-2 rounded-md cursor-pointer group",x.id===e?"bg-primary-50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-primary-50 dark:hover:bg-primary-900/20 hover:text-primary-700 dark:hover:text-primary-300 text-gray-800 dark:text-gray-200"),onMouseEnter:()=>u(x.id),onMouseLeave:()=>u(null),onClick:()=>v(x.id,t),children:[s.jsx("div",{className:"flex-1",children:s.jsx("span",{className:wn("text-sm",x.id===e?"font-medium":""),children:p(x.name)})}),s.jsx(tp,{unit:x,onAddDepartment:r,onEditUnit:i,onDeleteUnit:x.isRelated?void 0:l,onAddFromSubCity:d,showAlways:c===x.id||x.id===e})]},x.id)):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[s.jsx(Ml,{className:"w-6 h-6"}),s.jsx("p",{className:"text-sm",children:R("contentManagement.noUnit")})]}),o&&t.length>0&&s.jsxs("div",{className:"flex justify-center py-2 text-gray-500 dark:text-gray-400 text-sm",children:[s.jsx(Rt,{className:"w-4 h-4 animate-spin mr-2"}),R("organization.loading")]})]})},np=({department:e,positions:n,onAddUser:t,onAddPosition:o,onAddSubDepartment:a,onAssignUser:r,onEditDepartment:i,onDeleteDepartment:l,onArchiveDepartment:d,onMoveDepartment:c,showAlways:u=!1})=>{const[g,m]=y.useState(!1),h=Bt(),p=f=>{f&&f(e.id,h(e.name)),m(!1)};return s.jsx("div",{className:u?"opacity-100":"opacity-0 group-hover:opacity-100",children:s.jsxs(lo,{open:g,onOpenChange:m,children:[s.jsx(co,{asChild:!0,children:s.jsx(He,{variant:"ghost",className:"h-8 w-8 p-0",children:s.jsx(Ja,{className:"h-4 w-4"})})}),s.jsxs(uo,{align:"end",children:[s.jsx(Qa,{children:"Actions"}),s.jsxs(ut,{onClick:()=>p(t),children:[s.jsx(wl,{className:"mr-2 h-4 w-4"}),R("contentManagement.addUser")]}),s.jsxs(ut,{onClick:()=>p(r),children:[s.jsx(pl,{className:"mr-2 h-4 w-4"}),R("organization.assignUser")]}),s.jsxs(ut,{onClick:()=>p(a),children:[s.jsx(Ss,{className:"mr-2 h-4 w-4"}),R("contentManagement.addSubdepartement")]}),s.jsxs(ut,{onClick:()=>p(i),children:[s.jsx(wu,{className:"mr-2 h-4 w-4"}),R("contentManagement.editDepartment")]}),s.jsxs(ut,{onClick:()=>p(c),className:"text-black-600 focus:black-red-700",children:[s.jsx(Zu,{className:"mr-2 h-4 w-4"}),R("contentManagement.moveDepartment")]}),d&&s.jsxs(ut,{onClick:()=>p(d),className:"text-amber-700 focus:text-amber-800",children:[s.jsx(du,{className:"mr-2 h-4 w-4"}),R("contentManagement.archiveDepartment","Archive Department")]}),s.jsxs(ut,{onClick:()=>p(l),className:"text-red-600 focus:text-red-700",children:[s.jsx(yl,{className:"mr-2 h-4 w-4"}),R("contentManagement.deleteDepartment")]})]})]})})},Oi=({unitId:e,selectedDepartmentId:n,onSelectDepartment:t,departments:o=[],positions:a,isLoading:r=!1,searchQuery:i="",onAddUser:l,onViewUsers:d,onAddPosition:c,onAddSubDepartment:u,onEditDepartment:g,onDeleteDepartment:m,onArchiveDepartment:h,onDelegate:p,onAssignUser:f,onMoveDepartment:v})=>{const[x,b]=y.useState(null),[w,C]=y.useState({}),j=Bt(),M=N=>i?N.filter(F=>{const V=j(F.name).toLowerCase().includes(i.toLowerCase()),L=F.children&&F.children.length>0?M(F.children).length>0:!1;return V||L})?.map(F=>({...F,children:F.children?M(F.children):void 0})):N,k=M(o),S=N=>{C(F=>({...F,[N]:!F[N]}))},T=(N,F=0)=>{var _,D,O,P;const E=N.id===n,V=x===N.id,L=w[N.id]??N.isExpanded,B=(((_=N.children)==null?void 0:_.length)??0)>0||(((D=N.positions)==null?void 0:D.length)??0)>0;return s.jsxs("div",{className:wn("flex flex-col gap-1 group",F>0&&"ml-4"),children:[s.jsxs("div",{className:wn("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700",E&&"bg-gray-100 dark:bg-gray-700",!E&&"text-gray-800 dark:text-gray-200"),onClick:()=>t(N.id,[]),children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B?s.jsx("button",{onClick:$=>{$.stopPropagation(),S(N.id)},className:"w-4 h-4 flex items-center justify-center",children:L?s.jsx(uu,{className:"w-4 h-4"}):s.jsx(eo,{className:"w-4 h-4"})}):s.jsx(xi,{className:"w-4 h-4"}),s.jsx("span",{children:j(N.name)})]}),s.jsx(np,{department:N,positions:a,onAddUser:l,onViewUsers:d,onAddPosition:c,onAddSubDepartment:u,onDelegate:p,onAssignUser:f,onEditDepartment:g,onDeleteDepartment:m,onArchiveDepartment:h,onMoveDepartment:v})]}),L&&B&&s.jsxs("div",{children:[(O=N.children)==null?void 0:O?.map($=>T($,F+1)),(P=N.positions)==null?void 0:P?.map($=>s.jsxs("div",{className:wn("flex items-center gap-2 text-sm py-1 pl-8 border-l-2 border-primary-100 dark:border-primary-800 ml-4 text-gray-800 dark:text-gray-200",w[$.id]?"bg-blue-50 dark:bg-blue-900/20":"hover:bg-blue-50 dark:hover:bg-blue-900/20"),onClick:()=>S($.id),children:[s.jsx(xi,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),s.jsx("span",{children:$.name.am||$.name.en}),s.jsx("div",{className:"flex-1"}),V&&s.jsxs("div",{className:"flex gap-2 pr-2",children:[s.jsx(wl,{className:"w-4 h-4 text-gray-500 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400",onClick:z=>{z.stopPropagation(),l==null||l($.id,$.name.en)}}),s.jsx(Yu,{className:"w-4 h-4 text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400",onClick:z=>{z.stopPropagation(),c==null||c($.id,"sub")}}),s.jsx(pl,{className:"w-4 h-4 text-gray-500 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400",onClick:z=>{z.stopPropagation(),p==null||p($.id)}})]})]},$.id))]})]},N.id)};return s.jsx("div",{className:"flex flex-col gap-1 min-h-[400px]",children:r?s.jsxs("div",{className:"flex justify-center items-center h-full gap-2 text-gray-500 dark:text-gray-400",children:[s.jsx(Rt,{className:"w-4 h-4 animate-spin"}),s.jsx("p",{children:R("organization.loading")})]}):k.length>0?k?.map(N=>T(N)):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[s.jsx(Ml,{className:"w-6 h-6"}),s.jsx("p",{className:"text-sm",children:i?R("search.noResults"):R("userIncoming.No Department")})]})})},sp={accepted:{bg:"bg-primary-100 dark:bg-primary-900/40",text:"text-primary-800 dark:text-primary-300",icon:s.jsx(mu,{className:"h-3 w-3 mr-1"})},pending:{bg:"bg-yellow-100 dark:bg-yellow-900/40",text:"text-yellow-800 dark:text-yellow-300",icon:s.jsx(gu,{className:"h-3 w-3 mr-1"})},"Not Invited":{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-800 dark:text-gray-300",icon:s.jsx(ks,{className:"h-3 w-3 mr-1"})}},Ea=({departmentId:e,departmentName:n,employees:t=[],isLoading:o=!1,searchQuery:a="",onEditEmployee:r,onInviteEmployee:i,onDeleteEmployee:l,onDeactivateTeamMember:d})=>{const[c,u]=y.useState(null),[g,m]=y.useState(!1),[h,p]=y.useState(!1),[f,v]=y.useState(""),[x,b]=y.useState(""),[w,C]=y.useState(""),[j,M]=y.useState(""),[k,S]=y.useState(""),[T,N]=y.useState(!1),[F,E]=y.useState(""),[V,L]=y.useState(""),[B,_]=y.useState({}),D=Bt(),O=t.filter(I=>{if(!a)return!0;const Y=D(I.user.name),ce=I.user.email||"",ee=I.user.username||"",W=I.user.phoneNumber||"",me=a.toLowerCase();return Y.toLowerCase().includes(me)||ce.toLowerCase().includes(me)||ee.toLowerCase().includes(me)||W.toLowerCase().includes(me)}),P=I=>{const Y={bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-700 dark:text-gray-300",icon:null},ce=sp[I]??Y;return s.jsxs(jl,{className:wn("text-xs flex items-center px-2 py-1",ce.bg,ce.text),children:[ce.icon,s.jsx("span",{children:I})]})},$=I=>I.user.hasSetPassword?"accepted":"pending",z=I=>{i&&i(I)},H=I=>{u(I),m(!0)},ae=I=>{var Y;u(I),p(!0),L((Y=I==null?void 0:I.user)==null?void 0:Y.id)},ie=I=>{const Y=I.trim().split(" ");return Y.length===1?Y[0][0]:`${Y[0][0]}${Y[1][0]}`};y.useEffect(()=>{h&&c&&(v((c==null?void 0:c.user.username)??""),b((c==null?void 0:c.user.email)??""),C((c==null?void 0:c.user.name.en)??""),M((c==null?void 0:c.user.name.am)??""),S((c==null?void 0:c.user.phoneNumber)??""),_({}),E(""))},[h,c]);const Q=async I=>{I.preventDefault();const Y={};if(x!=null&&x.trim()||(Y.email=R("profile.emailRequired")),f!=null&&f.trim()||(Y.userName=R("profile.usernameRequired")),k!=null&&k.trim()||(Y.phoneNumber=R("profile.phoneRequired")),w!=null&&w.trim()||(Y.englishName=R("profile.englishNameRequired")),j!=null&&j.trim()||(Y.amharicName=R("profile.amharicNameRequired")),_(Y),Object.keys(Y).length>0)return;if(!/^(\+2519\d{8}|09\d{8})$/.test(k??"")){E(R("profile.invalidPhoneFormat")),Pe.error(R("profile.invalidPhoneFormat"),{description:R("profile.validPhoneFormat")});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x??"")){E(R("profile.invalidEmailFormat")),Pe.error(R("profile.invalidEmailFormat"),{description:R("profile.validEmailFormat")});return}N(!0);try{await ju({email:x,username:f,phoneNumber:k,name:{am:j,en:w}},V),Pe.success(R("profile.profileUpdateSuccess"),{description:R("profile.profileUpdated")})}catch(W){const me=(W==null?void 0:W.message)||R("profile.profileUpdateFailed");E(me),Pe.error(R("profile.profileUpdateFailed"),{description:me})}finally{N(!1)}},se=({employee:I})=>{const Y=$(I),ce=Y==="pending",ee=Y==="Not Invited";return s.jsxs(lo,{children:[s.jsx(co,{asChild:!0,children:s.jsx(He,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-gray-100 dark:hover:bg-gray-700",onClick:W=>W.stopPropagation(),children:s.jsx(Mu,{className:"h-4 w-4"})})}),s.jsxs(uo,{align:"end",className:"w-48",children:[s.jsxs(ut,{onClick:W=>{W.stopPropagation(),H(I)},className:"cursor-pointer",children:[s.jsx(Ru,{className:"h-4 w-4 mr-2"}),R("viewDetail.viewDetail")]}),s.jsxs(ut,{onClick:W=>{W.stopPropagation(),ae(I)},className:"cursor-pointer",children:[s.jsx(hu,{className:"h-4 w-4 mr-2"}),R("common.Edit")]}),i&&(ce||ee)&&s.jsxs(ut,{onClick:W=>{W.stopPropagation(),z(I)},className:"cursor-pointer",children:[s.jsx(vi,{className:"h-4 w-4 mr-2"}),ce?R("Resend Invite"):R("Send Invite")]}),l&&s.jsxs(ut,{onClick:W=>{var le,de;W.stopPropagation();const me=typeof I.user.name=="string"?I.user.name:((le=I.user.name)==null?void 0:le.en)||((de=I.user.name)==null?void 0:de.am)||"User";l(e,n,I.id,me)},className:"cursor-pointer text-red-600 focus:text-red-600",children:[s.jsx(ks,{className:"h-4 w-4 mr-2"}),R("signatureUpload.remove")]}),d&&s.jsxs(ut,{onClick:W=>{var le,de;W.stopPropagation();const me=typeof I.user.name=="string"?I.user.name:((le=I.user.name)==null?void 0:le.en)||((de=I.user.name)==null?void 0:de.am)||"User";d(I.id,me)},className:"cursor-pointer text-red-600 focus:text-red-600",children:[s.jsx(ng,{className:"h-4 w-4 mr-2"}),R("common.DeactivateUser")]})]})]})},te=I=>{const Y=$(I);return s.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-100 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors rounded-md gap-3 group",children:[s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer flex-1 min-w-0",onClick:()=>H(I),children:[s.jsx(Zo,{className:"h-10 w-10 border border-gray-200 dark:border-gray-600 shrink-0",children:s.jsx(Jo,{className:"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300",children:ie(D(I.user.name)).toUpperCase()})}),s.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[s.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 truncate",children:D(I.user.name)}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500 dark:text-gray-400 truncate",children:[s.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[s.jsx(Ft,{className:"h-3 w-3"}),I.user.userType||"Employee"]}),s.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[s.jsx(_u,{className:"h-3 w-3"}),I.user.phoneNumber||"Employee"]})]}),s.jsx("div",{className:"mt-1",children:P(Y)})]})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(se,{employee:I})})]},I.user.id)},Z=()=>o?s.jsx("div",{className:"flex justify-center py-10",children:s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 border-4 border-t-blue-500 border-blue-200 rounded-full animate-spin mb-2"}),s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading team members..."})]})}):O.length>0?s.jsx("div",{className:"space-y-2",children:O?.map(te)}):t.length>0&&O.length===0?s.jsxs("div",{className:"text-center py-10 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50 rounded-md",children:[s.jsx(Ft,{className:"h-12 w-12 mx-auto mb-2 text-gray-300 dark:text-gray-500"}),s.jsx("p",{className:"text-sm font-medium dark:text-gray-300",children:R("search.noResults")}),s.jsx("p",{className:"text-xs mt-1 text-gray-400 dark:text-gray-500",children:R("search.tryDifferentKeywords")})]}):s.jsxs("div",{className:"text-center py-10 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50 rounded-md",children:[s.jsx(Ft,{className:"h-12 w-12 mx-auto mb-2 text-gray-300 dark:text-gray-500"}),s.jsx("p",{className:"text-sm font-medium dark:text-gray-300",children:e?R("contentManagement.msg1"):R("contentManagement.msg2")}),s.jsx("p",{className:"text-xs mt-1 text-gray-400 dark:text-gray-500",children:e?R("contentManagement.msg3"):R("contentManagement.msg4")})]});return s.jsxs("div",{className:"w-full",children:[Z(),s.jsx(yt,{open:g,onOpenChange:I=>m(I),children:s.jsxs(wt,{className:"sm:max-w-md dark:bg-gray-800",children:[s.jsx(jt,{children:s.jsx(Ct,{className:"text-center dark:text-white",children:R("contentManagement.userDetail")})}),c&&s.jsxs("div",{className:"flex flex-col items-center space-y-4 py-4",children:[s.jsx(Zo,{className:"w-20 h-20 border-2 border-gray-200 dark:border-gray-600",children:s.jsx(Jo,{className:"text-xl bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300",children:ie(D(c.user.name)).toUpperCase()})}),s.jsxs("div",{className:"text-center",children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:D(c.user.name)}),s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:c.user.userType||"Employee"}),$(c)&&s.jsx("div",{className:"mt-2 flex justify-center",children:P($(c))})]}),s.jsxs("div",{className:"w-full space-y-3 mt-4",children:[s.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400",children:s.jsx(Ft,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:R("organization.username")}),s.jsx("p",{className:"font-medium text-gray-800 dark:text-gray-200",children:c.user.username||"Not provided"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-400",children:s.jsx(Su,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:R("organization.email")}),s.jsx("p",{className:"font-medium text-gray-800 dark:text-gray-200",children:c.user.email||"Not provided"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-400",children:s.jsx(eg,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:R("organization.phoneNumber")}),s.jsx("p",{className:"font-medium text-gray-800 dark:text-gray-200",children:c.user.phoneNumber})]})]})]})]})]})}),s.jsx(yt,{open:h,onOpenChange:I=>p(I),children:s.jsxs(wt,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden dark:bg-gray-800",children:[s.jsx(jt,{children:s.jsx(Ct,{className:"text-center dark:text-white",children:R("contentManagement.editEmployee")})}),c&&s.jsxs("div",{className:"flex flex-col items-center space-y-4 py-4",children:[s.jsx(Zo,{className:"w-20 h-20 border-2 border-gray-200 dark:border-gray-600",children:s.jsx(Jo,{className:"text-xl bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300",children:ie(D(c.user.name)).toUpperCase()})}),s.jsxs("div",{className:"text-center",children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:D(c.user.name)}),s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:c.user.userType||"Employee"}),$(c)&&s.jsx("div",{className:"mt-2 flex justify-center",children:P($(c))})]}),s.jsxs(Cu.form,{initial:"hidden",animate:"show",className:"space-y-5 mt-6 w-full",onSubmit:Q,children:[s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Ft,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:R("organization.username")}),s.jsx(ze,{placeholder:R("profile.username"),value:f,onChange:I=>v(I.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.userName&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.userName})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Ft,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:R("profile.englishName")}),s.jsx(ze,{placeholder:R("profile.englishName"),value:w,onChange:I=>C(I.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.englishName&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.englishName})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Ft,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:R("profile.amharicName")}),s.jsx(ze,{placeholder:R("profile.amharicName"),value:j,onChange:I=>M(I.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.amharicName&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.amharicName})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Ft,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:R("organization.email")}),s.jsx(ze,{placeholder:R("profile.email"),value:x,onChange:I=>b(I.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.email&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.email})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Ft,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:R("organization.phoneNumber")}),s.jsx(ze,{placeholder:R("profile.phoneNumber"),value:k,onChange:I=>S(I.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.phoneNumber&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.phoneNumber})]})]}),s.jsx(He,{type:"submit",className:"w-full h-11 bg-primary hover:bg-primary-700 text-white font-medium text-sm shadow-md rounded-lg",disabled:T,children:T?s.jsxs("span",{className:"flex items-center justify-center",children:[s.jsx(vi,{className:"animate-spin h-5 w-5 mr-2"}),R("profile.updating"),"..."]}):R("profile.updateProfile")})]})]})]})})]})};function op({unitId:e,organizationId:n,onSuccess:t,onCancel:o}){const{createPosition:a,isCreating:r}=Ln(),{commonPositionTypes:i,isLoading:l}=er({unitId:e}),[d,c]=y.useState(""),[u,g]=y.useState(""),[m,h]=y.useState(""),[p,f]=y.useState(""),v=Jt.language,[x,b]=y.useState({}),w=()=>{const j={};return d.trim()||(j.nameEn=R("organization.englishNameRequired")),u.trim()||(j.nameAm=R("organization.amharicNameRequired")),m.trim()||(j.key=R("contentManagement.keyRequired")),p||(j.positionTypeId=R("contentManagement.selectPosType")),b(j),Object.keys(j).length===0},C=j=>{if(j.preventDefault(),!w()){Pe.error(R("contentManagement.invalidMsg"));return}const M={name:{en:d.trim(),am:u.trim()},key:m.trim().toLowerCase().replace(/\s+/g,"-"),unitId:e,organizationId:n,positionTypeId:p};a({payload:M,successCallback:()=>{Pe.success(R("contentManagement.success"),{description:`${R("userIncoming.Department")} "${v==="en"?d:u}" ${R("contentManagement.msg")}`}),t(v==="en"?d.trim():u.trim())}})};return s.jsxs("form",{onSubmit:C,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"positionType",children:R("organization.positionTypes")}),s.jsxs(cn,{onValueChange:j=>{f(j),b(M=>({...M,positionTypeId:""}))},value:p,disabled:l,children:[s.jsx(dn,{children:s.jsx(un,{placeholder:R("contentManagement.selectPosType")})}),s.jsx(gn,{className:"max-h-60 overflow-y-auto",children:i?.map(j=>s.jsx(Ot,{value:j.id,children:v==="en"?j.name.en:j.name.am},j.id))})]}),x.positionTypeId&&s.jsx("p",{className:"text-red-500 text-sm",children:x.positionTypeId})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameEn",children:R("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:R("organization.enterEnglishName"),value:d,onChange:j=>{c(j.target.value),b(M=>({...M,nameEn:""}))}}),x.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:x.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameAm",children:R("organization.enterAmharicName")}),s.jsx(ze,{id:"nameAm",placeholder:R("organization.enterAmharicName"),value:u,onChange:j=>{g(j.target.value),b(M=>({...M,nameAm:""}))}}),x.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:x.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"key",children:R("contentManagement.key")}),s.jsx(ze,{id:"key",placeholder:"e.g. finance-department",value:m,onChange:j=>{h(j.target.value),b(M=>({...M,key:""}))}}),x.key&&s.jsx("p",{className:"text-red-500 text-sm",children:x.key})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:o,disabled:r,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:r,children:r?R("organization.adding"):R("contentManagement.addDepartment")})]})]})}function ap({isOpen:e,onClose:n,organizationId:t,unitId:o}){const a=r=>{n()};return s.jsx(yt,{open:e,onOpenChange:r=>!r&&n(),children:s.jsxs(wt,{className:"sm:max-w-[425px]",children:[s.jsx(jt,{children:s.jsx(Ct,{children:R("contentManagement.addDepartment")})}),s.jsx(op,{unitId:o,organizationId:t,onSuccess:a,onCancel:n})]})})}function rp({unitId:e,onSuccess:n,onCancel:t}){const[o,a]=y.useState({firstName:"",lastName:"",email:"",role:"member"}),[r,i]=y.useState(!1),{toast:l}=bl();Jt.language;const d=g=>{const{name:m,value:h}=g.target;a(p=>({...p,[m]:h}))},c=g=>{a(m=>({...m,role:g}))},u=async g=>{if(g.preventDefault(),!o.firstName.trim()||!o.lastName.trim()||!o.email.trim()){l({title:"Error",description:"All fields are required",variant:"destructive"});return}i(!0);try{await new Promise(m=>setTimeout(m,500)),l({title:R("contentManagement.success"),description:`${R("contentManagement.user")} ${o.firstName} ${o.lastName}${R("contentManagement.msg")}`}),n()}catch{l({title:"Error",description:"Failed to add user. Please try again.",variant:"destructive"})}finally{i(!1)}};return s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"firstName",children:R("contentManagement.firstName")}),s.jsx(ze,{id:"firstName",name:"firstName",placeholder:R("contentManagement.firstName"),value:o.firstName,onChange:d,required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"lastName",children:R("contentManagement.lastName")}),s.jsx(ze,{id:"lastName",name:"lastName",placeholder:R("contentManagement.lastName"),value:o.lastName,onChange:d,required:!0})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"email",children:R("organization.email")}),s.jsx(ze,{id:"email",name:"email",type:"email",placeholder:R("organization.email"),value:o.email,onChange:d,required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"role",children:"Role"}),s.jsxs(cn,{value:o.role,onValueChange:c,children:[s.jsx(dn,{children:s.jsx(un,{placeholder:"Select a role"})}),s.jsxs(gn,{children:[s.jsx(Ot,{value:"Director",children:"Director"}),s.jsx(Ot,{value:"Teamleader",children:"Teamleader"}),s.jsx(Ot,{value:"deputy",children:"deputy"})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:t,disabled:r,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:r,children:r?R("organization.adding"):R("organization.addUser")})]})]})}function ip({isOpen:e,onClose:n,unitId:t}){const o=()=>{n()};return s.jsx(yt,{open:e,onOpenChange:a=>!a&&n(),children:s.jsxs(wt,{className:"sm:max-w-[500px]",children:[s.jsx(jt,{children:s.jsx(Ct,{children:"Add New User"})}),s.jsx(rp,{unitId:t,onSuccess:o,onCancel:n})]})})}function lp({unitId:e,onClose:n}){const[t,o]=y.useState([]),[a,r]=y.useState(!0),[i,l]=y.useState("");y.useEffect(()=>{(async()=>{r(!0);try{await new Promise(g=>setTimeout(g,800)),o([{id:"1",name:"Abebe Kebede",email:"abebe@example.com",role:"Admin",department:"Management"},{id:"2",name:"Tigist Haile",email:"tigist@example.com",role:"Manager",department:"Finance"},{id:"3",name:"Dawit Mekonnen",email:"dawit@example.com",role:"Member",department:"Operations"},{id:"4",name:"Hanna Girma",email:"hanna@example.com",role:"Member",department:"HR"}])}catch{o([])}finally{r(!1)}})()},[e]);const d=t.filter(u=>{if(!i)return!0;const g=i.toLowerCase();return u.name.toLowerCase().includes(g)||u.email.toLowerCase().includes(g)||u.role.toLowerCase().includes(g)||u.department&&u.department.toLowerCase().includes(g)}),c=u=>{switch(u.toLowerCase()){case"admin":return"bg-red-100 text-red-800";case"manager":return"bg-blue-100 text-blue-800";default:return"bg-primary-100 text-primary-800"}};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500"}),s.jsx(ze,{placeholder:"Search users...",className:"pl-8",value:i,onChange:u=>l(u.target.value)})]}),s.jsx("div",{className:"border rounded-md overflow-hidden dark:border-gray-700",children:a?s.jsx("div",{className:"flex justify-center items-center p-8",children:s.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Loading users..."})}):d.length>0?s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Name"}),s.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Email"}),s.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Role"}),s.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Department"})]})}),s.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:d?.map(u=>s.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[s.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-gray-900 dark:text-gray-100",children:u.name}),s.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-gray-500 dark:text-gray-400",children:u.email}),s.jsx("td",{className:"px-4 py-2 whitespace-nowrap",children:s.jsx(jl,{className:c(u.role),children:u.role})}),s.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-gray-500 dark:text-gray-400",children:u.department||"-"})]},u.id))})]}):s.jsx("div",{className:"flex justify-center items-center p-8 text-gray-500",children:"No users found"})}),s.jsx("div",{className:"flex justify-end",children:s.jsx(He,{onClick:n,children:"Close"})})]})}function cp({isOpen:e,onClose:n,unitId:t,unitName:o}){return s.jsx(yt,{open:e,onOpenChange:a=>!a&&n(),children:s.jsxs(wt,{className:"sm:max-w-[800px] max-h-[80vh] overflow-y-auto",children:[s.jsx(jt,{children:s.jsx(Ct,{children:o?`Users in ${o}`:"Team Members"})}),s.jsx(lp,{unitId:t,onClose:n})]})})}function dp({departmentId:e,departmentName:n,organizationId:t,unitId:o,onSuccess:a,onCancel:r}){const{createPosition:i,isCreating:l}=Ln(),{commonPositionTypes:d,isLoading:c}=er({unitId:o,params:{take:1e3,skip:0,orderBy:"createdAt:Desc"}}),[u,g]=y.useState(""),[m,h]=y.useState(""),[p,f]=y.useState(""),[v,x]=y.useState(""),b=Jt.language,[w,C]=y.useState({}),j=()=>{const S={};return u.trim()||(S.nameEn=R("organization.englishNameRequired")),m.trim()||(S.nameAm=R("organization.amharicNameRequired")),p.trim()||(S.key=R("contentManagement.keyRequired")),v||(S.positionTypeId=R("contentManagement.selectPosType")),C(S),Object.keys(S).length===0},M=S=>{if(S.preventDefault(),!j()){Pe.error(R("contentManagement.invalidMsg"));return}const T={name:{en:u.trim(),am:m.trim()},key:p.trim().toLowerCase().replace(/\s+/g,"-"),unitId:o,organizationId:t,parentPositionId:e,positionTypeId:v};i({payload:T,successCallback:()=>{a(u.trim()),Pe.success(R("contentManagement.success"),{description:`${R("contentManagement.subDep")} "${b==="en"?u:m}${R("contentManagement.msg")}`})}})},k=Bt();return s.jsxs("form",{onSubmit:M,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"parentDepartment",children:R("contentManagement.parentDep")}),s.jsx(ze,{id:"parentDepartment",value:n,disabled:!0,className:"bg-gray-50"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"positionType",children:R("organization.positionTypes")}),s.jsxs(cn,{onValueChange:S=>{x(S),C(T=>({...T,positionTypeId:""}))},value:v,disabled:c,children:[s.jsx(dn,{children:s.jsx(un,{placeholder:R("contentManagement.selectPosType")})}),s.jsx(gn,{className:"max-h-60 overflow-y-auto",children:d?.map(S=>s.jsx(Ot,{value:S.id,children:k(S.name)},S.id))})]}),w.positionTypeId&&s.jsx("p",{className:"text-red-500 text-sm",children:w.positionTypeId})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameEn",children:R("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:R("organization.enterEnglishName"),value:u,onChange:S=>{g(S.target.value),C(T=>({...T,nameEn:""}))}}),w.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:w.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameAm",children:R("organization.enterAmharicName")}),s.jsx(ze,{id:"nameAm",placeholder:R("organization.enterAmharicName"),value:m,onChange:S=>{h(S.target.value),C(T=>({...T,nameAm:""}))}}),w.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:w.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"key",children:R("contentManagement.key")}),s.jsx(ze,{id:"key",placeholder:R("contentManagement.key"),value:p,onChange:S=>{f(S.target.value),C(T=>({...T,key:""}))}}),w.key&&s.jsx("p",{className:"text-red-500 text-sm",children:w.key})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:r,disabled:l,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:l,children:l?R("organization.adding"):R("contentManagement.addSubdepartement")})]})]})}function up({isOpen:e,onClose:n,departmentId:t,organizationId:o,unitId:a,departmentName:r}){const i=l=>{n()};return s.jsx(yt,{open:e,onOpenChange:l=>!l&&n(),children:s.jsxs(wt,{className:"sm:max-w-[425px]",children:[s.jsx(jt,{children:s.jsx(Ct,{children:"Add New Sub-Department"})}),s.jsx(dp,{departmentId:t,departmentName:r,organizationId:o,unitId:a,onSuccess:i,onCancel:n})]})})}function gp({unitId:e,positionId:n,positionName:t,onSuccess:o,onCancel:a}){const{assignEmployee:r,isAssigning:i}=go(),{employeesResponse:l,isLoading:d}=ku({unitId:e}),{handleError:c}=pu(R),[u,g]=y.useState(""),[m,h]=y.useState({}),[p,f]=y.useState(1),[v,x]=y.useState(""),b=20,w=(l==null?void 0:l.items)||[],C=Jt.language,j=y.useMemo(()=>v.trim()?w.filter(S=>{var F,E;const T=C==="en"?(F=S.name)==null?void 0:F.en:(E=S.name)==null?void 0:E.am,N=S.email||"";return(T==null?void 0:T.toLowerCase().includes(v.toLowerCase()))||N.toLowerCase().includes(v.toLowerCase())}):w,[w,v,C]),M=S=>{const{scrollTop:T,scrollHeight:N,clientHeight:F}=S.currentTarget;T+F>=N-5&&p*b<j.length&&f(E=>E+1)},k=async S=>{if(S.preventDefault(),!u){h({selectedUser:R("contentManagement.userRequired")}),Pe.error(R("contentManagement.userRequiredMsg"));return}const T=u;if(!T){Pe.error(R("contentManagement.userError"));return}r({positionId:n,employeeId:T},{onSuccess:()=>{Pe.success(R("contentManagement.userSuccess")),o()},onError:F=>{c(F)}})};return s.jsxs("form",{onSubmit:k,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"user",children:R("contentManagement.selectUser")}),s.jsxs(cn,{value:u,onValueChange:S=>{g(S),h(T=>({...T,selectedUser:""}))},disabled:d,children:[s.jsx(dn,{children:s.jsx(un,{placeholder:R("contentManagement.selectUser")})}),s.jsxs(gn,{style:{maxHeight:"300px",overflowY:"auto"},onScroll:M,children:[s.jsx("div",{className:"sticky top-0 z-10 bg-background p-2 border-b",children:s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4"}),s.jsx(ze,{type:"text",placeholder:R("organization.searchUsers"),value:v,onChange:S=>{S.stopPropagation(),x(S.target.value),f(1)},onClick:S=>S.stopPropagation(),className:"pl-10 h-9 text-sm"})]})}),j.length>0?j.slice(0,p*b)?.map(S=>{var T,N;return s.jsx(Ot,{value:S==null?void 0:S.id,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:C==="en"?(T=S.name)==null?void 0:T.en:((N=S.name)==null?void 0:N.am)||S.email||"Unnamed User"}),S.email&&s.jsx("span",{className:"text-xs text-gray-500",children:S.email})]})},S.id)}):s.jsx("div",{className:"text-center py-4 text-sm text-muted-foreground",children:v?R("organization.noUsersFound"):R("organization.noUsersAvailable")}),d&&s.jsx("div",{className:"text-center py-2 text-sm text-muted-foreground",children:R("contentManagement.loading")})]})]}),m.selectedUser&&s.jsx("p",{className:"text-red-500 text-sm",children:m.selectedUser})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{children:R("organization.Position")}),s.jsx("div",{className:"px-3 py-2 border rounded text-sm text-muted-foreground bg-muted",children:t||"Unknown"})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:a,disabled:i,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:i||d,children:i?"Assigning...":"Assign User"})]})]})}function mp({isOpen:e,onClose:n,departmentId:t,departmentName:o,unitId:a}){const r=()=>{n()};return s.jsx(yt,{open:e,onOpenChange:i=>!i&&n(),children:s.jsxs(wt,{className:"sm:max-w-[600px] max-h-[80vh] overflow-y-auto",children:[s.jsx(jt,{children:s.jsxs(Ct,{children:["Assign User to ",o]})}),s.jsx("div",{className:"mt-4",children:s.jsx(gp,{positionId:t,unitId:a,positionName:o,onSuccess:r,onCancel:n})})]})})}const hp=({currentOrgId:e})=>{const[n,t]=y.useState([]),[o,a]=y.useState(!0),{organizationsResponse:r}=Tu("Org",{take:3e3});return y.useEffect(()=>{var i;if(r!=null&&r.items){const l=(i=r==null?void 0:r.items)==null?void 0:i.filter(c=>c.id===e),d=l==null?void 0:l?.map(c=>({id:c.id,name:c.name}));t(d),a(!1)}},[r]),{organizations:n,isLoading:o}},pp=(e,n)=>{const[t,o]=y.useState([]),[a,r]=y.useState([]),{getList:i}=Vn(),{data:l,isLoading:d}=i(e,n);return y.useEffect(()=>{var c,u,g;if((c=l==null?void 0:l.data)!=null&&c.items){r((u=l==null?void 0:l.data)==null?void 0:u.items);const m=(g=l==null?void 0:l.data)==null?void 0:g.items?.map(h=>({id:h.id,name:h.name}));o(m)}},[l]),{units:t,isLoading:d,setUnits:o,fetchedUnits:a}},pc=e=>({id:e.id,name:e.name,parentId:e.parentPositionId,...e.subPositions.length>0&&{children:e.subPositions?.map(pc)}}),fp=e=>{const[n,t]=y.useState([]),[o,a]=y.useState([]),{usePositionHierarchy:r}=Ln(),{data:i,isLoading:l}=r(e);return y.useEffect(()=>{if(i){const d=i,c=d?.map(pc);a(d),t(c)}},[i]),{departments:n,isLoading:l,setDepartments:t,positions:o}},vp=e=>{const[n,t]=y.useState([]),{useEmployeesUnderPosition:o}=Ln(),{data:a,isLoading:r,refetch:i}=o(e);return y.useEffect(()=>{a&&t(a.data)},[a]),{employees:n,isLoading:r,setEmployees:t,refetch:async()=>{i&&await i()}}},xp=(e,n)=>{const t=Tt(),[o,a]=y.useState(""),[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState(""),[g,m]=y.useState([]);return{selectedOrgId:o,selectedUnitId:r,selectedDepartmentId:l,selectedDepartmentName:c,breadcrumb:g,handleSelectOrganization:v=>{t.invalidateQueries({queryKey:["unitList"]}),a(v),i(""),d("");const x=e.find(b=>b.id===v);x&&m([{id:x.id,name:x.name}])},handleSelectUnit:(v,x)=>{t.invalidateQueries({queryKey:["positionHierarchy"]}),i(v),d("");const b=x.find(C=>C.id===v),w=e.find(C=>C.id===o);b&&w&&m([{id:w.id,name:w.name},{id:b.id,name:b.name}])},handleSelectDepartment:(v,x)=>{t.invalidateQueries({queryKey:["positionEmployees"]}),d(v);const b=x.find(j=>j.id===v),w=g.find(j=>j.id===r),C=g.find(j=>j.id===o);b!=null&&b.name&&u(n(b==null?void 0:b.name)||""),b&&w&&C&&m([{id:C.id,name:C.name},{id:w.id,name:w.name},{id:b.id,name:b.name}])}}},bp=({selectedOrgId:e,selectedUnitId:n,toast:t})=>{const[o,a]=y.useState(!1),[r,i]=y.useState(!1),[l,d]=y.useState(!1),[c,u]=y.useState(!1),[g,m]=y.useState(!1),[h,p]=y.useState(!1),[f,v]=y.useState(!1),[x,b]=y.useState(!1),[w,C]=y.useState(!1),[j,M]=y.useState(!1),[k,S]=y.useState(!1),[T,N]=y.useState(!1),[F,E]=y.useState(!1),[V,L]=y.useState(""),[B,_]=y.useState(""),[D,O]=y.useState(""),[P,$]=y.useState(""),[z,H]=y.useState(!1),[ae,ie]=y.useState(""),[Q,se]=y.useState(""),[te,Z]=y.useState(""),[I,Y]=y.useState(""),ce=ee=>{t(ee)};return{handleSelectOrganization:ee=>{ie(ee)},unit:{onAddDepartment:()=>{ie(ae),se(n),u(!0)},onEditUnit:ee=>{se(ee||n),a(!0)},onDeleteUnit:(ee,W)=>{se(ee),Z(W),i(!0)},onAddFromSubCity:ee=>{se(ee),d(!0)}},department:{onAddUserUnderDepartment:(ee,W)=>{L(ee),_(W),C(!0)},onEditDepartment:(ee,W)=>{L(ee),_(W),m(!0)},onDeleteDepartment:(ee,W)=>{L(ee),_(W),p(!0)},onMoveDepartment:(ee,W)=>{L(ee),_(W),v(!0)},onViewUsers:()=>ce({title:"View Users"}),onAddSubDepartment:(ee,W)=>{L(ee),ie(e),se(n),_(W),b(!0)},onAssignUser:(ee,W)=>{L(ee),_(W),ie(e),se(n),N(!0)},onDelegate:()=>ce({title:"Delegate"})},teamMember:{onDeleteTeamMember:(ee,W,me,le)=>{L(ee),_(W),E(!0),O(me),$(le)},onDeactivateTeamMember:(ee,W)=>{Y(ee),$(W),H(!0)}},dialogs:{editUnit:{isOpen:o,onClose:()=>a(!1),unitId:Q},deleteUnit:{isOpen:r,onClose:()=>i(!1),unitId:Q,unitName:te},addFromSubCity:{isOpen:l,onClose:()=>d(!1),parentUnitId:Q},department:{isOpen:c,onClose:()=>u(!1),organizationId:ae,unitId:Q},editDepartment:{isOpen:g,onClose:()=>m(!1),departmentId:V,departmentName:B},deleteDepartment:{isOpen:h,onClose:()=>p(!1),departmentId:V,departmentName:B},moveDepartment:{isOpen:f,onClose:()=>v(!1),departmentId:V,departmentName:B},userUnderDepartment:{isOpen:w,onClose:()=>C(!1),departmentId:V,departmentName:B},subDepartment:{isOpen:x,onClose:()=>b(!1),departmentId:V,departmentName:B,organizationId:ae,unitId:Q},user:{unitId:Q,isOpen:j,onClose:()=>M(!1)},viewUsers:{unitId:Q,isOpen:k,onClose:()=>S(!1)},assignUser:{isOpen:T,onClose:()=>N(!1),departmentId:V,departmentName:B,organizationId:ae,unitId:Q},deleteTeamMember:{isOpen:F,onClose:()=>E(!1),departmentId:V,departmentName:B,teamMemberId:D,teamMemberName:P},deactivateTeamMember:{isOpen:z,onClose:()=>H(!1),userId:I,teamMemberName:P}}}},yp=({breadcrumb:e,hasTeamMembers:n})=>{const t=Bt();return s.jsxs("div",{className:"flex items-center text-sm text-gray-500 mb-4 overflow-x-auto",children:[s.jsx("span",{className:"font-medium",children:"User Management"}),e?.map((o,a)=>s.jsxs("div",{className:"flex items-center",children:[s.jsx(eo,{className:"h-4 w-4 mx-2 flex-shrink-0"}),s.jsx("span",{className:a===e.length-1?"font-medium text-gray-800":"",children:t(o.name)})]},o.id)),n&&s.jsxs("div",{className:"flex items-center",children:[s.jsx(eo,{className:"h-4 w-4 mx-2 flex-shrink-0"}),s.jsx("span",{className:"font-medium text-gray-800",children:"Team Members"})]})]})};function wp({departmentId:e,departmentName:n,onSuccess:t,onCancel:o}){const{invite:a,isInviting:r}=go(),i=Jt.language,[l,d]=y.useState({positionId:e,username:"",email:"",phoneNumber:"",name:{am:"",en:""}}),[c,u]=y.useState({username:"",email:"",phoneNumber:"",nameAm:"",nameEn:""}),g=(p,f,v)=>{p==="name"&&v?(d(x=>({...x,name:{...x.name,[v]:f}})),u(x=>({...x,[`name${v.toUpperCase()}`]:""}))):(d(x=>({...x,[p]:f})),u(x=>({...x,[p]:""})))},m=()=>{const p={username:"",email:"",phoneNumber:"",nameAm:"",nameEn:""};let f=!0;return l.username.trim()||(p.username=R("profile.usernameRequired"),f=!1),l.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l.email)||(p.email=R("profile.validEmailFormat"),f=!1):(p.email=R("profile.emailRequired"),f=!1),l.phoneNumber.trim()?Iu(l.phoneNumber)||(p.phoneNumber=R("profile.validPhoneFormat"),f=!1):(p.phoneNumber=R("profile.phoneRequired"),f=!1),l.name.am.trim()||(p.nameAm=R("profile.amharicNameRequired"),f=!1),l.name.en.trim()||(p.nameEn=R("profile.englishNameRequired"),f=!1),u(p),f},h=async p=>{p.preventDefault(),m()&&a({payload:l,successCallback:()=>{Pe.success("User invited",{description:`User "${i==="en"?l.name.en:l.name.am}" has been added to the department.`}),t()}})};return s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(Ge,{children:R("organization.Position")}),s.jsx(ze,{value:n,disabled:!0})]}),s.jsxs("div",{children:[s.jsxs(Ge,{children:[R("organization.username")," *"]}),s.jsx(ze,{value:l.username,onChange:p=>g("username",p.target.value)}),c.username&&s.jsx("p",{className:"text-red-500 text-sm",children:c.username})]}),s.jsxs("div",{children:[s.jsxs(Ge,{children:[R("organization.email")," *"]}),s.jsx(ze,{type:"email",value:l.email,onChange:p=>g("email",p.target.value)}),c.email&&s.jsx("p",{className:"text-red-500 text-sm",children:c.email})]}),s.jsxs("div",{children:[s.jsx(Ge,{children:R("auth.phoneNumber")}),s.jsx(ze,{type:"tel",placeholder:"0912345678 or +251912345678",value:l.phoneNumber,onChange:p=>g("phoneNumber",p.target.value)}),c.phoneNumber&&s.jsx("p",{className:"text-red-500 text-sm",children:c.phoneNumber})]}),s.jsxs("div",{children:[s.jsxs(Ge,{children:[R("organization.enterAmharicName"),"*"]}),s.jsx(ze,{value:l.name.am,onChange:p=>g("name",p.target.value,"am")}),c.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:c.nameAm})]}),s.jsxs("div",{children:[s.jsxs(Ge,{children:[R("organization.enterEnglishName"),"*"]}),s.jsx(ze,{value:l.name.en,onChange:p=>g("name",p.target.value,"en")}),c.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:c.nameEn})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:o,disabled:r,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:r,children:r?R("organization.adding"):R("organization.addUser")})]})]})}function jp({isOpen:e,onClose:n,departmentId:t,departmentName:o}){const{t:a}=fl(),r=()=>{n()};return s.jsx(yt,{open:e,onOpenChange:i=>!i&&n(),children:s.jsxs(wt,{className:"sm:max-w-[525px]",children:[s.jsx(jt,{children:s.jsx(Ct,{children:a("userRecord.Add User Under Department")})}),s.jsx(wp,{departmentId:t,departmentName:o,onSuccess:r,onCancel:n})]})})}function Cp({departmentId:e,onSuccess:n,onCancel:t}){const{updatePosition:o,isUpdating:a}=Ln(),[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState(""),[g,m]=y.useState(""),[h,p]=y.useState(""),[f,v]=y.useState(""),{commonPositionTypes:x,isLoadingCommonTypes:b}=er({unitId:g,params:{take:1e3,skip:0,orderBy:"createdAt:Desc"}}),[w,C]=y.useState({}),[j,M]=y.useState(!0),k=Jt.language,S=Bt();y.useEffect(()=>{(async()=>{try{const V=(await Fu(e)).data;i(V.name.en),d(V.name.am),u(V.key),m(V.unitId),p(V.organizationId),v(V.positionTypeId)}catch{Pe.error("Failed to fetch department")}finally{M(!1)}})()},[e]),y.useEffect(()=>{g&&x.length>0&&(x.find(E=>E.id===f)||v(""))},[g,x,f]);const T=()=>{const F={};return r.trim()||(F.nameEn=R("organization.englishNameRequired")),l.trim()||(F.nameAm=R("organization.amharicNameRequired")),f||(F.positionTypeId=R("contentManagement.selectPosType")),C(F),Object.keys(F).length===0},N=F=>{if(F.preventDefault(),!T()){Pe.error(R("contentManagement.invalidMsg"));return}const E={name:{en:r.trim(),am:l.trim()},key:c.trim().toLowerCase().replace(/\s+/g,"-"),unitId:g,organizationId:h,positionTypeId:f};o({id:e,payload:E,successCallback:()=>{Pe.success(R("contentManagement.success"),{description:`${R("contentManagement.department")} "${k==="en"?r:l}" ${R("contentManagement.updated")}`}),n(r.trim())}})};return j?s.jsxs("div",{className:"text-sm text-muted-foreground",children:[" ",R("contentManagement.loading")]}):s.jsxs("form",{onSubmit:N,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"positionType",children:R("organization.positionTypes")}),s.jsxs(cn,{onValueChange:F=>{v(F),C(E=>({...E,positionTypeId:""}))},value:f,disabled:b,children:[s.jsx(dn,{children:s.jsx(un,{placeholder:R("contentManagement.selectPosType")})}),s.jsx(gn,{className:"max-h-60 overflow-y-auto",children:x?.map(F=>s.jsx(Ot,{value:F.id,children:S(F.name)},F.id))})]}),w.positionTypeId&&s.jsx("p",{className:"text-red-500 text-sm",children:w.positionTypeId})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameEn",children:R("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:R("organization.enterEnglishName"),value:r,onChange:F=>{i(F.target.value),C(E=>({...E,nameEn:""}))}}),w.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:w.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameAm",children:R("organization.enterAmharicName")}),s.jsx(ze,{id:"nameAm",placeholder:R("organization.enterAmharicName"),value:l,onChange:F=>{d(F.target.value),C(E=>({...E,nameAm:""}))}}),w.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:w.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"key",children:R("contentManagement.key")}),s.jsx(ze,{id:"key",placeholder:"e.g. finance-department",value:c,disabled:!0})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:t,disabled:a,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:a,children:a?R("profile.updating"):R("delegation.update")})]})]})}function Sp({isOpen:e,onClose:n,postions:t,departmentId:o,departmentName:a}){const r=i=>{n()};return s.jsx(yt,{open:e,onOpenChange:i=>!i&&n(),children:s.jsxs(wt,{className:"sm:max-w-[425px]",children:[s.jsx(jt,{children:s.jsxs(Ct,{children:["Edit Department ",a]})}),s.jsx(Cp,{departmentId:o,onSuccess:r,onCancel:n})]})})}function _p({unit:e,onSuccess:n,onCancel:t}){const[o,a]=y.useState(e.name.en),[r,i]=y.useState(e.name.am),[l,d]=y.useState({}),c=Jt.language,{updateUnit:u,isUpdating:g}=Vn(),m=()=>{const p={};return o.trim()||(p.nameEn=R("organization.englishNameRequired")),r.trim()||(p.nameAm=R("organization.amharicNameRequired")),d(p),Object.keys(p).length===0},h=p=>{p.preventDefault();const{id:f,key:v,organizationId:x,parentUnitId:b}=e;if(!m()){Pe.error(R("contentManagement.invalidMsg"));return}const w={name:{en:o.trim(),am:r.trim()},key:v.trim().toLowerCase().replace(/\s+/g,"-"),organizationId:x,parentUnitId:b??void 0};u({id:f,payload:w,successCallback:()=>{Pe.success("Success",{description:`${R("contentManagement.unit")} "${c==="en"?o:r}" ${R("contentManagement.updated")}`}),n(o.trim())}})};return s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameEn",children:R("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:R("organization.enterEnglishName"),value:o,onChange:p=>{a(p.target.value),d(f=>({...f,nameEn:""}))}}),l.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:l.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameAm",children:R("organization.enterEnglishName")}),s.jsx(ze,{id:"nameAm",placeholder:R("organization.enterEnglishName"),value:r,onChange:p=>{i(p.target.value),d(f=>({...f,nameAm:""}))}}),l.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:l.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"key",children:R("contentManagement.key")}),s.jsx(ze,{id:"key",value:e.key})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:t,disabled:g,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:g,children:g?R("profile.updating"):R("delegation.update")})]})]})}function Mp({isOpen:e,onClose:n,units:t,unitId:o}){var g;const a=()=>{n()},r=t==null?void 0:t.find(m=>m.id===o),{getById:i}=Vn(),{data:l,isLoading:d}=i(r?"":o),c=(l==null?void 0:l.data)??null,u=r??c;return s.jsx(yt,{open:e,onOpenChange:m=>!m&&n(),children:s.jsxs(wt,{className:"sm:max-w-[425px]",children:[s.jsx(jt,{children:s.jsxs(Ct,{children:["Edit Unit ",(g=u==null?void 0:u.name)==null?void 0:g.en]})}),u?s.jsx(_p,{unit:u,onSuccess:a,onCancel:n}):s.jsx("div",{className:"flex justify-center py-6",children:d?s.jsx(Rt,{className:"h-5 w-5 animate-spin text-gray-500"}):s.jsx("span",{className:"text-sm text-gray-500",children:"Unit not found."})})]})})}const Rp=({unitName:e,unitId:n,isOpen:t,onClose:o})=>{const{removeUnit:a,isDeleting:r}=Vn(),i=async()=>{try{await a(n),Pe.success("Unit deleted successfully."),o()}catch{}};return s.jsx(ho,{open:t,onOpenChange:o,children:s.jsxs(po,{children:[s.jsxs(fo,{children:[s.jsx(vo,{children:"Are you sure you want to delete this unit?"}),s.jsxs(xo,{children:["This action will permanently delete the unit"," ",s.jsx("strong",{children:e})," and cannot be undone."]})]}),s.jsxs(bo,{children:[s.jsx(yo,{disabled:r,children:"Cancel"}),s.jsxs(He,{variant:"destructive",onClick:i,disabled:r,children:[r&&s.jsx(Rt,{className:"w-4 h-4 mr-2 animate-spin"}),"Delete"]})]})]})})},Ai=e=>e?Array.isArray(e)?e:Array.isArray(e.items)?e.items:[]:[],fc=e=>{var d;const n=zt({queryKey:["unitList",e,"capacity-total"],queryFn:()=>Cl(e,{take:1e3,skip:0}),enabled:!!e,staleTime:0}),t=Ai((d=n.data)==null?void 0:d.data),o=t?.map(c=>c==null?void 0:c.id).filter(Boolean),a=Ou({queries:o?.map(c=>({queryKey:["unitChildren",c,"capacity-total"],queryFn:()=>Eu(c),enabled:!!c,staleTime:0}))}),r=a.reduce((c,u)=>{if(!u.data)return c;const g=Ai(u.data.data);return c+g.length},0),i=t.length+r,l=n.isLoading||a?.some(c=>c.isLoading||c.isFetching);return{total:i,isLoading:l}};function Np({parentUnitId:e,onSuccess:n,onCancel:t}){const o=Bt(),{user:a}=Xa(),r=a!=null&&a.employee&&a.employee.length>0?a.employee[0].organizationId:"",[i,l]=y.useState(""),[d,c]=y.useState(""),[u,g]=y.useState(""),{relateUnit:m,isRelating:h}=Vn(),{data:p,isLoading:f}=zt({queryKey:["organizationsFilter","subcity"],queryFn:()=>Pu({organizationTypeKey:"subcity",take:1e3,skip:0}),staleTime:6e4}),v=y.useMemo(()=>{var D;const _=((D=p==null?void 0:p.data)==null?void 0:D.items)??(p==null?void 0:p.data)??[];return Array.isArray(_)?_:[]},[p]),{data:x,isLoading:b}=zt({queryKey:["unitList",i],queryFn:()=>Cl(i,{take:1e3,skip:0}),enabled:!!i,staleTime:0}),w=y.useMemo(()=>{var D;const _=((D=x==null?void 0:x.data)==null?void 0:D.items)??[];return Array.isArray(_)?_:[]},[x]),{data:C,isLoading:j}=tr(r),M=y.useMemo(()=>{var P;const _=((P=C==null?void 0:C.data)==null?void 0:P.items)??[];if(!Array.isArray(_)||_.length===0)return null;const D=_.find($=>($==null?void 0:$.organizationId)===r)??_[0],O=Number(D==null?void 0:D.maximumNumberOfUnits);return Number.isFinite(O)?O:null},[C,r]),{total:k,isLoading:S}=fc(r),T=M!==null&&M>=0&&k>=M,N=M!==null?Math.max(M-k,0):null;y.useEffect(()=>{c("")},[i]);const F=async _=>{if(_.preventDefault(),!i){g(R("contentManagement.subCityRequired","Please select a sub city"));return}if(!d){g(R("contentManagement.unitRequired","Please select a unit"));return}if(!e){g(R("contentManagement.parentUnitMissing","Parent unit is missing"));return}if(M===null){g(R("contentManagement.noCapacityConfigured","No unit capacity configured for this organization. Ask the super admin to configure it in Manage Organization Configuration."));return}if(T){g(R("contentManagement.capacityReached","Capacity limit reached. Configured maximum is {{max}}.",{max:M??0}));return}const D={unitId:d,newParentUnitId:e};try{await m({payload:D,successCallback:()=>{Pe.success(R("contentManagement.unitRelatedSuccess","Unit related successfully")),n()}})}catch{}},E=j||S,L=E||!E&&M===null||T,B=!i||!d||h||L;return s.jsxs("form",{onSubmit:F,className:"flex flex-col gap-4 w-full min-w-0",children:[s.jsx("div",{className:`rounded-md border px-3 py-2 text-sm ${E?"border-gray-200 bg-gray-50 text-gray-600 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-300":M===null?"border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-300":T?"border-red-200 bg-red-50 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300":"border-primary-200 bg-primary-50 text-primary-700 dark:border-primary-900/50 dark:bg-primary-950/30 dark:text-primary-300"}`,children:s.jsxs("div",{className:"flex items-start gap-2",children:[E?s.jsx(Rt,{className:"h-4 w-4 mt-0.5 shrink-0 animate-spin"}):s.jsx(ks,{className:"h-4 w-4 mt-0.5 shrink-0"}),s.jsx("div",{className:"min-w-0 break-words flex-1",children:E?s.jsx("span",{children:R("contentManagement.checkingCapacity","Checking configured capacity…")}):M===null?s.jsx("span",{children:R("contentManagement.noCapacityConfigured","No unit capacity configured for this organization. Ask the super admin to configure it in Manage Organization Configuration.")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"font-medium",children:R("contentManagement.configuredUnitLimit","Configured unit limit: {{max}}",{max:M})}),s.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-xs opacity-90",children:[s.jsxs("span",{children:[R("contentManagement.linkedUnits","Linked"),": ",k]}),s.jsxs("span",{children:[R("contentManagement.remainingSlots","Remaining"),":"," ",N??0]})]}),T&&s.jsx("div",{className:"text-xs font-medium",children:R("contentManagement.capacityReachedShort","Limit reached — cannot relate more units.")})]})})]})}),s.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[s.jsx(Ge,{htmlFor:"subCity",className:"text-sm",children:R("contentManagement.selectSubCity","Select Sub City")}),s.jsxs(cn,{value:i,onValueChange:_=>{l(_),g("")},disabled:f||L,children:[s.jsx(dn,{id:"subCity",className:"w-full max-w-full",children:s.jsx(un,{placeholder:f?R("organization.loading"):R("contentManagement.selectSubCity","Select Sub City")})}),s.jsx(gn,{className:"max-w-[var(--radix-select-trigger-width)]",children:f?s.jsxs("div",{className:"flex items-center justify-center px-2 py-3 text-sm text-gray-500",children:[s.jsx(Rt,{className:"w-4 h-4 animate-spin mr-2"}),R("organization.loading")]}):v.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-gray-500",children:R("contentManagement.noSubCities","No sub cities found")}):v?.map(_=>s.jsx(Ot,{value:_.id,children:s.jsx("span",{className:"block truncate",children:o(_.name)})},_.id))})]})]}),s.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[s.jsx(Ge,{htmlFor:"subCityUnit",className:"text-sm",children:R("contentManagement.selectUnit","Select Unit")}),s.jsxs(cn,{value:d,onValueChange:_=>{c(_),g("")},disabled:!i||b||L,children:[s.jsx(dn,{id:"subCityUnit",className:"w-full max-w-full",children:s.jsx(un,{placeholder:i?b?R("organization.loading"):R("contentManagement.selectUnit","Select Unit"):R("contentManagement.selectSubCityFirst","Select a sub city first")})}),s.jsx(gn,{className:"max-w-[var(--radix-select-trigger-width)]",children:b?s.jsxs("div",{className:"flex items-center justify-center px-2 py-3 text-sm text-gray-500",children:[s.jsx(Rt,{className:"w-4 h-4 animate-spin mr-2"}),R("organization.loading")]}):w.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-gray-500",children:R("contentManagement.noUnit")}):w?.map(_=>s.jsx(Ot,{value:_.id,children:s.jsx("span",{className:"block truncate",children:o(_.name)})},_.id))})]})]}),u&&s.jsx("p",{className:"text-red-500 text-sm break-words",children:u}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:t,disabled:h,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:B,children:h?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Rt,{className:"h-4 w-4 animate-spin"}),R("organization.adding")]}):R("contentManagement.addFromSubCity","Add From Sub City")})]})]})}function kp({isOpen:e,onClose:n,parentUnitId:t}){return s.jsx(yt,{open:e,onOpenChange:o=>!o&&n(),children:s.jsxs(wt,{className:"sm:max-w-[480px] max-w-[calc(100vw-2rem)] overflow-hidden",children:[s.jsx(jt,{children:s.jsx(Ct,{className:"truncate",children:R("contentManagement.addFromSubCity","Add From Sub City")})}),s.jsx("div",{className:"min-w-0",children:s.jsx(Np,{parentUnitId:t,onSuccess:n,onCancel:n})})]})})}function Dp({organizationId:e,onSuccess:n,onCancel:t}){const[o,a]=y.useState(""),[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState({}),g=Jt.language,{createUnit:m,isCreating:h}=Vn(),{data:p,isLoading:f}=tr(e||""),v=y.useMemo(()=>{var V;const N=((V=p==null?void 0:p.data)==null?void 0:V.items)??[];if(!Array.isArray(N)||N.length===0)return null;const F=N.find(L=>(L==null?void 0:L.organizationId)===e)??N[0],E=Number(F==null?void 0:F.maximumNumberOfUnits);return Number.isFinite(E)?E:null},[p,e]),{total:x,isLoading:b}=fc(e),w=f||b,C=v!==null&&v>=0&&x>=v,j=!w&&v===null,M=v!==null?Math.max(v-x,0):null,k=w||j||C,S=()=>{const N={};return o.trim()||(N.nameEn=R("organization.englishNameRequired")),r.trim()||(N.nameAm=R("organization.amharicNameRequired")),l.trim()||(N.key=R("contentManagement.keyRequired")),u(N),Object.keys(N).length===0},T=N=>{if(N.preventDefault(),w)return;if(j){Pe.error(R("contentManagement.noCapacityConfigured","No unit capacity configured for this organization. Ask the super admin to configure it in Manage Organization Configuration."));return}if(C){Pe.error(R("contentManagement.capacityReached","Capacity limit reached. Configured maximum is {{max}}.",{max:v??0}));return}if(!S()){Pe.error(R("contentManagement.invalidMsg"));return}const F={organizationId:e,key:l.trim().toLowerCase().replace(/\s+/g,"-"),name:{en:o.trim(),am:r.trim()}};m({payload:F,successCallback:()=>{Pe.success(R("contentManagement.success"),{description:`${R("contentManagement.unit")} "${g==="en"?o:r}" ${R("contentManagement.msg")}`}),n(o.trim())}})};return s.jsxs("form",{onSubmit:T,className:"space-y-4",children:[s.jsx("div",{className:`rounded-md border px-3 py-2 text-sm ${w?"border-gray-200 bg-gray-50 text-gray-600 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-300":j?"border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-300":C?"border-red-200 bg-red-50 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300":"border-primary-200 bg-primary-50 text-primary-700 dark:border-primary-900/50 dark:bg-primary-950/30 dark:text-primary-300"}`,children:s.jsxs("div",{className:"flex items-start gap-2",children:[w?s.jsx(Rt,{className:"h-4 w-4 mt-0.5 shrink-0 animate-spin"}):s.jsx(ks,{className:"h-4 w-4 mt-0.5 shrink-0"}),s.jsx("div",{className:"min-w-0 break-words flex-1",children:w?s.jsx("span",{children:R("contentManagement.checkingCapacity","Checking configured capacity…")}):j?s.jsx("span",{children:R("contentManagement.noCapacityConfigured","No unit capacity configured for this organization. Ask the super admin to configure it in Manage Organization Configuration.")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"font-medium",children:R("contentManagement.configuredUnitLimit","Configured unit limit: {{max}}",{max:v})}),s.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-xs opacity-90",children:[s.jsxs("span",{children:[R("contentManagement.linkedUnits","Used"),": ",x]}),s.jsxs("span",{children:[R("contentManagement.remainingSlots","Remaining"),":"," ",M??0]})]}),C&&s.jsx("div",{className:"text-xs font-medium",children:R("contentManagement.capacityReachedShort","Limit reached — cannot create more units.")})]})})]})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameEn",children:R("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:R("organization.enterEnglishName"),value:o,disabled:k,onChange:N=>{a(N.target.value),u(F=>({...F,nameEn:""}))}}),c.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:c.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"nameAm",children:R("organization.enterAmharicName")}),s.jsx(ze,{id:"nameAm",placeholder:R("organization.enterAmharicName"),value:r,disabled:k,onChange:N=>{i(N.target.value),u(F=>({...F,nameAm:""}))}}),c.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:c.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ge,{htmlFor:"key",children:R("contentManagement.key")}),s.jsx(ze,{id:"key",placeholder:"e.g. finance-unit",value:l,disabled:k,onChange:N=>{d(N.target.value),u(F=>({...F,key:""}))}}),c.key&&s.jsx("p",{className:"text-red-500 text-sm",children:c.key})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:t,disabled:h,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:h||k,children:h?R("organization.adding"):R("contentManagement.addUnit")})]})]})}function Tp({isOpen:e,onClose:n,organizationId:t}){const o=a=>{n()};return s.jsx(yt,{open:e,onOpenChange:a=>!a&&n(),children:s.jsxs(wt,{className:"sm:max-w-[425px]",children:[s.jsx(jt,{children:s.jsx(Ct,{children:R("contentManagement.addNewUnit")})}),s.jsx(Dp,{organizationId:t,onSuccess:o,onCancel:n})]})})}const Ip=({departmentName:e,departmentId:n,isOpen:t,onClose:o})=>{const{deletePosition:a,isDeleting:r}=Ln(),i=async()=>{a({id:n,successCallback:o})};return s.jsx(ho,{open:t,onOpenChange:o,children:s.jsxs(po,{children:[s.jsxs(fo,{children:[s.jsx(vo,{children:"Are you sure you want to delete this department?"}),s.jsxs(xo,{children:["This will permanently delete ",s.jsx("strong",{children:e})," and all its sub-items. This action cannot be undone."]})]}),s.jsxs(bo,{children:[s.jsx(yo,{disabled:r,children:"Cancel"}),s.jsxs(He,{variant:"destructive",onClick:i,disabled:r,children:[r&&s.jsx(Rt,{className:"w-4 h-4 mr-2 animate-spin"}),"Delete"]})]})]})})},Fp=({departmentId:e,departmentName:n,isOpen:t,onClose:o,teamMemberId:a,teamMemberName:r})=>{if(!a)return null;const{setInactive:i,isDeActivatingUser:l}=go(),d={employeeId:a,positionId:e},c=()=>{i({payload:d,successCallback:o})};return s.jsx(ho,{open:t,onOpenChange:o,children:s.jsxs(po,{children:[s.jsxs(fo,{children:[s.jsx(vo,{children:"Remove team member from this position?"}),s.jsxs(xo,{children:["This will mark ",s.jsx("strong",{children:r})," as inactive for this position. This action can be reversed only by reassigning."]})]}),s.jsxs(bo,{children:[s.jsx(yo,{disabled:l,children:"Cancel"}),s.jsxs(He,{variant:"destructive",onClick:c,disabled:l,children:[l&&s.jsx(Rt,{className:"h-4 w-4 mr-2 animate-spin"}),"Confirm"]})]})]})})};function Pp({unitId:e,departmentId:n,organizationId:t,onSuccess:o,onCancel:a}){const{usePositionListByUnitId:r}=Ln({take:1e3,skip:0}),[i,l]=y.useState(""),[d,c]=y.useState(""),[u,g]=y.useState(""),{data:m,isError:h,isLoading:p}=r(e,{take:1e3,skip:0}),f=Jt.language,{mutate:v,isPending:x}=Nu(),b=y.useMemo(()=>{if(!(m!=null&&m.items))return[];if(!d.trim())return m.items;const C=d.toLowerCase();return m.items.filter(j=>{var T,N,F,E,V;const M=((N=(T=j.name)==null?void 0:T.en)==null?void 0:N.toLowerCase())||"",k=((E=(F=j.name)==null?void 0:F.am)==null?void 0:E.toLowerCase())||"",S=((V=j.description)==null?void 0:V.toLowerCase())||"";return M.includes(C)||k.includes(C)||S.includes(C)})},[m==null?void 0:m.items,d]),w=C=>{if(C.preventDefault(),!i){g(R("addRecord.Select Department")),Pe.error(R("contentManagement.departmentRequired"));return}v({positionId:n,newParentId:i},{onSuccess:()=>{o(i)}}),o(i),Pe.success(R("contentManagement.departmentSuccess"))};return s.jsxs("form",{onSubmit:w,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Ge,{htmlFor:"department",children:[" ",R("addRecord.Select Department")]}),s.jsxs(cn,{onValueChange:C=>{l(C),g("")},value:i,children:[s.jsx(dn,{children:s.jsx(un,{placeholder:R("addRecord.Select Department")})}),s.jsx(gn,{className:"p-0",children:s.jsxs("div",{className:"flex flex-col h-60",children:[s.jsx("div",{className:"flex-shrink-0 bg-white border-b p-2 z-10",children:s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),s.jsx(ze,{placeholder:"Search departments...",value:d,onChange:C=>{c(C.target.value),l("")},className:"pl-10 pr-10 h-8"}),d&&s.jsx(He,{type:"button",variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0",onClick:()=>{c(""),l("")},children:s.jsx(fu,{className:"h-3 w-3"})})]})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:p?s.jsx("div",{className:"px-2 py-2",children:s.jsx("p",{className:"text-gray-500",children:R("contentManagement.loading")})}):b.length===0?s.jsx("div",{className:"px-2 py-2",children:s.jsx("p",{className:"text-gray-500",children:d?"No departments found matching your search.":"No departments available."})}):b?.map(C=>s.jsx(Ot,{value:C.id,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"font-medium",children:f==="en"?C.name.en:C.name.am}),C.description&&s.jsx("span",{className:"text-xs text-gray-500",children:C.description})]})},C.id))}),d&&b.length>0&&s.jsx("div",{className:"flex-shrink-0 bg-gray-50 border-t px-2 py-1",children:s.jsxs("p",{className:"text-xs text-gray-500",children:["Found ",b.length," department(s)"]})})]})})]}),u&&s.jsx("p",{className:"text-red-500 text-sm",children:u})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(He,{type:"button",variant:"outline",onClick:a,children:R("common.Cancel")}),s.jsx(He,{type:"submit",disabled:!i||x,children:x?"Moving...":R("contentManagement.moveDepartement")})]})]})}function Ep({isOpen:e,onClose:n,departmentId:t,organizationId:o,unitId:a}){const r=i=>{n()};return s.jsx(yt,{open:e,onOpenChange:i=>!i&&n(),children:s.jsxs(wt,{className:"sm:max-w-[425px]",children:[s.jsx(jt,{children:s.jsx(Ct,{children:"Move Department"})}),s.jsx(Pp,{unitId:a,organizationId:o,onSuccess:r,onCancel:n,departmentId:t})]})})}const zi={getUnitsList:async e=>{var n,t;try{return{success:!0,data:(await Na.get(`/units/list/${e}`,{headers:fi()})).data}}catch(o){return{success:!1,message:((t=(n=o==null?void 0:o.response)==null?void 0:n.data)==null?void 0:t.message)||"Failed to fetch units",data:null}}},exportUserData:async(e,n="xlsx")=>{var t,o;try{const r=(await Na.get(`/employees/export-user-data/${e}`,{headers:fi(),responseType:"json"})).data,i=mt.book_new();if(Array.isArray(r)){const f=mt.json_to_sheet(r);mt.book_append_sheet(i,f,"Data")}else if(r&&typeof r=="object"){if(r.positions&&Array.isArray(r.positions)){const f=mt.json_to_sheet(r.positions);mt.book_append_sheet(i,f,"Positions")}if(r.users&&Array.isArray(r.users)){const f=mt.json_to_sheet(r.users);mt.book_append_sheet(i,f,"Users")}if(!r.positions&&!r.users){const f=Object.values(r).find(v=>Array.isArray(v));if(f){const v=mt.json_to_sheet(f);mt.book_append_sheet(i,v,"Data")}else{const v=mt.json_to_sheet([r]);mt.book_append_sheet(i,v,"Data")}}}else{const f=mt.json_to_sheet([{data:r}]);mt.book_append_sheet(i,f,"Data")}let l,d,c;if(n==="csv"){let f="";if(r&&typeof r=="object"&&(r.positions||r.users)){const v=[];if(r.positions&&Array.isArray(r.positions)&&r.positions.forEach(x=>{v.push({...x,dataType:"Position"})}),r.users&&Array.isArray(r.users)&&r.users.forEach(x=>{v.push({...x,dataType:"User"})}),v.length>0){const x=mt.json_to_sheet(v);f=mt.sheet_to_csv(x)}}else{const v=i.SheetNames[0],x=i.Sheets[v];f=mt.sheet_to_csv(x)}l=new TextEncoder().encode(f),d="text/csv",c="csv"}else l=Au(i,{bookType:"xlsx",type:"array"}),d="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",c="xlsx";const u=new Blob([l],{type:d}),g=window.URL.createObjectURL(u),m=document.createElement("a");m.href=g;const p=`user-data-export-${new Date().toISOString().split("T")[0]}.${c}`;return m.download=p,document.body.appendChild(m),m.click(),document.body.removeChild(m),window.URL.revokeObjectURL(g),{success:!0,message:"Export completed successfully",data:r}}catch(a){return{success:!1,message:((o=(t=a==null?void 0:a.response)==null?void 0:t.data)==null?void 0:o.message)||"Export failed. Please try again.",data:null}}}},Op=()=>{const[e,n]=y.useState(!1),[t,o]=y.useState(!1),[a,r]=y.useState([]);return{exportUserData:async(d,c="xlsx")=>{if(!d){const u={success:!1,message:"Unit ID is required",data:null};return Pe.error(u.message),u}n(!0);try{const u=await zi.exportUserData(d,c);return u.success?Pe.success(`User data exported successfully as ${c.toUpperCase()}!`):Pe.error(u.message),u}catch(u){const g={success:!1,message:(u==null?void 0:u.message)||"Export failed. Please try again.",data:null};return Pe.error(g.message),g}finally{n(!1)}},getUnits:async d=>{var c,u;if(!d){Pe.error("Organization ID is required");return}o(!0);try{const g=await zi.getUnitsList(d);return g.success?(r(((c=g.data)==null?void 0:c.items)||[]),((u=g.data)==null?void 0:u.items)||[]):(Pe.error(g.message),[])}catch{return Pe.error("Failed to fetch units"),[]}finally{o(!1)}},isExporting:e,isLoadingUnits:t,units:a}},Ap=({isOpen:e,onClose:n,userId:t,teamMemberName:o})=>{const{deactivateUser:a,isDeActivatingUser:r}=go(),i=Tt(),l=async()=>{try{await a({payload:t,successCallback:()=>{i.invalidateQueries({queryKey:["positionEmployees"],exact:!0}),n()}})}catch{}};return s.jsx(ho,{open:e,onOpenChange:n,children:s.jsxs(po,{children:[s.jsxs(fo,{children:[s.jsx(vo,{children:"Remove team member from this position?"}),s.jsxs(xo,{children:["This will mark ",s.jsx("strong",{children:o})," as Deactivate from this organization. This action can be reversed only by Activating From Archived User By Contacting the Administrator."]})]}),s.jsxs(bo,{children:[s.jsx(yo,{disabled:r,children:"Cancel"}),s.jsxs(He,{variant:"destructive",onClick:l,disabled:r,children:[r&&s.jsx(Rt,{className:"h-4 w-4 mr-2 animate-spin"}),"Confirm"]})]})]})})},zp=(e,n)=>{const[t,o]=y.useState(""),[a,r]=y.useState({...n,take:3e3}),[i,l]=y.useState(!1),d=Bt(),{data:c,isLoading:u,error:g,refetch:m}=zt({queryKey:["organizationEmployees",e,a],queryFn:async()=>{if(!e)throw new Error("Organization ID is required");return(await Du.getEmployeesWithOrganizationById(e,a)).data},enabled:!!e});y.useEffect(()=>{c!=null&&c.count&&!i&&(r(f=>({...f,take:c.count})),l(!0))},[c==null?void 0:c.count,i]);const h=y.useMemo(()=>{if(!(c!=null&&c.items))return[];const f=c.items.reduce((x,b)=>(x.find(w=>w.id===b.id)||x.push(b),x),[]);if(!t.trim())return f;const v=t.toLowerCase().trim();return f.filter(x=>{var F,E,V,L,B,_,D,O;const b=((F=x.user.name.am)==null?void 0:F.toLowerCase())||"",w=((E=x.user.name.en)==null?void 0:E.toLowerCase())||"",C=((V=d(x.user.name))==null?void 0:V.toLowerCase())||"",j=((L=x.name.am)==null?void 0:L.toLowerCase())||"",M=((B=x.name.en)==null?void 0:B.toLowerCase())||"",k=((_=d(x.name))==null?void 0:_.toLowerCase())||"",S=((D=x.user.email)==null?void 0:D.toLowerCase())||"",T=((O=x.user.phoneNumber)==null?void 0:O.toLowerCase())||"",N=x.employeePositions?.map(P=>{var $;return(($=d(P.position.name))==null?void 0:$.toLowerCase())||""}).join(" ");return b.includes(v)||w.includes(v)||C.includes(v)||j.includes(v)||M.includes(v)||k.includes(v)||S.includes(v)||T.includes(v)||N.includes(v)})},[c==null?void 0:c.items,t,d]),p=y.useMemo(()=>c!=null&&c.items?c.items.reduce((f,v)=>(f.find(x=>x.id===v.id)||f.push(v),f),[]):[],[c==null?void 0:c.items]);return{employees:p,filteredEmployees:h,totalCount:p.length,filteredCount:h.length,searchQuery:t,setSearchQuery:o,isLoading:u,error:g,refetch:m}},$p=(e,n)=>{var r,i,l,d,c,u,g,m,h,p,f,v,x;const t=e.employeePositions[0],o=((i=(r=e==null?void 0:e.user)==null?void 0:r.name)==null?void 0:i.en)||((d=(l=e==null?void 0:e.user)==null?void 0:l.name)==null?void 0:d.am)||"",a=((u=(c=t==null?void 0:t.position)==null?void 0:c.name)==null?void 0:u.en)||((m=(g=t==null?void 0:t.position)==null?void 0:g.name)==null?void 0:m.am)||"";return{organizationId:n,status:"Active",id:e.id,isCurrent:!0,name:t?`${o} - ${a}`:null,user:{id:((h=e==null?void 0:e.user)==null?void 0:h.id)??"",name:((p=e==null?void 0:e.user)==null?void 0:p.name)??{en:"",am:""},username:((v=(f=e==null?void 0:e.user)==null?void 0:f.email)==null?void 0:v.split("@")[0])??"",email:((x=e==null?void 0:e.user)==null?void 0:x.email)??"",userType:"employee",sharepointId:null,status:"pending",phoneNumber:"",hasSetPassword:!1}}},Lp=({organizationId:e,isOpen:n,onClose:t})=>{const{filteredEmployees:o,totalCount:a,filteredCount:r,searchQuery:i,setSearchQuery:l,isLoading:d,error:c}=zp(e),u=y.useMemo(()=>e?o?.map(p=>$p(p,e)):[],[o,e]),g=async p=>{const f=Jt.language;try{p.user.status==="pending"?Pe.loading(R("search.resendingVerification")):Pe.loading(R("search.sendingInvitation")),await vl({email:p.user.email,phoneNumber:p.user.phoneNumber});const v=f==="en"?p.user.name.en:p.user.name.am;p.user.status==="pending"?Pe.success(R("search.verificationCodeResent"),{description:R("search.verificationCodeSentTo",{name:v}),duration:4e3}):Pe.success(R("search.invitationSent"),{description:R("search.invitationSentTo",{name:v}),duration:4e3})}catch(v){const x=v instanceof Error?v.message:"Unknown error",b=p.user.status==="pending"?R("search.failedToResend"):R("search.failedToSendInvitation");Pe.error("Error",{description:`${b}: ${x}`,duration:4e3})}},m=(p,f,v,x)=>{window.confirm(R("search.confirmRemoveEmployee",{name:x}))&&Pe.info(R("search.removeFunctionalityNotImplemented"))},h=()=>d?s.jsx("div",{className:"flex justify-center py-12",children:s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 border-4 border-t-blue-500 border-blue-200 rounded-full animate-spin mb-2"}),s.jsx("p",{className:"text-sm text-gray-500",children:R("search.searchingEmployees")})]})}):c?s.jsxs("div",{className:"text-center py-12 text-red-500",children:[s.jsx(ks,{className:"h-12 w-12 mx-auto mb-2"}),s.jsx("p",{className:"text-sm font-medium",children:R("search.errorLoadingEmployees")}),s.jsx("p",{className:"text-xs mt-1",children:c instanceof Error?c.message:"Unknown error"})]}):o.length===0&&i.trim()?s.jsxs("div",{className:"text-center py-12 text-gray-500",children:[s.jsx(Mt,{className:"h-12 w-12 mx-auto mb-2 text-gray-300"}),s.jsx("p",{className:"text-sm font-medium",children:R("search.noEmployeesFound")}),s.jsx("p",{className:"text-xs mt-1 text-gray-400",children:R("search.tryDifferentKeywords")})]}):o.length===0?s.jsxs("div",{className:"text-center py-12 text-gray-500",children:[s.jsx(Ft,{className:"h-12 w-12 mx-auto mb-2 text-gray-300"}),s.jsx("p",{className:"text-sm font-medium",children:R("search.startTypingToSearch")}),s.jsx("p",{className:"text-xs mt-1 text-gray-400",children:R("search.searchByNameEmailPhone")})]}):s.jsx(Ea,{departmentId:"",departmentName:R("search.allEmployees"),employees:u,isLoading:!1,searchQuery:"",onInviteEmployee:g,onDeleteEmployee:m});return s.jsx(yt,{open:n,onOpenChange:t,children:s.jsxs(wt,{className:"max-w-4xl max-h-[80vh] overflow-hidden",children:[s.jsxs(jt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(Ct,{className:"flex items-center gap-2",children:[s.jsx(Mt,{className:"h-5 w-5"}),R("search.searchAllEmployees")]}),s.jsx(He,{variant:"ghost",size:"icon",onClick:t,className:"h-6 w-6"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-3 top-3 h-4 w-4 text-gray-400"}),s.jsx(ze,{placeholder:R("search.searchByNameEmailPhonePosition"),className:"pl-10",value:i,onChange:p=>l(p.target.value),autoFocus:!0})]}),i.trim()&&s.jsx("div",{className:"text-sm text-gray-600",children:R("search.showingResults",{count:r,total:a,query:i})}),s.jsx("div",{className:"max-h-96 overflow-y-auto",children:h()})]})]})})},Vp=()=>{const{toast:e}=bl(),{softDeletePosition:n}=zu(),t=J=>{n(J)},[o,a]=y.useState(""),[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState(""),{user:g}=Xa(),m=y.useRef(null),h=Bt();Jt.language;const{exportUserData:p,getUnits:f,isExporting:v,isLoadingUnits:x,units:b}=Op(),[w,C]=y.useState(""),[j,M]=y.useState(!1),[k,S]=y.useState("xlsx"),[T,N]=y.useState(!1),F=g!=null&&g.employee&&g.employee.length>0?g.employee[0].organizationId:void 0,{organizations:E,isLoading:V}=hp({currentOrgId:F}),{selectedOrgId:L,selectedUnitId:B,selectedDepartmentId:_,selectedDepartmentName:D,breadcrumb:O,handleSelectOrganization:P,handleSelectUnit:$,handleSelectDepartment:z}=xp(E,h),[H]=y.useState(100),[ae,ie]=y.useState(0),{units:Q,isLoading:se,setUnits:te,fetchedUnits:Z}=pp(L,{take:H,skip:ae}),{data:I}=tr(L||""),Y=(()=>{var re;const J=((re=I==null?void 0:I.data)==null?void 0:re.items)??[];if(!Array.isArray(J)||J.length===0)return null;const Ae=J.find(Ke=>(Ke==null?void 0:Ke.organizationId)===L)??J[0],$e=Number(Ae==null?void 0:Ae.maximumNumberOfUnits);return Number.isFinite($e)?$e:null})(),{getChildren:ce}=Vn(),[ee,W]=y.useState("");y.useEffect(()=>{if(!B)return;Q?.some(Ae=>Ae.id===B)&&W(B)},[B,Q]),y.useEffect(()=>{W("")},[L]);const{data:me}=ce(ee||""),le=(()=>{const J=me==null?void 0:me.data;if(!J)return[];const Ae=Array.isArray(J)?J:J.items??[];return Array.isArray(Ae)?Ae?.map($e=>({id:$e.id,name:$e.name})):[]})(),de=new Set(le?.map(J=>J.id)),K=(()=>{const J=new Set,Ae=[];return[...Q,...le].forEach($e=>{$e!=null&&$e.id&&!J.has($e.id)&&(J.add($e.id),Ae.push({...$e,isRelated:de.has($e.id)}))}),Ae})(),[A,ne]=y.useState(!1),be=Y!==null&&Q.length<Y&&!!L,{departments:ve,isLoading:Se,setDepartments:we,positions:U}=fp(B),{employees:q,isLoading:oe,setEmployees:Ie,refetch:he}=vp(_),X=bp({selectedOrgId:L,selectedUnitId:B,toast:e}),_e=async J=>{try{J.status==="pending"?Pe.loading("Resending verification code..."):Pe.loading("Sending invitation..."),await vl({email:J.user.email,phoneNumber:J.user.phoneNumber});const Ae=typeof J.user.name=="string"?h(J.user.name):h(J.user.name)||"User";J.user.status==="pending"?Pe.success("Verification Code Resent",{description:`A new verification code has been sent to ${Ae}`,duration:4e3}):Pe.success("Invitation Sent",{description:`Invitation sent to ${Ae}`,duration:4e3}),he&&await he()}catch(Ae){const $e=Ae instanceof Error?Ae.message:"Unknown error";Pe.error("Error",{description:`Failed to ${J.status==="pending"?"resend verification code":"send invitation"}: ${$e}`,duration:4e3})}setTimeout(()=>{Pe.dismiss()},4e3)},Oe=()=>{m.current&&m.current.scrollBy({left:-200,behavior:"smooth"})},Xe=()=>{m.current&&m.current.scrollBy({left:200,behavior:"smooth"})},ot=async()=>{if(!F){Pe.error(R("organizationIdRequired"));return}try{const J=await f(F);J&&J.length>0?M(!0):Pe.error(R("noUnitsFound"))}catch{Pe.error(R("exportError"))}},et=async J=>{C(J),M(!1),await p(J,k),C("")};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsxs("div",{className:"p-4 border-b dark:border-gray-700",children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("h1",{className:"text-xl font-semibold text-gray-800 dark:text-gray-200",children:R("organization.userManagement")}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(cn,{value:k,onValueChange:J=>S(J),children:[s.jsx(dn,{className:"w-32 dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",children:s.jsx(un,{})}),s.jsxs(gn,{className:"dark:bg-gray-700 dark:border-gray-600",children:[s.jsx(Ot,{value:"xlsx",className:"dark:text-gray-200 dark:hover:bg-gray-600",children:"XLSX"}),s.jsx(Ot,{value:"csv",className:"dark:text-gray-200 dark:hover:bg-gray-600",children:"CSV"})]})]}),s.jsxs(He,{variant:"outline",size:"sm",onClick:ot,disabled:v||!F,className:"bg-primary-50 text-primary-700 border-primary-200 hover:bg-primary-100 dark:bg-primary-900/30 dark:text-primary-400 dark:border-primary-800 dark:hover:bg-primary-900/50",children:[s.jsx($u,{className:`h-4 w-4 mr-2 ${v?"animate-pulse":""}`}),v?R("exporting"):R("exportUserData")]})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Mt,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:"Search organizations, units, departments...",className:"pl-8 dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:o,onChange:J=>a(J.target.value)})]}),s.jsxs(He,{variant:"outline",size:"sm",onClick:()=>N(!0),disabled:!F,className:"bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100 whitespace-nowrap dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800 dark:hover:bg-blue-900/50",children:[s.jsx(Ft,{className:"h-4 w-4 mr-2"}),R("search.searchAllEmployees")]})]}),s.jsx("div",{className:"mt-4",children:s.jsx(yp,{breadcrumb:O,hasTeamMembers:_!=""&&q.length>0})})]}),s.jsx("div",{className:"flex-1 p-2 md:hidden",children:s.jsxs("div",{className:"relative h-[calc(100vh-180px)]",children:[s.jsx("button",{onClick:Oe,className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 bg-white dark:bg-gray-800 rounded-full shadow-md p-1","aria-label":"Scroll left",children:s.jsx(Lu,{className:"h-5 w-5 dark:text-gray-300"})}),s.jsxs("div",{ref:m,className:"flex overflow-x-auto gap-3 pb-4 snap-x snap-mandatory h-full scrollbar-hide",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:[s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm min-w-[90%] max-w-[90%] flex-shrink-0 snap-center h-full flex flex-col dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:R("organization.organizations")}),s.jsx("div",{className:"overflow-y-auto flex-1",children:s.jsx(Pi,{selectedOrgId:L,organizations:E,isLoading:V,searchQuery:o,onSelectOrganization:J=>{te([]),we([]),Ie([]),P(J)},canCreateUnitForOrg:J=>J===L&&be,onCreateUnit:()=>ne(!0)})})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm min-w-[90%] max-w-[90%] flex-shrink-0 snap-center h-full flex flex-col dark:border-gray-700",children:[s.jsxs("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700 flex items-center justify-between gap-2",children:[s.jsx("span",{children:R("contentManagement.Units")}),s.jsxs("div",{className:"flex items-center gap-2",children:[Y!==null&&s.jsxs("span",{className:"text-xs font-normal px-2 py-0.5 rounded-full bg-primary-50 text-primary-700 dark:bg-primary-900/30 dark:text-primary-300 border border-primary-200 dark:border-primary-800",children:[K.length,"/",Y]}),be&&s.jsxs(He,{size:"sm",variant:"outline",onClick:()=>ne(!0),className:"h-7 px-2 text-xs border-primary-500 text-primary-700 hover:bg-primary-50 dark:border-primary-700 dark:text-primary-300 dark:hover:bg-primary-900/30",children:[s.jsx(Ss,{className:"h-3.5 w-3.5 mr-1"}),R("contentManagement.createUnit","Create Unit")]})]})]}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:R("search.searchUnits","Search units..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:r,onChange:J=>i(J.target.value)})]})}),s.jsx("div",{className:"overflow-y-auto flex-1",children:s.jsx(Ei,{organizationId:L,selectedUnitId:B,onSelectUnit:J=>{we([]),Ie([]),$(J,K)},units:K,isLoading:se,searchQuery:r,onAddDepartment:X.unit.onAddDepartment,onEditUnit:X.unit.onEditUnit,onDeleteUnit:X.unit.onDeleteUnit,onAddFromSubCity:X.unit.onAddFromSubCity})})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm min-w-[90%] max-w-[90%] flex-shrink-0 snap-center h-full flex flex-col dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:R("userIncoming.Departments")}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:R("search.searchDepartments","Search departments..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:l,onChange:J=>d(J.target.value)})]})}),s.jsx("div",{className:"overflow-y-auto flex-1",children:s.jsx(Oi,{unitId:B,selectedDepartmentId:_,onSelectDepartment:J=>{J!==_&&(Ie([]),z(J,ve))},departments:ve,positions:U,isLoading:Se,searchQuery:l,onAddUser:X.department.onAddUserUnderDepartment,onViewUsers:X.department.onViewUsers,onAddSubDepartment:X.department.onAddSubDepartment,onEditDepartment:X.department.onEditDepartment,onDeleteDepartment:X.department.onDeleteDepartment,onArchiveDepartment:t,onDelegate:X.department.onDelegate,onAssignUser:X.department.onAssignUser,onMoveDepartment:X.department.onMoveDepartment})})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm min-w-[90%] max-w-[90%] flex-shrink-0 snap-center h-full flex flex-col dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:R("contentManagement.teamMember")}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:R("search.searchEmployees","Search employees..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:c,onChange:J=>u(J.target.value)})]})}),s.jsx("div",{className:"overflow-y-auto flex-1",children:s.jsx(Ea,{departmentId:_,departmentName:D,employees:q,isLoading:oe,searchQuery:c,onDeleteEmployee:X.teamMember.onDeleteTeamMember,onInviteEmployee:_e,onDeactivateTeamMember:X.teamMember.onDeactivateTeamMember})})]})]}),s.jsx("button",{onClick:Xe,className:"absolute right-0 top-1/2 -translate-y-1/2 z-10 bg-white dark:bg-gray-800 rounded-full shadow-md p-1","aria-label":"Scroll right",children:s.jsx(eo,{className:"h-5 w-5 dark:text-gray-300"})})]})}),s.jsxs("div",{className:"hidden md:flex flex-1 p-4 flex-col lg:grid lg:grid-cols-4 lg:gap-4",children:[s.jsxs("div",{className:"lg:col-span-3 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:R("organization.organizations")}),s.jsx(Pi,{selectedOrgId:L,organizations:E,isLoading:V,searchQuery:o,onSelectOrganization:J=>{te([]),we([]),Ie([]),P(J)},canCreateUnitForOrg:J=>J===L&&be,onCreateUnit:()=>ne(!0)})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm dark:border-gray-700",children:[s.jsxs("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700 flex items-center justify-between gap-2",children:[s.jsx("span",{children:R("contentManagement.Units")}),Y!==null&&s.jsxs("span",{className:"text-xs font-normal px-2 py-0.5 rounded-full bg-primary-50 text-primary-700 dark:bg-primary-900/30 dark:text-primary-300 border border-primary-200 dark:border-primary-800",children:[K.length,"/",Y]})]}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:R("search.searchUnits","Search units..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:r,onChange:J=>i(J.target.value)})]})}),s.jsx(Ei,{organizationId:L,selectedUnitId:B,onSelectUnit:J=>{we([]),Ie([]),$(J,K)},units:K,isLoading:se,searchQuery:r,onAddDepartment:X.unit.onAddDepartment,onEditUnit:X.unit.onEditUnit,onDeleteUnit:X.unit.onDeleteUnit,onAddFromSubCity:X.unit.onAddFromSubCity})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:R("userIncoming.Departments")}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:R("search.searchDepartments","Search departments..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:l,onChange:J=>d(J.target.value)})]})}),s.jsx(Oi,{unitId:B,selectedDepartmentId:_,onSelectDepartment:J=>{J!==_&&(Ie([]),z(J,ve))},departments:ve,positions:U,isLoading:Se,searchQuery:l,onAddUser:X.department.onAddUserUnderDepartment,onViewUsers:X.department.onViewUsers,onAddSubDepartment:X.department.onAddSubDepartment,onEditDepartment:X.department.onEditDepartment,onDeleteDepartment:X.department.onDeleteDepartment,onArchiveDepartment:t,onDelegate:X.department.onDelegate,onAssignUser:X.department.onAssignUser,onMoveDepartment:X.department.onMoveDepartment})]})]}),s.jsxs("div",{className:"mt-4 lg:mt-0 border rounded-md p-4 bg-white dark:bg-gray-800 shadow-sm dark:border-gray-700",children:[s.jsxs("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-4 border-b pb-2 flex items-center dark:border-gray-700",children:[s.jsx(Ft,{className:"mr-2 h-4 w-4 text-gray-500 dark:text-gray-400"}),R("contentManagement.teamMember")]}),s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"relative",children:[s.jsx(Mt,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:R("search.searchEmployees","Search employees..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:c,onChange:J=>u(J.target.value)})]})}),s.jsx(Ea,{departmentId:_,departmentName:D,employees:q,isLoading:oe,searchQuery:c,onDeleteEmployee:X.teamMember.onDeleteTeamMember,onInviteEmployee:_e,onDeactivateTeamMember:X.teamMember.onDeactivateTeamMember})]})]}),X.dialogs.userUnderDepartment.isOpen&&s.jsx(jp,{...X.dialogs.userUnderDepartment}),X.dialogs.editUnit.isOpen&&s.jsx(Mp,{...X.dialogs.editUnit,units:Z}),X.dialogs.deleteUnit.isOpen&&s.jsx(Rp,{...X.dialogs.deleteUnit}),X.dialogs.addFromSubCity.isOpen&&s.jsx(kp,{...X.dialogs.addFromSubCity}),A&&s.jsx(Tp,{isOpen:A,onClose:()=>ne(!1),organizationId:L}),X.dialogs.department.isOpen&&s.jsx(ap,{...X.dialogs.department,organizationId:L}),X.dialogs.editDepartment.isOpen&&s.jsx(Sp,{...X.dialogs.editDepartment,postions:U}),X.dialogs.deleteDepartment.isOpen&&s.jsx(Ip,{...X.dialogs.deleteDepartment}),X.dialogs.subDepartment.isOpen&&s.jsx(up,{...X.dialogs.subDepartment}),X.dialogs.moveDepartment.isOpen&&s.jsx(Ep,{isOpen:X.dialogs.moveDepartment.isOpen,onClose:X.dialogs.moveDepartment.onClose,departmentId:X.dialogs.moveDepartment.departmentId,organizationId:L,unitId:B}),X.dialogs.user.isOpen&&s.jsx(ip,{...X.dialogs.user}),X.dialogs.viewUsers.isOpen&&s.jsx(cp,{...X.dialogs.viewUsers}),X.dialogs.assignUser.isOpen&&s.jsx(mp,{...X.dialogs.assignUser}),X.dialogs.deleteTeamMember.isOpen&&s.jsx(Fp,{...X.dialogs.deleteTeamMember}),X.dialogs.deactivateTeamMember.isOpen&&s.jsx(Ap,{isOpen:X.dialogs.deactivateTeamMember.isOpen,onClose:X.dialogs.deactivateTeamMember.onClose,userId:X.dialogs.deactivateTeamMember.userId,teamMemberName:X.dialogs.deactivateTeamMember.teamMemberName}),j&&s.jsx("div",{className:"fixed inset-0 bg-black/40 dark:bg-black/60 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4 dark:text-white",children:R("selectUnit")}),x?s.jsxs("div",{className:"text-center py-4",children:[s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),s.jsx("p",{className:"mt-2 dark:text-gray-400",children:R("loadingUnits")})]}):s.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:b?.map(J=>{var Ae;if(typeof J=="object"&&J!==null&&"id"in J&&"name"in J){const $e=J;return s.jsxs("button",{onClick:()=>et($e.id),className:"w-full text-left p-3 rounded border border-gray-200 hover:bg-gray-100 hover:shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer dark:border-gray-600 dark:hover:bg-gray-700 dark:focus:ring-blue-400",children:[s.jsx("div",{className:"font-medium dark:text-gray-200",children:((Ae=$e.name)==null?void 0:Ae.en)||$e.name}),$e.description&&s.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:$e.description})]},$e.id)}return null})}),s.jsx("div",{className:"flex justify-end mt-4",children:s.jsx(He,{variant:"outline",onClick:()=>M(!1),className:"dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700",children:R("common.cancel")})})]})}),s.jsx(Lp,{organizationId:F,isOpen:T,onClose:()=>N(!1)})]})};/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/var Bp={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Me=(e,n,t,o)=>{const a=y.forwardRef(({color:r="currentColor",size:i=24,stroke:l=2,title:d,className:c,children:u,...g},m)=>y.createElement("svg",{ref:m,...Bp[e],width:i,height:i,className:["tabler-icon",`tabler-icon-${n}`,c].join(" "),...e==="filled"?{fill:r}:{strokeWidth:l,stroke:r},...g},[d&&y.createElement("title",{key:"svg-title"},d),...o?.map(([h,p])=>y.createElement(h,p)),...Array.isArray(u)?u:[u]]));return a.displayName=`${t}`,a};/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Up=[["path",{d:"M6 4l-3 3l3 3",key:"svg-0"}],["path",{d:"M18 4l3 3l-3 3",key:"svg-1"}],["path",{d:"M4 16a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -2",key:"svg-2"}],["path",{d:"M10 7h-7",key:"svg-3"}],["path",{d:"M21 7h-7",key:"svg-4"}]],Hp=Me("outline","arrow-autofit-content","ArrowAutofitContent",Up);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Gp=[["path",{d:"M18 9l3 3l-3 3",key:"svg-0"}],["path",{d:"M15 12h6",key:"svg-1"}],["path",{d:"M6 9l-3 3l3 3",key:"svg-2"}],["path",{d:"M3 12h6",key:"svg-3"}],["path",{d:"M9 18l3 3l3 -3",key:"svg-4"}],["path",{d:"M12 15v6",key:"svg-5"}],["path",{d:"M15 6l-3 -3l-3 3",key:"svg-6"}],["path",{d:"M12 3v6",key:"svg-7"}]],vc=Me("outline","arrows-move","ArrowsMove",Gp);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const qp=[["path",{d:"M3 9l4 -4l4 4m-4 -4v14",key:"svg-0"}],["path",{d:"M21 15l-4 4l-4 -4m4 4v-14",key:"svg-1"}]],Wp=Me("outline","arrows-sort","ArrowsSort",qp);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Kp=[["path",{d:"M4 4h16",key:"svg-0"}],["path",{d:"M4 20h16",key:"svg-1"}]],Yp=Me("outline","baseline-density-large","BaselineDensityLarge",Kp);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Qp=[["path",{d:"M4 20h16",key:"svg-0"}],["path",{d:"M4 12h16",key:"svg-1"}],["path",{d:"M4 4h16",key:"svg-2"}]],Xp=Me("outline","baseline-density-medium","BaselineDensityMedium",Qp);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Zp=[["path",{d:"M4 3h16",key:"svg-0"}],["path",{d:"M4 9h16",key:"svg-1"}],["path",{d:"M4 15h16",key:"svg-2"}],["path",{d:"M4 21h16",key:"svg-3"}]],Jp=Me("outline","baseline-density-small","BaselineDensitySmall",Zp);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const ef=[["path",{d:"M7 5a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -10",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]],tf=Me("outline","box-multiple","BoxMultiple",ef);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const nf=[["path",{d:"M3 9a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-9",key:"svg-0"}],["path",{d:"M8 7v-2a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v2",key:"svg-1"}]],sf=Me("outline","briefcase-2","Briefcase2",nf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const of=[["path",{d:"M8 9l5 5v7h-5v-4m0 4h-5v-7l5 -5m1 1v-6a1 1 0 0 1 1 -1h10a1 1 0 0 1 1 1v17h-8",key:"svg-0"}],["path",{d:"M13 7l0 .01",key:"svg-1"}],["path",{d:"M17 7l0 .01",key:"svg-2"}],["path",{d:"M17 11l0 .01",key:"svg-3"}],["path",{d:"M17 15l0 .01",key:"svg-4"}]],af=Me("outline","building-community","BuildingCommunity",of);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const rf=[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M9 8l1 0",key:"svg-1"}],["path",{d:"M9 12l1 0",key:"svg-2"}],["path",{d:"M9 16l1 0",key:"svg-3"}],["path",{d:"M14 8l1 0",key:"svg-4"}],["path",{d:"M14 12l1 0",key:"svg-5"}],["path",{d:"M14 16l1 0",key:"svg-6"}],["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16",key:"svg-7"}]],xc=Me("outline","building","Building",rf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const lf=[["path",{d:"M4 4h6v6h-6l0 -6",key:"svg-0"}],["path",{d:"M14 4h6v6h-6l0 -6",key:"svg-1"}],["path",{d:"M4 14h6v6h-6l0 -6",key:"svg-2"}],["path",{d:"M14 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-3"}]],cf=Me("outline","category","Category",lf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const df=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],uf=Me("outline","chevron-down","ChevronDown",df);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const gf=[["path",{d:"M7 6v12",key:"svg-0"}],["path",{d:"M18 6l-6 6l6 6",key:"svg-1"}]],mf=Me("outline","chevron-left-pipe","ChevronLeftPipe",gf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const hf=[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]],pf=Me("outline","chevron-left","ChevronLeft",hf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const ff=[["path",{d:"M6 6l6 6l-6 6",key:"svg-0"}],["path",{d:"M17 5v13",key:"svg-1"}]],vf=Me("outline","chevron-right-pipe","ChevronRightPipe",ff);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const xf=[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]],Br=Me("outline","chevron-right","ChevronRight",xf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const bf=[["path",{d:"M7 7l5 5l5 -5",key:"svg-0"}],["path",{d:"M7 13l5 5l5 -5",key:"svg-1"}]],yf=Me("outline","chevrons-down","ChevronsDown",bf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const wf=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M10 10l4 4m0 -4l-4 4",key:"svg-1"}]],jf=Me("outline","circle-x","CircleX",wf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Cf=[["path",{d:"M8 6h12",key:"svg-0"}],["path",{d:"M6 12h12",key:"svg-1"}],["path",{d:"M4 18h12",key:"svg-2"}]],Sf=Me("outline","clear-all","ClearAll",Cf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const _f=[["path",{d:"M4 6l5.5 0",key:"svg-0"}],["path",{d:"M4 10l5.5 0",key:"svg-1"}],["path",{d:"M4 14l5.5 0",key:"svg-2"}],["path",{d:"M4 18l5.5 0",key:"svg-3"}],["path",{d:"M14.5 6l5.5 0",key:"svg-4"}],["path",{d:"M14.5 10l5.5 0",key:"svg-5"}],["path",{d:"M14.5 14l5.5 0",key:"svg-6"}],["path",{d:"M14.5 18l5.5 0",key:"svg-7"}]],Mf=Me("outline","columns","Columns",_f);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Rf=[["path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M10 14a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M14 4l0 4l-6 0l0 -4",key:"svg-2"}]],Nf=Me("outline","device-floppy","DeviceFloppy",Rf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const kf=[["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M11 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M11 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]],Df=Me("outline","dots-vertical","DotsVertical",kf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Tf=[["path",{d:"M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]],Ur=Me("outline","dots","Dots",Tf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const If=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],Ff=Me("outline","download","Download",If);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Pf=[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]],on=Me("outline","edit","Edit",Pf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Ef=[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],Of=Me("outline","eye-off","EyeOff",Ef);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Af=[["path",{d:"M12 20l-3 1v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v1.5",key:"svg-0"}],["path",{d:"M17.001 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M19.001 15.5v1.5",key:"svg-2"}],["path",{d:"M19.001 21v1.5",key:"svg-3"}],["path",{d:"M22.032 17.25l-1.299 .75",key:"svg-4"}],["path",{d:"M17.27 20l-1.3 .75",key:"svg-5"}],["path",{d:"M15.97 17.25l1.3 .75",key:"svg-6"}],["path",{d:"M20.733 20l1.3 .75",key:"svg-7"}]],zf=Me("outline","filter-cog","FilterCog",Af);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const $f=[["path",{d:"M8 4h12v2.172a2 2 0 0 1 -.586 1.414l-3.914 3.914m-.5 3.5v4l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",key:"svg-0"}],["path",{d:"M3 3l18 18",key:"svg-1"}]],Lf=Me("outline","filter-off","FilterOff",$f);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Vf=[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",key:"svg-0"}]],Bf=Me("outline","filter","Filter",Vf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Uf=[["path",{d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2",key:"svg-0"}]],Hf=Me("outline","folder","Folder",Uf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Gf=[["path",{d:"M4 9a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M4 15a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M11 9a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M11 15a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M18 9a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M18 15a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]],qf=Me("outline","grip-horizontal","GripHorizontal",Gf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Wf=[["path",{d:"M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]],bc=Me("outline","grip-vertical","GripVertical",Wf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Kf=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 9h.01",key:"svg-1"}],["path",{d:"M11 12h1v4h1",key:"svg-2"}]],Yf=Me("outline","info-circle","InfoCircle",Kf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Qf=[["path",{d:"M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-1"}],["path",{d:"M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-2"}],["path",{d:"M14 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-3"}]],Xf=Me("outline","layout-grid","LayoutGrid",Qf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Zf=[["path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",key:"svg-0"}],["path",{d:"M9 4v16",key:"svg-1"}],["path",{d:"M15 10l-2 2l2 2",key:"svg-2"}]],Jf=Me("outline","layout-sidebar-left-collapse","LayoutSidebarLeftCollapse",Zf);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const e0=[["path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",key:"svg-0"}],["path",{d:"M9 4v16",key:"svg-1"}],["path",{d:"M14 10l2 2l-2 2",key:"svg-2"}]],t0=Me("outline","layout-sidebar-left-expand","LayoutSidebarLeftExpand",e0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const n0=[["path",{d:"M9 6l11 0",key:"svg-0"}],["path",{d:"M9 12l11 0",key:"svg-1"}],["path",{d:"M9 18l11 0",key:"svg-2"}],["path",{d:"M5 6l0 .01",key:"svg-3"}],["path",{d:"M5 12l0 .01",key:"svg-4"}],["path",{d:"M5 18l0 .01",key:"svg-5"}]],s0=Me("outline","list","List",n0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const o0=[["path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10",key:"svg-0"}],["path",{d:"M3 7l9 6l9 -6",key:"svg-1"}]],a0=Me("outline","mail","Mail",o0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const r0=[["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}]],i0=Me("outline","maximize","Maximize",r0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const l0=[["path",{d:"M15 19v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M15 5v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M5 15h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M5 9h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}]],c0=Me("outline","minimize","Minimize",l0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const d0=[["path",{d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5l1.5 -2.5l5 2v4a2 2 0 0 1 -2 2a16 16 0 0 1 -15 -15a2 2 0 0 1 2 -2",key:"svg-0"}]],u0=Me("outline","phone","Phone",d0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const g0=[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]],Hr=Me("outline","photo","Photo",g0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const m0=[["path",{d:"M3 3l18 18",key:"svg-0"}],["path",{d:"M15 4.5l-3.249 3.249m-2.57 1.433l-2.181 .818l-1.5 1.5l7 7l1.5 -1.5l.82 -2.186m1.43 -2.563l3.25 -3.251",key:"svg-1"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-2"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-3"}]],h0=Me("outline","pinned-off","PinnedOff",m0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const p0=[["path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6",key:"svg-0"}],["path",{d:"M12 16l0 5",key:"svg-1"}],["path",{d:"M8 4l8 0",key:"svg-2"}]],f0=Me("outline","pinned","Pinned",p0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const v0=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],rn=Me("outline","plus","Plus",v0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const x0=[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]],yc=Me("outline","refresh","Refresh",x0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const b0=[["path",{d:"M5.039 5.062a7 7 0 0 0 9.91 9.89m1.584 -2.434a7 7 0 0 0 -9.038 -9.057",key:"svg-0"}],["path",{d:"M3 3l18 18",key:"svg-1"}]],y0=Me("outline","search-off","SearchOff",b0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const w0=[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]],ys=Me("outline","search","Search",w0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const j0=[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]],C0=Me("outline","settings","Settings",j0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const S0=[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],_0=Me("outline","sort-ascending","SortAscending",S0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const M0=[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],R0=Me("outline","sort-descending","SortDescending",M0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const N0=[["path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14",key:"svg-0"}],["path",{d:"M3 10h18",key:"svg-1"}],["path",{d:"M10 3v18",key:"svg-2"}]],k0=Me("outline","table","Table",N0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const D0=[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]],ln=Me("outline","trash","Trash",D0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const T0=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 10a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855",key:"svg-2"}]],I0=Me("outline","user-circle","UserCircle",T0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const F0=[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4",key:"svg-3"}]],Gr=Me("outline","user-plus","UserPlus",F0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const P0=[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]],E0=Me("outline","user","User",P0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const O0=[["path",{d:"M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"svg-2"}],["path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85",key:"svg-3"}]],Po=Me("outline","users","Users",O0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const A0=[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]],wc=Me("outline","x","X",A0);/**
* @license @tabler/icons-react v3.44.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const z0=[["path",{d:"M2 16.667a2.667 2.667 0 0 1 2.667 -2.667h2.666a2.667 2.667 0 0 1 2.667 2.667v2.666a2.667 2.667 0 0 1 -2.667 2.667h-2.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M14 16.667a2.667 2.667 0 0 1 2.667 -2.667h2.666a2.667 2.667 0 0 1 2.667 2.667v2.666a2.667 2.667 0 0 1 -2.667 2.667h-2.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-1"}],["path",{d:"M8 4.667a2.667 2.667 0 0 1 2.667 -2.667h2.666a2.667 2.667 0 0 1 2.667 2.667v2.666a2.667 2.667 0 0 1 -2.667 2.667h-2.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-2"}],["path",{d:"M12 8a1 1 0 0 0 -1 1v2h-3c-1.645 0 -3 1.355 -3 3v1a1 1 0 0 0 1 1a1 1 0 0 0 1 -1v-1c0 -.564 .436 -1 1 -1h8c.564 0 1 .436 1 1v1a1 1 0 0 0 1 1a1 1 0 0 0 1 -1v-1c0 -1.645 -1.355 -3 -3 -3h-3v-2a1 1 0 0 0 -1 -1z",key:"svg-3"}]],$0=Me("filled","sitemap-filled","SitemapFilled",z0);/**
* table-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function yn(e,n){return typeof e=="function"?e(n):e}function Dt(e,n){return t=>{n.setState(o=>({...o,[e]:yn(t,o[e])}))}}function Eo(e){return e instanceof Function}function L0(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function jc(e,n){const t=[],o=a=>{a.forEach(r=>{t.push(r);const i=n(r);i!=null&&i.length&&o(i)})};return o(e),t}function Ne(e,n,t){let o=[],a;return r=>{let i;t.key&&t.debug&&(i=Date.now());const l=e(r);if(!(l.length!==o.length||l?.some((u,g)=>o[g]!==u)))return a;o=l;let c;if(t.key&&t.debug&&(c=Date.now()),a=n(...l),t==null||t.onChange==null||t.onChange(a),t.key&&t.debug&&t!=null&&t.debug()){const u=Math.round((Date.now()-i)*100)/100,m=Math.round((Date.now()-c)*100)/100/16,h=(p,f)=>{for(p=String(p);p.length<f;)p=" "+p;return p}}return a}}function ke(e,n,t,o){return{debug:()=>{var a;return(a=e==null?void 0:e.debugAll)!=null?a:e[n]},key:!1,onChange:o}}function V0(e,n,t,o){const a=()=>{var i;return(i=r.getValue())!=null?i:e.options.renderFallbackValue},r={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(o),renderValue:a,getContext:Ne(()=>[e,t,n,r],(i,l,d,c)=>({table:i,column:l,row:d,cell:c,getValue:c.getValue,renderValue:c.renderValue}),ke(e.options,"debugCells"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(r,t,n,e)},{}),r}function B0(e,n,t,o){var a,r;const l={...e._getDefaultColumnDef(),...n},d=l.accessorKey;let c=(a=(r=l.id)!=null?r:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?a:typeof l.header=="string"?l.header:void 0,u;if(l.accessorFn?u=l.accessorFn:d&&(d.includes(".")?u=m=>{let h=m;for(const f of d.split(".")){var p;h=(p=h)==null?void 0:p[f]}return h}:u=m=>m[l.accessorKey]),!c)throw new Error;let g={id:`${String(c)}`,accessorFn:u,parent:o,depth:t,columnDef:l,columns:[],getFlatColumns:Ne(()=>[!0],()=>{var m;return[g,...(m=g.columns)==null?void 0:m.flatMap(h=>h.getFlatColumns())]},ke(e.options,"debugColumns")),getLeafColumns:Ne(()=>[e._getOrderColumnsFn()],m=>{var h;if((h=g.columns)!=null&&h.length){let p=g.columns.flatMap(f=>f.getLeafColumns());return m(p)}return[g]},ke(e.options,"debugColumns"))};for(const m of e._features)m.createColumn==null||m.createColumn(g,e);return g}const ht="debugHeaders";function $i(e,n,t){var o;let r={id:(o=t.id)!=null?o:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],l=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders?.map(l),i.push(d)};return l(r),i},getContext:()=>({table:e,header:r,column:n})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(r,e)}),r}const U0={createTable:e=>{e.getHeaderGroups=Ne(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,a)=>{var r,i;const l=(r=o==null?void 0:o?.map(g=>t.find(m=>m.id===g)).filter(Boolean))!=null?r:[],d=(i=a==null?void 0:a?.map(g=>t.find(m=>m.id===g)).filter(Boolean))!=null?i:[],c=t.filter(g=>!(o!=null&&o.includes(g.id))&&!(a!=null&&a.includes(g.id)));return Ls(n,[...l,...c,...d],e)},ke(e.options,ht)),e.getCenterHeaderGroups=Ne(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,a)=>(t=t.filter(r=>!(o!=null&&o.includes(r.id))&&!(a!=null&&a.includes(r.id))),Ls(n,t,e,"center")),ke(e.options,ht)),e.getLeftHeaderGroups=Ne(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,o)=>{var a;const r=(a=o==null?void 0:o?.map(i=>t.find(l=>l.id===i)).filter(Boolean))!=null?a:[];return Ls(n,r,e,"left")},ke(e.options,ht)),e.getRightHeaderGroups=Ne(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,o)=>{var a;const r=(a=o==null?void 0:o?.map(i=>t.find(l=>l.id===i)).filter(Boolean))!=null?a:[];return Ls(n,r,e,"right")},ke(e.options,ht)),e.getFooterGroups=Ne(()=>[e.getHeaderGroups()],n=>[...n].reverse(),ke(e.options,ht)),e.getLeftFooterGroups=Ne(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),ke(e.options,ht)),e.getCenterFooterGroups=Ne(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),ke(e.options,ht)),e.getRightFooterGroups=Ne(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),ke(e.options,ht)),e.getFlatHeaders=Ne(()=>[e.getHeaderGroups()],n=>n?.map(t=>t.headers).flat(),ke(e.options,ht)),e.getLeftFlatHeaders=Ne(()=>[e.getLeftHeaderGroups()],n=>n?.map(t=>t.headers).flat(),ke(e.options,ht)),e.getCenterFlatHeaders=Ne(()=>[e.getCenterHeaderGroups()],n=>n?.map(t=>t.headers).flat(),ke(e.options,ht)),e.getRightFlatHeaders=Ne(()=>[e.getRightHeaderGroups()],n=>n?.map(t=>t.headers).flat(),ke(e.options,ht)),e.getCenterLeafHeaders=Ne(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),ke(e.options,ht)),e.getLeftLeafHeaders=Ne(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),ke(e.options,ht)),e.getRightLeafHeaders=Ne(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),ke(e.options,ht)),e.getLeafHeaders=Ne(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,o)=>{var a,r,i,l,d,c;return[...(a=(r=n[0])==null?void 0:r.headers)!=null?a:[],...(i=(l=t[0])==null?void 0:l.headers)!=null?i:[],...(d=(c=o[0])==null?void 0:c.headers)!=null?d:[]]?.map(u=>u.getLeafHeaders()).flat()},ke(e.options,ht))}};function Ls(e,n,t,o){var a,r;let i=0;const l=function(m,h){h===void 0&&(h=1),i=Math.max(i,h),m.filter(p=>p.getIsVisible()).forEach(p=>{var f;(f=p.columns)!=null&&f.length&&l(p.columns,h+1)},0)};l(e);let d=[];const c=(m,h)=>{const p={depth:h,id:[o,`${h}`].filter(Boolean).join("_"),headers:[]},f=[];m.forEach(v=>{const x=[...f].reverse()[0],b=v.column.depth===p.depth;let w,C=!1;if(b&&v.column.parent?w=v.column.parent:(w=v.column,C=!0),x&&(x==null?void 0:x.column)===w)x.subHeaders.push(v);else{const j=$i(t,w,{id:[o,h,w.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${f.filter(M=>M.column===w).length}`:void 0,depth:h,index:f.length});j.subHeaders.push(v),f.push(j)}p.headers.push(v),v.headerGroup=p}),d.push(p),h>0&&c(f,h-1)},u=n?.map((m,h)=>$i(t,m,{depth:i,index:h}));c(u,i-1),d.reverse();const g=m=>m.filter(p=>p.column.getIsVisible())?.map(p=>{let f=0,v=0,x=[0];p.subHeaders&&p.subHeaders.length?(x=[],g(p.subHeaders).forEach(w=>{let{colSpan:C,rowSpan:j}=w;f+=C,x.push(j)})):f=1;const b=Math.min(...x);return v=v+b,p.colSpan=f,p.rowSpan=v,{colSpan:f,rowSpan:v}});return g((a=(r=d[0])==null?void 0:r.headers)!=null?a:[]),d}const ds=(e,n,t,o,a,r,i)=>{let l={id:n,index:o,original:t,depth:a,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(l._valuesCache.hasOwnProperty(d))return l._valuesCache[d];const c=e.getColumn(d);if(c!=null&&c.accessorFn)return l._valuesCache[d]=c.accessorFn(l.original,o),l._valuesCache[d]},getUniqueValues:d=>{if(l._uniqueValuesCache.hasOwnProperty(d))return l._uniqueValuesCache[d];const c=e.getColumn(d);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(l._uniqueValuesCache[d]=c.columnDef.getUniqueValues(l.original,o),l._uniqueValuesCache[d]):(l._uniqueValuesCache[d]=[l.getValue(d)],l._uniqueValuesCache[d])},renderValue:d=>{var c;return(c=l.getValue(d))!=null?c:e.options.renderFallbackValue},subRows:r??[],getLeafRows:()=>jc(l.subRows,d=>d.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let d=[],c=l;for(;;){const u=c.getParentRow();if(!u)break;d.push(u),c=u}return d.reverse()},getAllCells:Ne(()=>[e.getAllLeafColumns()],d=>d?.map(c=>V0(e,l,c,c.id)),ke(e.options,"debugRows")),_getAllCellsByColumnId:Ne(()=>[l.getAllCells()],d=>d.reduce((c,u)=>(c[u.column.id]=u,c),{}),ke(e.options,"debugRows"))};for(let d=0;d<e._features.length;d++){const c=e._features[d];c==null||c.createRow==null||c.createRow(l,e)}return l},H0={createColumn:(e,n)=>{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Cc=(e,n,t)=>{var o,a;const r=t==null||(o=t.toString())==null?void 0:o.toLowerCase();return!!(!((a=e.getValue(n))==null||(a=a.toString())==null||(a=a.toLowerCase())==null)&&a.includes(r))};Cc.autoRemove=e=>Qt(e);const Sc=(e,n,t)=>{var o;return!!(!((o=e.getValue(n))==null||(o=o.toString())==null)&&o.includes(t))};Sc.autoRemove=e=>Qt(e);const _c=(e,n,t)=>{var o;return((o=e.getValue(n))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(t==null?void 0:t.toLowerCase())};_c.autoRemove=e=>Qt(e);const Mc=(e,n,t)=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(t)};Mc.autoRemove=e=>Qt(e)||!(e!=null&&e.length);const Rc=(e,n,t)=>!t?.some(o=>{var a;return!((a=e.getValue(n))!=null&&a.includes(o))});Rc.autoRemove=e=>Qt(e)||!(e!=null&&e.length);const Nc=(e,n,t)=>t?.some(o=>{var a;return(a=e.getValue(n))==null?void 0:a.includes(o)});Nc.autoRemove=e=>Qt(e)||!(e!=null&&e.length);const kc=(e,n,t)=>e.getValue(n)===t;kc.autoRemove=e=>Qt(e);const Dc=(e,n,t)=>e.getValue(n)==t;Dc.autoRemove=e=>Qt(e);const qr=(e,n,t)=>{let[o,a]=t;const r=e.getValue(n);return r>=o&&r<=a};qr.resolveFilterValue=e=>{let[n,t]=e,o=typeof n!="number"?parseFloat(n):n,a=typeof t!="number"?parseFloat(t):t,r=n===null||Number.isNaN(o)?-1/0:o,i=t===null||Number.isNaN(a)?1/0:a;if(r>i){const l=r;r=i,i=l}return[r,i]};qr.autoRemove=e=>Qt(e)||Qt(e[0])&&Qt(e[1]);const sn={includesString:Cc,includesStringSensitive:Sc,equalsString:_c,arrIncludes:Mc,arrIncludesAll:Rc,arrIncludesSome:Nc,equals:kc,weakEquals:Dc,inNumberRange:qr};function Qt(e){return e==null||e===""}const G0={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Dt("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);return typeof o=="string"?sn.includesString:typeof o=="number"?sn.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?sn.equals:Array.isArray(o)?sn.arrIncludes:sn.weakEquals},e.getFilterFn=()=>{var t,o;return Eo(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(o=n.options.filterFns)==null?void 0:o[e.columnDef.filterFn])!=null?t:sn[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,o,a;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((o=n.options.enableColumnFilters)!=null?o:!0)&&((a=n.options.enableFilters)!=null?a:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(o=>o.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,o;return(t=(o=n.getState().columnFilters)==null?void 0:o.findIndex(a=>a.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(o=>{const a=e.getFilterFn(),r=o==null?void 0:o.find(u=>u.id===e.id),i=yn(t,r?r.value:void 0);if(Li(a,i,e)){var l;return(l=o==null?void 0:o.filter(u=>u.id!==e.id))!=null?l:[]}const d={id:e.id,value:i};if(r){var c;return(c=o==null?void 0:o?.map(u=>u.id===e.id?d:u))!=null?c:[]}return o!=null&&o.length?[...o,d]:[d]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const t=e.getAllLeafColumns(),o=a=>{var r;return(r=yn(n,a))==null?void 0:r.filter(i=>{const l=t.find(d=>d.id===i.id);if(l){const d=l.getFilterFn();if(Li(d,i.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(o)},e.resetColumnFilters=n=>{var t,o;e.setColumnFilters(n?[]:(t=(o=e.initialState)==null?void 0:o.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Li(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}const q0=(e,n,t)=>t.reduce((o,a)=>{const r=a.getValue(e);return o+(typeof r=="number"?r:0)},0),W0=(e,n,t)=>{let o;return t.forEach(a=>{const r=a.getValue(e);r!=null&&(o>r||o===void 0&&r>=r)&&(o=r)}),o},K0=(e,n,t)=>{let o;return t.forEach(a=>{const r=a.getValue(e);r!=null&&(o<r||o===void 0&&r>=r)&&(o=r)}),o},Y0=(e,n,t)=>{let o,a;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(o===void 0?i>=i&&(o=a=i):(o>i&&(o=i),a<i&&(a=i)))}),[o,a]},Q0=(e,n)=>{let t=0,o=0;if(n.forEach(a=>{let r=a.getValue(e);r!=null&&(r=+r)>=r&&(++t,o+=r)}),t)return o/t},X0=(e,n)=>{if(!n.length)return;const t=n?.map(r=>r.getValue(e));if(!L0(t))return;if(t.length===1)return t[0];const o=Math.floor(t.length/2),a=t.sort((r,i)=>r-i);return t.length%2!==0?a[o]:(a[o-1]+a[o])/2},Z0=(e,n)=>Array.from(new Set(n?.map(t=>t.getValue(e))).values()),J0=(e,n)=>new Set(n?.map(t=>t.getValue(e))).size,ev=(e,n)=>n.length,Ys={sum:q0,min:W0,max:K0,extent:Y0,mean:Q0,median:X0,unique:Z0,uniqueCount:J0,count:ev},tv={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Dt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(o=>o!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,o;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((o=n.options.enableGrouping)!=null?o:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);if(typeof o=="number")return Ys.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Ys.extent},e.getAggregationFn=()=>{var t,o;if(!e)throw new Error;return Eo(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(o=n.options.aggregationFns)==null?void 0:o[e.columnDef.aggregationFn])!=null?t:Ys[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,o;e.setGrouping(n?[]:(t=(o=e.initialState)==null?void 0:o.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const o=n.getColumn(t);return o!=null&&o.columnDef.getGroupingValue?(e._groupingValuesCache[t]=o.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,o)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var a;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((a=t.subRows)!=null&&a.length)}}};function nv(e,n,t){if(!(n!=null&&n.length)||!t)return e;const o=e.filter(r=>!n.includes(r.id));return t==="remove"?o:[...n?.map(r=>e.find(i=>i.id===r)).filter(Boolean),...o]}const sv={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Dt("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=Ne(t=>[ws(n,t)],t=>t.findIndex(o=>o.id===e.id),ke(n.options,"debugColumns")),e.getIsFirstColumn=t=>{var o;return((o=ws(n,t)[0])==null?void 0:o.id)===e.id},e.getIsLastColumn=t=>{var o;const a=ws(n,t);return((o=a[a.length-1])==null?void 0:o.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=Ne(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,o)=>a=>{let r=[];if(!(n!=null&&n.length))r=a;else{const i=[...n],l=[...a];for(;l.length&&i.length;){const d=i.shift(),c=l.findIndex(u=>u.id===d);c>-1&&r.push(l.splice(c,1)[0])}r=[...r,...l]}return nv(r,t,o)},ke(e.options,"debugTable"))}},oa=()=>({left:[],right:[]}),ov={getInitialState:e=>({columnPinning:oa(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Dt("columnPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{const o=e.getLeafColumns()?.map(a=>a.id).filter(Boolean);n.setColumnPinning(a=>{var r,i;if(t==="right"){var l,d;return{left:((l=a==null?void 0:a.left)!=null?l:[]).filter(g=>!(o!=null&&o.includes(g))),right:[...((d=a==null?void 0:a.right)!=null?d:[]).filter(g=>!(o!=null&&o.includes(g))),...o]}}if(t==="left"){var c,u;return{left:[...((c=a==null?void 0:a.left)!=null?c:[]).filter(g=>!(o!=null&&o.includes(g))),...o],right:((u=a==null?void 0:a.right)!=null?u:[]).filter(g=>!(o!=null&&o.includes(g)))}}return{left:((r=a==null?void 0:a.left)!=null?r:[]).filter(g=>!(o!=null&&o.includes(g))),right:((i=a==null?void 0:a.right)!=null?i:[]).filter(g=>!(o!=null&&o.includes(g)))}})},e.getCanPin=()=>e.getLeafColumns()?.some(o=>{var a,r,i;return((a=o.columnDef.enablePinning)!=null?a:!0)&&((r=(i=n.options.enableColumnPinning)!=null?i:n.options.enablePinning)!=null?r:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns()?.map(l=>l.id),{left:o,right:a}=n.getState().columnPinning,r=t?.some(l=>o==null?void 0:o.includes(l)),i=t?.some(l=>a==null?void 0:a.includes(l));return r?"left":i?"right":!1},e.getPinnedIndex=()=>{var t,o;const a=e.getIsPinned();return a?(t=(o=n.getState().columnPinning)==null||(o=o[a])==null?void 0:o.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=Ne(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,o,a)=>{const r=[...o??[],...a??[]];return t.filter(i=>!r.includes(i.column.id))},ke(n.options,"debugRows")),e.getLeftVisibleCells=Ne(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(t,o)=>(o??[])?.map(r=>t.find(i=>i.column.id===r)).filter(Boolean)?.map(r=>({...r,position:"left"})),ke(n.options,"debugRows")),e.getRightVisibleCells=Ne(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,o)=>(o??[])?.map(r=>t.find(i=>i.column.id===r)).filter(Boolean)?.map(r=>({...r,position:"right"})),ke(n.options,"debugRows"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,o;return e.setColumnPinning(n?oa():(t=(o=e.initialState)==null?void 0:o.columnPinning)!=null?t:oa())},e.getIsSomeColumnsPinned=n=>{var t;const o=e.getState().columnPinning;if(!n){var a,r;return!!((a=o.left)!=null&&a.length||(r=o.right)!=null&&r.length)}return!!((t=o[n])!=null&&t.length)},e.getLeftLeafColumns=Ne(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[])?.map(o=>n.find(a=>a.id===o)).filter(Boolean),ke(e.options,"debugColumns")),e.getRightLeafColumns=Ne(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[])?.map(o=>n.find(a=>a.id===o)).filter(Boolean),ke(e.options,"debugColumns")),e.getCenterLeafColumns=Ne(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o)=>{const a=[...t??[],...o??[]];return n.filter(r=>!a.includes(r.id))},ke(e.options,"debugColumns"))}},Vs={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},aa=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),av={getDefaultColumnDef:()=>Vs,getInitialState:e=>({columnSizing:{},columnSizingInfo:aa(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Dt("columnSizing",e),onColumnSizingInfoChange:Dt("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,o,a;const r=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Vs.minSize,(o=r??e.columnDef.size)!=null?o:Vs.size),(a=e.columnDef.maxSize)!=null?a:Vs.maxSize)},e.getStart=Ne(t=>[t,ws(n,t),n.getState().columnSizing],(t,o)=>o.slice(0,e.getIndex(t)).reduce((a,r)=>a+r.getSize(),0),ke(n.options,"debugColumns")),e.getAfter=Ne(t=>[t,ws(n,t),n.getState().columnSizing],(t,o)=>o.slice(e.getIndex(t)+1).reduce((a,r)=>a+r.getSize(),0),ke(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:o,...a}=t;return a})},e.getCanResize=()=>{var t,o;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((o=n.options.enableColumnResizing)!=null?o:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0;const o=a=>{if(a.subHeaders.length)a.subHeaders.forEach(o);else{var r;t+=(r=a.column.getSize())!=null?r:0}};return o(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const o=n.getColumn(e.column.id),a=o==null?void 0:o.getCanResize();return r=>{if(!o||!a||(r.persist==null||r.persist(),ra(r)&&r.touches&&r.touches.length>1))return;const i=e.getSize(),l=e?e.getLeafHeaders()?.map(x=>[x.column.id,x.column.getSize()]):[[o.id,o.getSize()]],d=ra(r)?Math.round(r.touches[0].clientX):r.clientX,c={},u=(x,b)=>{typeof b=="number"&&(n.setColumnSizingInfo(w=>{var C,j;const M=n.options.columnResizeDirection==="rtl"?-1:1,k=(b-((C=w==null?void 0:w.startOffset)!=null?C:0))*M,S=Math.max(k/((j=w==null?void 0:w.startSize)!=null?j:0),-.999999);return w.columnSizingStart.forEach(T=>{let[N,F]=T;c[N]=Math.round(Math.max(F+F*S,0)*100)/100}),{...w,deltaOffset:k,deltaPercentage:S}}),(n.options.columnResizeMode==="onChange"||x==="end")&&n.setColumnSizing(w=>({...w,...c})))},g=x=>u("move",x),m=x=>{u("end",x),n.setColumnSizingInfo(b=>({...b,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},h=t||typeof document<"u"?document:null,p={moveHandler:x=>g(x.clientX),upHandler:x=>{h==null||h.removeEventListener("mousemove",p.moveHandler),h==null||h.removeEventListener("mouseup",p.upHandler),m(x.clientX)}},f={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),g(x.touches[0].clientX),!1),upHandler:x=>{var b;h==null||h.removeEventListener("touchmove",f.moveHandler),h==null||h.removeEventListener("touchend",f.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),m((b=x.touches[0])==null?void 0:b.clientX)}},v=rv()?{passive:!1}:!1;ra(r)?(h==null||h.addEventListener("touchmove",f.moveHandler,v),h==null||h.addEventListener("touchend",f.upHandler,v)):(h==null||h.addEventListener("mousemove",p.moveHandler,v),h==null||h.addEventListener("mouseup",p.upHandler,v)),n.setColumnSizingInfo(x=>({...x,startOffset:d,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:o.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?aa():(t=e.initialState.columnSizingInfo)!=null?t:aa())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((o,a)=>o+a.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((o,a)=>o+a.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((o,a)=>o+a.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((o,a)=>o+a.getSize(),0))!=null?n:0}}};let Bs=null;function rv(){if(typeof Bs=="boolean")return Bs;let e=!1;try{const n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return Bs=e,Bs}function ra(e){return e.type==="touchstart"}const iv={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Dt("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(o=>({...o,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,o;const a=e.columns;return(t=a.length?a?.some(r=>r.getIsVisible()):(o=n.getState().columnVisibility)==null?void 0:o[e.id])!=null?t:!0},e.getCanHide=()=>{var t,o;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((o=n.options.enableHiding)!=null?o:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=Ne(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(o=>o.column.getIsVisible()),ke(n.options,"debugRows")),e.getVisibleCells=Ne(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,o,a)=>[...t,...o,...a],ke(n.options,"debugRows"))},createTable:e=>{const n=(t,o)=>Ne(()=>[o(),o().filter(a=>a.getIsVisible())?.map(a=>a.id).join("_")],a=>a.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),ke(e.options,"debugColumns"));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var o;e.setColumnVisibility(t?{}:(o=e.initialState.columnVisibility)!=null?o:{})},e.toggleAllColumnsVisible=t=>{var o;t=(o=t)!=null?o:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((a,r)=>({...a,[r.id]:t||!(r.getCanHide!=null&&r.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns()?.some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns()?.some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var o;e.toggleAllColumnsVisible((o=t.target)==null?void 0:o.checked)}}};function ws(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const lv={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},cv={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Dt("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;const o=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var t,o,a,r;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((o=n.options.enableGlobalFilter)!=null?o:!0)&&((a=n.options.enableFilters)!=null?a:!0)&&((r=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>sn.includesString,e.getGlobalFilterFn=()=>{var n,t;const{globalFilterFn:o}=e.options;return Eo(o)?o:o==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[o])!=null?n:sn[o]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},dv={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Dt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var o,a;if(!n){e._queue(()=>{n=!0});return}if((o=(a=e.options.autoResetAll)!=null?a:e.options.autoResetExpanded)!=null?o:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=o=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(o),e.toggleAllRowsExpanded=o=>{o??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=o=>{var a,r;e.setExpanded(o?{}:(a=(r=e.initialState)==null?void 0:r.expanded)!=null?a:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows?.some(o=>o.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const o=e.getState().expanded;return o===!0||Object.values(o)?.some(Boolean)},e.getIsAllRowsExpanded=()=>{const o=e.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||e.getRowModel().flatRows?.some(a=>!a.getIsExpanded()))},e.getExpandedDepth=()=>{let o=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const i=r.split(".");o=Math.max(o,i.length)}),o},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=t=>{n.setExpanded(o=>{var a;const r=o===!0?!0:!!(o!=null&&o[e.id]);let i={};if(o===!0?Object.keys(n.getRowModel().rowsById).forEach(l=>{i[l]=!0}):i=o,t=(a=t)!=null?a:!r,!r&&t)return{...i,[e.id]:!0};if(r&&!t){const{[e.id]:l,...d}=i;return d}return o})},e.getIsExpanded=()=>{var t;const o=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:o===!0||o!=null&&o[e.id])},e.getCanExpand=()=>{var t,o,a;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((o=n.options.enableExpanding)!=null?o:!0)&&!!((a=e.subRows)!=null&&a.length)},e.getIsAllParentsExpanded=()=>{let t=!0,o=e;for(;t&&o.parentId;)o=n.getRow(o.parentId,!0),t=o.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Oa=0,Aa=10,ia=()=>({pageIndex:Oa,pageSize:Aa}),uv={getInitialState:e=>({...e,pagination:{...ia(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Dt("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var o,a;if(!n){e._queue(()=>{n=!0});return}if((o=(a=e.options.autoResetAll)!=null?a:e.options.autoResetPageIndex)!=null?o:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=o=>{const a=r=>yn(o,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(a)},e.resetPagination=o=>{var a;e.setPagination(o?ia():(a=e.initialState.pagination)!=null?a:ia())},e.setPageIndex=o=>{e.setPagination(a=>{let r=yn(o,a.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...a,pageIndex:r}})},e.resetPageIndex=o=>{var a,r;e.setPageIndex(o?Oa:(a=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageIndex)!=null?a:Oa)},e.resetPageSize=o=>{var a,r;e.setPageSize(o?Aa:(a=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageSize)!=null?a:Aa)},e.setPageSize=o=>{e.setPagination(a=>{const r=Math.max(1,yn(o,a.pageSize)),i=a.pageSize*a.pageIndex,l=Math.floor(i/r);return{...a,pageIndex:l,pageSize:r}})},e.setPageCount=o=>e.setPagination(a=>{var r;let i=yn(o,(r=e.options.pageCount)!=null?r:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...a,pageCount:i}}),e.getPageOptions=Ne(()=>[e.getPageCount()],o=>{let a=[];return o&&o>0&&(a=[...new Array(o)].fill(null)?.map((r,i)=>i)),a},ke(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:o}=e.getState().pagination,a=e.getPageCount();return a===-1?!0:a===0?!1:o<a-1},e.previousPage=()=>e.setPageIndex(o=>o-1),e.nextPage=()=>e.setPageIndex(o=>o+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var o;return(o=e.options.pageCount)!=null?o:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var o;return(o=e.options.rowCount)!=null?o:e.getPrePaginationRowModel().rows.length}}},la=()=>({top:[],bottom:[]}),gv={getInitialState:e=>({rowPinning:la(),...e}),getDefaultOptions:e=>({onRowPinningChange:Dt("rowPinning",e)}),createRow:(e,n)=>{e.pin=(t,o,a)=>{const r=o?e.getLeafRows()?.map(d=>{let{id:c}=d;return c}):[],i=a?e.getParentRows()?.map(d=>{let{id:c}=d;return c}):[],l=new Set([...i,e.id,...r]);n.setRowPinning(d=>{var c,u;if(t==="bottom"){var g,m;return{top:((g=d==null?void 0:d.top)!=null?g:[]).filter(f=>!(l!=null&&l.has(f))),bottom:[...((m=d==null?void 0:d.bottom)!=null?m:[]).filter(f=>!(l!=null&&l.has(f))),...Array.from(l)]}}if(t==="top"){var h,p;return{top:[...((h=d==null?void 0:d.top)!=null?h:[]).filter(f=>!(l!=null&&l.has(f))),...Array.from(l)],bottom:((p=d==null?void 0:d.bottom)!=null?p:[]).filter(f=>!(l!=null&&l.has(f)))}}return{top:((c=d==null?void 0:d.top)!=null?c:[]).filter(f=>!(l!=null&&l.has(f))),bottom:((u=d==null?void 0:d.bottom)!=null?u:[]).filter(f=>!(l!=null&&l.has(f)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:o,enablePinning:a}=n.options;return typeof o=="function"?o(e):(t=o??a)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:o,bottom:a}=n.getState().rowPinning,r=t?.some(l=>o==null?void 0:o.includes(l)),i=t?.some(l=>a==null?void 0:a.includes(l));return r?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var t,o;const a=e.getIsPinned();if(!a)return-1;const r=(t=a==="top"?n.getTopRows():n.getBottomRows())==null?void 0:t?.map(i=>{let{id:l}=i;return l});return(o=r==null?void 0:r.indexOf(e.id))!=null?o:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,o;return e.setRowPinning(n?la():(t=(o=e.initialState)==null?void 0:o.rowPinning)!=null?t:la())},e.getIsSomeRowsPinned=n=>{var t;const o=e.getState().rowPinning;if(!n){var a,r;return!!((a=o.top)!=null&&a.length||(r=o.bottom)!=null&&r.length)}return!!((t=o[n])!=null&&t.length)},e._getPinnedRows=(n,t,o)=>{var a;return((a=e.options.keepPinnedRows)==null||a?(t??[])?.map(i=>{const l=e.getRow(i,!0);return l.getIsAllParentsExpanded()?l:null}):(t??[])?.map(i=>n.find(l=>l.id===i))).filter(Boolean)?.map(i=>({...i,position:o}))},e.getTopRows=Ne(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,t)=>e._getPinnedRows(n,t,"top"),ke(e.options,"debugRows")),e.getBottomRows=Ne(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,t)=>e._getPinnedRows(n,t,"bottom"),ke(e.options,"debugRows")),e.getCenterRows=Ne(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,o)=>{const a=new Set([...t??[],...o??[]]);return n.filter(r=>!a.has(r.id))},ke(e.options,"debugRows"))}},mv={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Dt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const o={...t},a=e.getPreGroupedRowModel().flatRows;return n?a.forEach(r=>{r.getCanSelect()&&(o[r.id]=!0)}):a.forEach(r=>{delete o[r.id]}),o})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{const o=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),a={...t};return e.getRowModel().rows.forEach(r=>{za(a,r.id,o,!0,e)}),a}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Ne(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?ca(e,t):{rows:[],flatRows:[],rowsById:{}},ke(e.options,"debugTable")),e.getFilteredSelectedRowModel=Ne(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?ca(e,t):{rows:[],flatRows:[],rowsById:{}},ke(e.options,"debugTable")),e.getGroupedSelectedRowModel=Ne(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?ca(e,t):{rows:[],flatRows:[],rowsById:{}},ke(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let o=!!(n.length&&Object.keys(t).length);return o&&n?.some(a=>a.getCanSelect()&&!t[a.id])&&(o=!1),o},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(a=>a.getCanSelect()),{rowSelection:t}=e.getState();let o=!!n.length;return o&&n?.some(a=>!t[a.id])&&(o=!1),o},e.getIsSomeRowsSelected=()=>{var n;const t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect())?.some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,o)=>{const a=e.getIsSelected();n.setRowSelection(r=>{var i;if(t=typeof t<"u"?t:!a,e.getCanSelect()&&a===t)return r;const l={...r};return za(l,e.id,t,(i=o==null?void 0:o.selectChildren)!=null?i:!0,n),l})},e.getIsSelected=()=>{const{rowSelection:t}=n.getState();return Wr(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=n.getState();return $a(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=n.getState();return $a(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return o=>{var a;t&&e.toggleSelected((a=o.target)==null?void 0:a.checked)}}}},za=(e,n,t,o,a)=>{var r;const i=a.getRow(n,!0);t?(i.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),i.getCanSelect()&&(e[n]=!0)):delete e[n],o&&(r=i.subRows)!=null&&r.length&&i.getCanSelectSubRows()&&i.subRows.forEach(l=>za(e,l.id,t,o,a))};function ca(e,n){const t=e.getState().rowSelection,o=[],a={},r=function(i,l){return i?.map(d=>{var c;const u=Wr(d,t);if(u&&(o.push(d),a[d.id]=d),(c=d.subRows)!=null&&c.length&&(d={...d,subRows:r(d.subRows)}),u)return d}).filter(Boolean)};return{rows:r(n.rows),flatRows:o,rowsById:a}}function Wr(e,n){var t;return(t=n[e.id])!=null?t:!1}function $a(e,n,t){var o;if(!((o=e.subRows)!=null&&o.length))return!1;let a=!0,r=!1;return e.subRows.forEach(i=>{if(!(r&&!a)&&(i.getCanSelect()&&(Wr(i,n)?r=!0:a=!1),i.subRows&&i.subRows.length)){const l=$a(i,n);l==="all"?r=!0:(l==="some"&&(r=!0),a=!1)}}),a?"all":r?"some":!1}const La=/([0-9]+)/gm,hv=(e,n,t)=>Tc(Cn(e.getValue(t)).toLowerCase(),Cn(n.getValue(t)).toLowerCase()),pv=(e,n,t)=>Tc(Cn(e.getValue(t)),Cn(n.getValue(t))),fv=(e,n,t)=>Kr(Cn(e.getValue(t)).toLowerCase(),Cn(n.getValue(t)).toLowerCase()),vv=(e,n,t)=>Kr(Cn(e.getValue(t)),Cn(n.getValue(t))),xv=(e,n,t)=>{const o=e.getValue(t),a=n.getValue(t);return o>a?1:o<a?-1:0},bv=(e,n,t)=>Kr(e.getValue(t),n.getValue(t));function Kr(e,n){return e===n?0:e>n?1:-1}function Cn(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Tc(e,n){const t=e.split(La).filter(Boolean),o=n.split(La).filter(Boolean);for(;t.length&&o.length;){const a=t.shift(),r=o.shift(),i=parseInt(a,10),l=parseInt(r,10),d=[i,l].sort();if(isNaN(d[0])){if(a>r)return 1;if(r>a)return-1;continue}if(isNaN(d[1]))return isNaN(i)?-1:1;if(i>l)return 1;if(l>i)return-1}return t.length-o.length}const Pn={alphanumeric:hv,alphanumericCaseSensitive:pv,text:fv,textCaseSensitive:vv,datetime:xv,basic:bv},yv={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Dt("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const t=n.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const a of t){const r=a==null?void 0:a.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return Pn.datetime;if(typeof r=="string"&&(o=!0,r.split(La).length>1))return Pn.alphanumeric}return o?Pn.text:Pn.basic},e.getAutoSortDir=()=>{const t=n.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,o;if(!e)throw new Error;return Eo(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(o=n.options.sortingFns)==null?void 0:o[e.columnDef.sortingFn])!=null?t:Pn[e.columnDef.sortingFn]},e.toggleSorting=(t,o)=>{const a=e.getNextSortingOrder(),r=typeof t<"u"&&t!==null;n.setSorting(i=>{const l=i==null?void 0:i.find(h=>h.id===e.id),d=i==null?void 0:i.findIndex(h=>h.id===e.id);let c=[],u,g=r?t:a==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&o?l?u="toggle":u="add":i!=null&&i.length&&d!==i.length-1?u="replace":l?u="toggle":u="replace",u==="toggle"&&(r||a||(u="remove")),u==="add"){var m;c=[...i,{id:e.id,desc:g}],c.splice(0,c.length-((m=n.options.maxMultiSortColCount)!=null?m:Number.MAX_SAFE_INTEGER))}else u==="toggle"?c=i?.map(h=>h.id===e.id?{...h,desc:g}:h):u==="remove"?c=i.filter(h=>h.id!==e.id):c=[{id:e.id,desc:g}];return c})},e.getFirstSortDir=()=>{var t,o;return((t=(o=e.columnDef.sortDescFirst)!=null?o:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var o,a;const r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&((o=n.options.enableSortingRemoval)==null||o)&&(!(t&&(a=n.options.enableMultiRemove)!=null)||a)?!1:i==="desc"?"asc":"desc":r},e.getCanSort=()=>{var t,o;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((o=n.options.enableSorting)!=null?o:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,o;return(t=(o=e.columnDef.enableMultiSort)!=null?o:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const o=(t=n.getState().sorting)==null?void 0:t.find(a=>a.id===e.id);return o?o.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,o;return(t=(o=n.getState().sorting)==null?void 0:o.findIndex(a=>a.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(o=>o.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return o=>{t&&(o.persist==null||o.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(o):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,o;e.setSorting(n?[]:(t=(o=e.initialState)==null?void 0:o.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},wv=[U0,iv,sv,ov,H0,G0,lv,cv,yv,tv,dv,uv,gv,mv,av];function jv(e){var n,t;const o=[...wv,...(n=e._features)!=null?n:[]];let a={_features:o};const r=a._features.reduce((m,h)=>Object.assign(m,h.getDefaultOptions==null?void 0:h.getDefaultOptions(a)),{}),i=m=>a.options.mergeOptions?a.options.mergeOptions(r,m):{...r,...m};let d={...{},...(t=e.initialState)!=null?t:{}};a._features.forEach(m=>{var h;d=(h=m.getInitialState==null?void 0:m.getInitialState(d))!=null?h:d});const c=[];let u=!1;const g={_features:o,options:{...r,...e},initialState:d,_queue:m=>{c.push(m),u||(u=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();u=!1}).catch(h=>setTimeout(()=>{throw h})))},reset:()=>{a.setState(a.initialState)},setOptions:m=>{const h=yn(m,a.options);a.options=i(h)},getState:()=>a.options.state,setState:m=>{a.options.onStateChange==null||a.options.onStateChange(m)},_getRowId:(m,h,p)=>{var f;return(f=a.options.getRowId==null?void 0:a.options.getRowId(m,h,p))!=null?f:`${p?[p.id,h].join("."):h}`},getCoreRowModel:()=>(a._getCoreRowModel||(a._getCoreRowModel=a.options.getCoreRowModel(a)),a._getCoreRowModel()),getRowModel:()=>a.getPaginationRowModel(),getRow:(m,h)=>{let p=(h?a.getPrePaginationRowModel():a.getRowModel()).rowsById[m];if(!p&&(p=a.getCoreRowModel().rowsById[m],!p))throw new Error;return p},_getDefaultColumnDef:Ne(()=>[a.options.defaultColumn],m=>{var h;return m=(h=m)!=null?h:{},{header:p=>{const f=p.header.column.columnDef;return f.accessorKey?f.accessorKey:f.accessorFn?f.id:null},cell:p=>{var f,v;return(f=(v=p.renderValue())==null||v.toString==null?void 0:v.toString())!=null?f:null},...a._features.reduce((p,f)=>Object.assign(p,f.getDefaultColumnDef==null?void 0:f.getDefaultColumnDef()),{}),...m}},ke(e,"debugColumns")),_getColumnDefs:()=>a.options.columns,getAllColumns:Ne(()=>[a._getColumnDefs()],m=>{const h=function(p,f,v){return v===void 0&&(v=0),p?.map(x=>{const b=B0(a,x,v,f),w=x;return b.columns=w.columns?h(w.columns,b,v+1):[],b})};return h(m)},ke(e,"debugColumns")),getAllFlatColumns:Ne(()=>[a.getAllColumns()],m=>m.flatMap(h=>h.getFlatColumns()),ke(e,"debugColumns")),_getAllFlatColumnsById:Ne(()=>[a.getAllFlatColumns()],m=>m.reduce((h,p)=>(h[p.id]=p,h),{}),ke(e,"debugColumns")),getAllLeafColumns:Ne(()=>[a.getAllColumns(),a._getOrderColumnsFn()],(m,h)=>{let p=m.flatMap(f=>f.getLeafColumns());return h(p)},ke(e,"debugColumns")),getColumn:m=>a._getAllFlatColumnsById()[m]};Object.assign(a,g);for(let m=0;m<a._features.length;m++){const h=a._features[m];h==null||h.createTable==null||h.createTable(a)}return a}function Cv(){return e=>Ne(()=>[e.options.data],n=>{const t={rows:[],flatRows:[],rowsById:{}},o=function(a,r,i){r===void 0&&(r=0);const l=[];for(let c=0;c<a.length;c++){const u=ds(e,e._getRowId(a[c],c,i),a[c],c,r,void 0,i==null?void 0:i.id);if(t.flatRows.push(u),t.rowsById[u.id]=u,l.push(u),e.options.getSubRows){var d;u.originalSubRows=e.options.getSubRows(a[c],c),(d=u.originalSubRows)!=null&&d.length&&(u.subRows=o(u.originalSubRows,r+1,u))}}return l};return t.rows=o(n),t},ke(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Sv(){return e=>Ne(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(n,t,o)=>!t.rows.length||n!==!0&&!Object.keys(n??{}).length||!o?t:Ic(t),ke(e.options,"debugTable"))}function Ic(e){const n=[],t=o=>{var a;n.push(o),(a=o.subRows)!=null&&a.length&&o.getIsExpanded()&&o.subRows.forEach(t)};return e.rows.forEach(t),{rows:n,flatRows:e.flatRows,rowsById:e.rowsById}}function _v(){return(e,n)=>Ne(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return;const o=t.flatRows.flatMap(i=>{var l;return(l=i.getUniqueValues(n))!=null?l:[]})?.map(Number).filter(i=>!Number.isNaN(i));if(!o.length)return;let a=o[0],r=o[o.length-1];for(const i of o)i<a?a=i:i>r&&(r=i);return[a,r]},ke(e.options,"debugTable"))}function Fc(e,n,t){return t.options.filterFromLeafRows?Mv(e,n,t):Rv(e,n,t)}function Mv(e,n,t){var o;const a=[],r={},i=(o=t.options.maxLeafRowFilterDepth)!=null?o:100,l=function(d,c){c===void 0&&(c=0);const u=[];for(let m=0;m<d.length;m++){var g;let h=d[m];const p=ds(t,h.id,h.original,h.index,h.depth,void 0,h.parentId);if(p.columnFilters=h.columnFilters,(g=h.subRows)!=null&&g.length&&c<i){if(p.subRows=l(h.subRows,c+1),h=p,n(h)&&!p.subRows.length){u.push(h),r[h.id]=h,a.push(h);continue}if(n(h)||p.subRows.length){u.push(h),r[h.id]=h,a.push(h);continue}}else h=p,n(h)&&(u.push(h),r[h.id]=h,a.push(h))}return u};return{rows:l(e),flatRows:a,rowsById:r}}function Rv(e,n,t){var o;const a=[],r={},i=(o=t.options.maxLeafRowFilterDepth)!=null?o:100,l=function(d,c){c===void 0&&(c=0);const u=[];for(let m=0;m<d.length;m++){let h=d[m];if(n(h)){var g;if((g=h.subRows)!=null&&g.length&&c<i){const f=ds(t,h.id,h.original,h.index,h.depth,void 0,h.parentId);f.subRows=l(h.subRows,c+1),h=f}u.push(h),a.push(h),r[h.id]=h}}return u};return{rows:l(e),flatRows:a,rowsById:r}}function Nv(){return(e,n)=>Ne(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(t,o,a)=>{if(!t.rows.length||!(o!=null&&o.length)&&!a)return t;const r=[...o?.map(l=>l.id).filter(l=>l!==n),a?"__global__":void 0].filter(Boolean),i=l=>{for(let d=0;d<r.length;d++)if(l.columnFilters[r[d]]===!1)return!1;return!0};return Fc(t.rows,i,e)},ke(e.options,"debugTable"))}function kv(){return(e,n)=>Ne(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let o=new Map;for(let r=0;r<t.flatRows.length;r++){const i=t.flatRows[r].getUniqueValues(n);for(let l=0;l<i.length;l++){const d=i[l];if(o.has(d)){var a;o.set(d,((a=o.get(d))!=null?a:0)+1)}else o.set(d,1)}}return o},ke(e.options,"debugTable"))}function Dv(){return e=>Ne(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(n,t,o)=>{if(!n.rows.length||!(t!=null&&t.length)&&!o){for(let m=0;m<n.flatRows.length;m++)n.flatRows[m].columnFilters={},n.flatRows[m].columnFiltersMeta={};return n}const a=[],r=[];(t??[]).forEach(m=>{var h;const p=e.getColumn(m.id);if(!p)return;const f=p.getFilterFn();f&&a.push({id:m.id,filterFn:f,resolvedValue:(h=f.resolveFilterValue==null?void 0:f.resolveFilterValue(m.value))!=null?h:m.value})});const i=(t??[])?.map(m=>m.id),l=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(m=>m.getCanGlobalFilter());o&&l&&d.length&&(i.push("__global__"),d.forEach(m=>{var h;r.push({id:m.id,filterFn:l,resolvedValue:(h=l.resolveFilterValue==null?void 0:l.resolveFilterValue(o))!=null?h:o})}));let c,u;for(let m=0;m<n.flatRows.length;m++){const h=n.flatRows[m];if(h.columnFilters={},a.length)for(let p=0;p<a.length;p++){c=a[p];const f=c.id;h.columnFilters[f]=c.filterFn(h,f,c.resolvedValue,v=>{h.columnFiltersMeta[f]=v})}if(r.length){for(let p=0;p<r.length;p++){u=r[p];const f=u.id;if(u.filterFn(h,f,u.resolvedValue,v=>{h.columnFiltersMeta[f]=v})){h.columnFilters.__global__=!0;break}}h.columnFilters.__global__!==!0&&(h.columnFilters.__global__=!1)}}const g=m=>{for(let h=0;h<i.length;h++)if(m.columnFilters[i[h]]===!1)return!1;return!0};return Fc(n.rows,g,e)},ke(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Tv(){return e=>Ne(()=>[e.getState().grouping,e.getPreGroupedRowModel()],(n,t)=>{if(!t.rows.length||!n.length)return t.rows.forEach(d=>{d.depth=0,d.parentId=void 0}),t;const o=n.filter(d=>e.getColumn(d)),a=[],r={},i=function(d,c,u){if(c===void 0&&(c=0),c>=o.length)return d?.map(p=>(p.depth=c,a.push(p),r[p.id]=p,p.subRows&&(p.subRows=i(p.subRows,c+1,p.id)),p));const g=o[c],m=Iv(d,g);return Array.from(m.entries())?.map((p,f)=>{let[v,x]=p,b=`${g}:${v}`;b=u?`${u}>${b}`:b;const w=i(x,c+1,b);w.forEach(M=>{M.parentId=b});const C=c?jc(x,M=>M.subRows):x,j=ds(e,b,C[0].original,f,c,void 0,u);return Object.assign(j,{groupingColumnId:g,groupingValue:v,subRows:w,leafRows:C,getValue:M=>{if(o.includes(M)){if(j._valuesCache.hasOwnProperty(M))return j._valuesCache[M];if(x[0]){var k;j._valuesCache[M]=(k=x[0].getValue(M))!=null?k:void 0}return j._valuesCache[M]}if(j._groupingValuesCache.hasOwnProperty(M))return j._groupingValuesCache[M];const S=e.getColumn(M),T=S==null?void 0:S.getAggregationFn();if(T)return j._groupingValuesCache[M]=T(M,C,x),j._groupingValuesCache[M]}}),w.forEach(M=>{a.push(M),r[M.id]=M}),j})},l=i(t.rows,0);return l.forEach(d=>{a.push(d),r[d.id]=d}),{rows:l,flatRows:a,rowsById:r}},ke(e.options,"debugTable","getGroupedRowModel",()=>{e._queue(()=>{e._autoResetExpanded(),e._autoResetPageIndex()})}))}function Iv(e,n){const t=new Map;return e.reduce((o,a)=>{const r=`${a.getGroupingValue(n)}`,i=o.get(r);return i?i.push(a):o.set(r,[a]),o},t)}function Fv(e){return n=>Ne(()=>[n.getState().pagination,n.getPrePaginationRowModel(),n.options.paginateExpandedRows?void 0:n.getState().expanded],(t,o)=>{if(!o.rows.length)return o;const{pageSize:a,pageIndex:r}=t;let{rows:i,flatRows:l,rowsById:d}=o;const c=a*r,u=c+a;i=i.slice(c,u);let g;n.options.paginateExpandedRows?g={rows:i,flatRows:l,rowsById:d}:g=Ic({rows:i,flatRows:l,rowsById:d}),g.flatRows=[];const m=h=>{g.flatRows.push(h),h.subRows.length&&h.subRows.forEach(m)};return g.rows.forEach(m),g},ke(n.options,"debugTable"))}function Pv(){return e=>Ne(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;const o=e.getState().sorting,a=[],r=o.filter(d=>{var c;return(c=e.getColumn(d.id))==null?void 0:c.getCanSort()}),i={};r.forEach(d=>{const c=e.getColumn(d.id);c&&(i[d.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const l=d=>{const c=d?.map(u=>({...u}));return c.sort((u,g)=>{for(let h=0;h<r.length;h+=1){var m;const p=r[h],f=i[p.id],v=f.sortUndefined,x=(m=p==null?void 0:p.desc)!=null?m:!1;let b=0;if(v){const w=u.getValue(p.id),C=g.getValue(p.id),j=w===void 0,M=C===void 0;if(j||M){if(v==="first")return j?-1:1;if(v==="last")return j?1:-1;b=j&&M?0:j?v:-v}}if(b===0&&(b=f.sortingFn(u,g,p.id)),b!==0)return x&&(b*=-1),f.invertSorting&&(b*=-1),b}return u.index-g.index}),c.forEach(u=>{var g;a.push(u),(g=u.subRows)!=null&&g.length&&(u.subRows=l(u.subRows))}),c};return{rows:l(t.rows),flatRows:a,rowsById:t.rowsById}},ke(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
* react-table
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Ev(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=y.useState(()=>({current:jv(n)})),[o,a]=y.useState(()=>t.current.initialState);return t.current.setOptions(r=>({...r,...e,state:{...o,...e.state},onStateChange:i=>{a(i),e.onStateChange==null||e.onStateChange(i)}})),t.current}/**
* match-sorter-utils
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/const Pc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",:"A",:"A",:"A",:"A",:"A",Æ:"AE",:"A",:"A",Ȃ:"A",Ç:"C",:"C",È:"E",É:"E",Ê:"E",Ë:"E",:"E",:"E",:"E",:"E",:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",:"O",:"O",:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",:"a",:"a",:"a",:"a",:"a",æ:"ae",:"a",:"a",ȃ:"a",ç:"c",:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",:"e",:"e",:"e",:"e",ȇ:"e",ì:"i",í:"i",î:"i",ï:"i",:"i",ȋ:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",:"o",:"o",:"o",ȏ:"o",ù:"u",ú:"u",û:"u",ü:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",:"H",:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",:"K",:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",:"W",:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",:"U",:"u",:"U",:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",:"P",:"p",:"S",:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",:"O",:"o",:"O",:"o",:"U",:"u",:"W",:"w",:"Y",:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",:"S",:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",:"D",:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",:"H",:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z"},Ov=Object.keys(Pc).join("|"),Av=new RegExp(Ov,"g");function zv(e){return e.replace(Av,n=>Pc[n])}/**
* @name match-sorter
* @license MIT license.
* @copyright (c) 2099 Kent C. Dodds
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
*/const vt={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function $v(e,n,t){var o;if(t=t||{},t.threshold=(o=t.threshold)!=null?o:vt.MATCHES,!t.accessors){const i=Vi(e,n,t);return{rankedValue:e,rank:i,accessorIndex:-1,accessorThreshold:t.threshold,passed:i>=t.threshold}}const a=Hv(e,t.accessors),r={rankedValue:e,rank:vt.NO_MATCH,accessorIndex:-1,accessorThreshold:t.threshold,passed:!1};for(let i=0;i<a.length;i++){const l=a[i];let d=Vi(l.itemValue,n,t);const{minRanking:c,maxRanking:u,threshold:g=t.threshold}=l.attributes;d<c&&d>=vt.MATCHES?d=c:d>u&&(d=u),d=Math.min(d,u),d>=g&&d>r.rank&&(r.rank=d,r.passed=!0,r.accessorIndex=i,r.accessorThreshold=g,r.rankedValue=l.itemValue)}return r}function Vi(e,n,t){return e=Bi(e,t),n=Bi(n,t),n.length>e.length?vt.NO_MATCH:e===n?vt.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),n=n.toLowerCase(),e===n?vt.EQUAL:e.startsWith(n)?vt.STARTS_WITH:e.includes(` ${n}`)?vt.WORD_STARTS_WITH:e.includes(n)?vt.CONTAINS:n.length===1?vt.NO_MATCH:Lv(e).includes(n)?vt.ACRONYM:Vv(e,n))}function Lv(e){let n="";return e.split(" ").forEach(o=>{o.split("-").forEach(r=>{n+=r.substr(0,1)})}),n}function Vv(e,n){let t=0,o=0;function a(d,c,u){for(let g=u,m=c.length;g<m;g++)if(c[g]===d)return t+=1,g+1;return-1}function r(d){const c=1/d,u=t/n.length;return vt.MATCHES+u*c}const i=a(n[0],e,0);if(i<0)return vt.NO_MATCH;o=i;for(let d=1,c=n.length;d<c;d++){const u=n[d];if(o=a(u,e,o),!(o>-1))return vt.NO_MATCH}const l=o-i;return r(l)}function Bv(e,n){return e.rank===n.rank?0:e.rank>n.rank?-1:1}function Bi(e,n){let{keepDiacritics:t}=n;return e=`${e}`,t||(e=zv(e)),e}function Uv(e,n){let t=n;typeof n=="object"&&(t=n.accessor);const o=t(e);return o==null?[]:Array.isArray(o)?o:[String(o)]}function Hv(e,n){const t=[];for(let o=0,a=n.length;o<a;o++){const r=n[o],i=Gv(r),l=Uv(e,r);for(let d=0,c=l.length;d<c;d++)t.push({itemValue:l[d],attributes:i})}return t}const Ui={maxRanking:1/0,minRanking:-1/0};function Gv(e){return typeof e=="function"?Ui:{...Ui,...e}}function Gn(e,n,t){let o=t.initialDeps??[],a;return()=>{var r,i,l,d;let c;t.key&&((r=t.debug)!=null&&r.call(t))&&(c=Date.now());const u=e();if(!(u.length!==o.length||u?.some((h,p)=>o[p]!==h)))return a;o=u;let m;if(t.key&&((i=t.debug)!=null&&i.call(t))&&(m=Date.now()),a=n(...u),t.key&&((l=t.debug)!=null&&l.call(t))){const h=Math.round((Date.now()-c)*100)/100,f=Math.round((Date.now()-m)*100)/100/16,v=(x,b)=>{for(x=String(x);x.length<b;)x=" "+x;return x}}return(d=t==null?void 0:t.onChange)==null||d.call(t,a),a}}function da(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const qv=(e,n)=>Math.abs(e-n)<1,Wv=(e,n,t)=>{let o;return function(...a){e.clearTimeout(o),o=e.setTimeout(()=>n.apply(this,a),t)}},Kv=e=>e,Ec=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),o=[];for(let a=n;a<=t;a++)o.push(a);return o},Yv=(e,n)=>{const t=e.scrollElement;if(!t)return;const o=e.targetWindow;if(!o)return;const a=i=>{const{width:l,height:d}=i;n({width:Math.round(l),height:Math.round(d)})};if(a(t.getBoundingClientRect()),!o.ResizeObserver)return()=>{};const r=new o.ResizeObserver(i=>{const l=i[0];if(l!=null&&l.borderBoxSize){const d=l.borderBoxSize[0];if(d){a({width:d.inlineSize,height:d.blockSize});return}}a(t.getBoundingClientRect())});return r.observe(t,{box:"border-box"}),()=>{r.unobserve(t)}},Hi={passive:!0},Qv=typeof window>"u"?!0:"onscrollend"in window,Xv=(e,n)=>{const t=e.scrollElement;if(!t)return;const o=e.targetWindow;if(!o)return;let a=0;const r=e.options.useScrollendEvent&&Qv?()=>{}:Wv(o,()=>{n(a,!1)},e.options.isScrollingResetDelay),i=c=>()=>{const{horizontal:u,isRtl:g}=e.options;a=u?t.scrollLeft*(g&&-1||1):t.scrollTop,r(),n(a,c)},l=i(!0),d=i(!1);return d(),t.addEventListener("scroll",l,Hi),t.addEventListener("scrollend",d,Hi),()=>{t.removeEventListener("scroll",l),t.removeEventListener("scrollend",d)}},Zv=(e,n,t)=>{if(n!=null&&n.borderBoxSize){const o=n.borderBoxSize[0];if(o)return Math.round(o[t.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[t.options.horizontal?"width":"height"])},Jv=(e,{adjustments:n=0,behavior:t},o)=>{var a,r;const i=e+n;(r=(a=o.scrollElement)==null?void 0:a.scrollTo)==null||r.call(a,{[o.options.horizontal?"left":"top"]:i,behavior:t})};class ex{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const o=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(a=>{a.forEach(r=>{this._measureElement(r.target,r)})}));return{disconnect:()=>{var a;(a=o())==null||a.disconnect(),t=null},observe:a=>{var r;return(r=o())==null?void 0:r.observe(a,{box:"border-box"})},unobserve:a=>{var r;return(r=o())==null?void 0:r.unobserve(a)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([o,a])=>{typeof a>"u"&&delete t[o]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Kv,rangeExtractor:Ec,onChange:()=>{},measureElement:Zv,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0,...t}},this.notify=t=>{var o,a;(a=(o=this.options).onChange)==null||a.call(o,this,t)},this.maybeNotify=Gn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const o=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==o){if(this.cleanup(),!o){this.maybeNotify();return}this.scrollElement=o,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=r,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,o)=>{const a=new Map,r=new Map;for(let i=o-1;i>=0;i--){const l=t[i];if(a.has(l.lane))continue;const d=r.get(l.lane);if(d==null||l.end>d.end?r.set(l.lane,l):l.end<d.end&&a.set(l.lane,!0),a.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=Gn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,o,a,r,i)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:o,scrollMargin:a,getItemKey:r,enabled:i}),{key:!1}),this.getMeasurements=Gn(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:o,scrollMargin:a,getItemKey:r,enabled:i},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const d=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,d);for(let u=d;u<t;u++){const g=r(u),m=this.options.lanes===1?c[u-1]:this.getFurthestMeasurement(c,u),h=m?m.end+this.options.gap:o+a,p=l.get(g),f=typeof p=="number"?p:this.options.estimateSize(u),v=h+f,x=m?m.lane:u%this.options.lanes;c[u]={index:u,start:h,size:f,end:v,key:g,lane:x}}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Gn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(t,o,a)=>this.range=t.length>0&&o>0?tx({measurements:t,outerSize:o,scrollOffset:a}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=Gn(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(t,o,a,r)=>o===null?[]:t({startIndex:o.startIndex,endIndex:o.endIndex,overscan:a,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const o=this.options.indexAttribute,a=t.getAttribute(o);return a?parseInt(a,10):-1},this._measureElement=(t,o)=>{const a=this.indexFromElement(t),r=this.measurementsCache[a];if(!r)return;const i=r.key,l=this.elementsCache.get(i);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(a,this.options.measureElement(t,o,this))},this.resizeItem=(t,o)=>{const a=this.measurementsCache[t];if(!a)return;const r=this.itemSizeCache.get(a.key)??a.size,i=o-r;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,i,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,o)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}this._measureElement(t,void 0)},this.getVirtualItems=Gn(()=>[this.getIndexes(),this.getMeasurements()],(t,o)=>{const a=[];for(let r=0,i=t.length;r<i;r++){const l=t[r],d=o[l];a.push(d)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const o=this.getMeasurements();if(o.length!==0)return da(o[Oc(0,o.length-1,a=>da(o[a]).start,t)])},this.getOffsetForAlignment=(t,o)=>{const a=this.getSize(),r=this.getScrollOffset();o==="auto"&&t>=r+a&&(o="end"),o==="end"&&(t-=a);const i=this.options.horizontal?"scrollWidth":"scrollHeight",d=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-a;return Math.max(Math.min(d,t),0)},this.getOffsetForIndex=(t,o="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const a=this.measurementsCache[t];if(!a)return;const r=this.getSize(),i=this.getScrollOffset();if(o==="auto")if(a.end>=i+r-this.options.scrollPaddingEnd)o="end";else if(a.start<=i+this.options.scrollPaddingStart)o="start";else return[i,o];const l=a.start-this.options.scrollPaddingStart+(a.size-r)/2;switch(o){case"center":return[this.getOffsetForAlignment(l,o),o];case"end":return[this.getOffsetForAlignment(a.end+this.options.scrollPaddingEnd,o),o];default:return[this.getOffsetForAlignment(a.start-this.options.scrollPaddingStart,o),o]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(t,{align:o="start",behavior:a}={})=>{this.cancelScrollToIndex(),a==="smooth"&&this.isDynamicMode(),this._scrollToOffset(this.getOffsetForAlignment(t,o),{adjustments:void 0,behavior:a})},this.scrollToIndex=(t,{align:o="auto",behavior:a}={})=>{t=Math.max(0,Math.min(t,this.options.count-1)),this.cancelScrollToIndex(),a==="smooth"&&this.isDynamicMode();const r=this.getOffsetForIndex(t,o);if(!r)return;const[i,l]=r;this._scrollToOffset(i,{adjustments:void 0,behavior:a}),a!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(t))){const[c]=da(this.getOffsetForIndex(t,l));qv(c,this.getScrollOffset())||this.scrollToIndex(t,{align:l,behavior:a})}else this.scrollToIndex(t,{align:l,behavior:a})}))},this.scrollBy=(t,{behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode(),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:o})},this.getTotalSize=()=>{var t;const o=this.getMeasurements();let a;return o.length===0?a=this.options.paddingStart:a=this.options.lanes===1?((t=o[o.length-1])==null?void 0:t.end)??0:Math.max(...o.slice(-this.options.lanes)?.map(r=>r.end)),Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:o,behavior:a})=>{this.options.scrollToFn(t,{behavior:a,adjustments:o},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(n)}}const Oc=(e,n,t,o)=>{for(;e<=n;){const a=(e+n)/2|0,r=t(a);if(r<o)e=a+1;else if(r>o)n=a-1;else return a}return e>0?e-1:0};function tx({measurements:e,outerSize:n,scrollOffset:t}){const o=e.length-1,r=Oc(0,o,l=>e[l].start,t);let i=r;for(;i<o&&e[i].end<t+n;)i++;return{startIndex:r,endIndex:i}}const Gi=typeof document<"u"?y.useLayoutEffect:y.useEffect;function nx(e){const n=y.useReducer(()=>({}),{})[1],t={...e,onChange:(a,r)=>{var i;r?ul.flushSync(n):n(),(i=e.onChange)==null||i.call(e,a,r)}},[o]=y.useState(()=>new ex(t));return o.setOptions(t),Gi(()=>o._didMount(),[]),Gi(()=>o._willUpdate()),o}function Ac(e){return nx({observeElementRect:Yv,observeElementOffset:Xv,scrollToFn:Jv,...e})}function sx({direction:e,levelIndex:n,rowIndex:t,cellIndex:o,size:a}){switch(e){case"up":return n===0&&t===0?null:t===0?{levelIndex:n-1,rowIndex:o<=a[n-1][a[n-1].length-1]-1?a[n-1].length-1:a[n-1].length-2,cellIndex:o}:{levelIndex:n,rowIndex:t-1,cellIndex:o};case"down":return t===a[n].length-1?{levelIndex:n+1,rowIndex:0,cellIndex:o}:t===a[n].length-2&&o>=a[n][a[n].length-1]?{levelIndex:n+1,rowIndex:0,cellIndex:o}:{levelIndex:n,rowIndex:t+1,cellIndex:o};case"left":return n===0&&t===0&&o===0?null:t===0&&o===0?{levelIndex:n-1,rowIndex:a[n-1].length-1,cellIndex:a[n-1][a[n-1].length-1]-1}:o===0?{levelIndex:n,rowIndex:t-1,cellIndex:a[n][t-1]-1}:{levelIndex:n,rowIndex:t,cellIndex:o-1};case"right":return t===a[n].length-1&&o===a[n][t]-1?{levelIndex:n+1,rowIndex:0,cellIndex:0}:o===a[n][t]-1?{levelIndex:n,rowIndex:t+1,cellIndex:0}:{levelIndex:n,rowIndex:t,cellIndex:o+1};default:return{levelIndex:n,rowIndex:t,cellIndex:o}}}function zc({controlsRef:e,direction:n,levelIndex:t,rowIndex:o,cellIndex:a,size:r}){var d,c,u;const i=sx({direction:n,size:r,rowIndex:o,cellIndex:a,levelIndex:t});if(!i)return;const l=(u=(c=(d=e.current)==null?void 0:d[i.levelIndex])==null?void 0:c[i.rowIndex])==null?void 0:u[i.cellIndex];l&&(l.disabled||l.getAttribute("data-hidden")||l.getAttribute("data-outside")?zc({controlsRef:e,direction:n,levelIndex:i.levelIndex,cellIndex:i.cellIndex,rowIndex:i.rowIndex,size:r}):l.focus())}function ox(e){switch(e){case"ArrowDown":return"down";case"ArrowUp":return"up";case"ArrowRight":return"right";case"ArrowLeft":return"left";default:return null}}function ax(e){var n;return(n=e.current)==null?void 0:n?.map(t=>t?.map(o=>o.length))}function Yr({controlsRef:e,levelIndex:n,rowIndex:t,cellIndex:o,event:a}){const r=ox(a.key);if(r){a.preventDefault();const i=ax(e);zc({controlsRef:e,direction:r,levelIndex:n,rowIndex:t,cellIndex:o,size:i})}}function rx(e,n){if(!e||!n)return n;const t=e.getHours(),o=e.getMinutes(),a=e.getSeconds(),r=e.getMilliseconds(),i=new Date(n);return i.setHours(t),i.setMinutes(o),i.setSeconds(a),i.setMilliseconds(r),i}var Qs={exports:{}},ix=Qs.exports,qi;function lx(){return qi||(qi=1,(function(e,n){(function(t,o){e.exports=o()})(ix,(function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},o={};return function(a,r,i){var l,d=function(m,h,p){p===void 0&&(p={});var f=new Date(m),v=(function(x,b){b===void 0&&(b={});var w=b.timeZoneName||"short",C=x+"|"+w,j=o[C];return j||(j=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:x,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:w}),o[C]=j),j})(h,p);return v.formatToParts(f)},c=function(m,h){for(var p=d(m,h),f=[],v=0;v<p.length;v+=1){var x=p[v],b=x.type,w=x.value,C=t[b];C>=0&&(f[C]=parseInt(w,10))}var j=f[3],M=j===24?0:j,k=f[0]+"-"+f[1]+"-"+f[2]+" "+M+":"+f[4]+":"+f[5]+":000",S=+m;return(i.utc(k).valueOf()-(S-=S%1e3))/6e4},u=r.prototype;u.tz=function(m,h){m===void 0&&(m=l);var p,f=this.utcOffset(),v=this.toDate(),x=v.toLocaleString("en-US",{timeZone:m}),b=Math.round((v-new Date(x))/1e3/60),w=15*-Math.round(v.getTimezoneOffset()/15)-b;if(!Number(w))p=this.utcOffset(0,h);else if(p=i(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(w,!0),h){var C=p.utcOffset();p=p.add(f-C,"minute")}return p.$x.$timezone=m,p},u.offsetName=function(m){var h=this.$x.$timezone||i.tz.guess(),p=d(this.valueOf(),h,{timeZoneName:m}).find((function(f){return f.type.toLowerCase()==="timezonename"}));return p&&p.value};var g=u.startOf;u.startOf=function(m,h){if(!this.$x||!this.$x.$timezone)return g.call(this,m,h);var p=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return g.call(p,m,h).tz(this.$x.$timezone,!0)},i.tz=function(m,h,p){var f=p&&h,v=p||h||l,x=c(+i(),v);if(typeof m!="string")return i(m).tz(v);var b=(function(M,k,S){var T=M-60*k*1e3,N=c(T,S);if(k===N)return[T,k];var F=c(T-=60*(N-k)*1e3,S);return N===F?[T,N]:[M-60*Math.min(N,F)*1e3,Math.max(N,F)]})(i.utc(m,f).valueOf(),x,v),w=b[0],C=b[1],j=i(w).utcOffset(C);return j.$x.$timezone=v,j},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(m){l=m}}}))})(Qs)),Qs.exports}var cx=lx();const dx=Za(cx);var Xs={exports:{}},ux=Xs.exports,Wi;function gx(){return Wi||(Wi=1,(function(e,n){(function(t,o){e.exports=o()})(ux,(function(){var t="minute",o=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(r,i,l){var d=i.prototype;l.utc=function(f){var v={date:f,utc:!0,args:arguments};return new i(v)},d.utc=function(f){var v=l(this.toDate(),{locale:this.$L,utc:!0});return f?v.add(this.utcOffset(),t):v},d.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var c=d.parse;d.parse=function(f){f.utc&&(this.$u=!0),this.$utils().u(f.$offset)||(this.$offset=f.$offset),c.call(this,f)};var u=d.init;d.init=function(){if(this.$u){var f=this.$d;this.$y=f.getUTCFullYear(),this.$M=f.getUTCMonth(),this.$D=f.getUTCDate(),this.$W=f.getUTCDay(),this.$H=f.getUTCHours(),this.$m=f.getUTCMinutes(),this.$s=f.getUTCSeconds(),this.$ms=f.getUTCMilliseconds()}else u.call(this)};var g=d.utcOffset;d.utcOffset=function(f,v){var x=this.$utils().u;if(x(f))return this.$u?0:x(this.$offset)?g.call(this):this.$offset;if(typeof f=="string"&&(f=(function(j){j===void 0&&(j="");var M=j.match(o);if(!M)return null;var k=(""+M[0]).match(a)||["-",0,0],S=k[0],T=60*+k[1]+ +k[2];return T===0?0:S==="+"?T:-T})(f),f===null))return this;var b=Math.abs(f)<=16?60*f:f;if(b===0)return this.utc(v);var w=this.clone();if(v)return w.$offset=b,w.$u=!1,w;var C=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(w=this.local().add(b+C,t)).$offset=b,w.$x.$localOffset=C,w};var m=d.format;d.format=function(f){var v=f||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return m.call(this,v)},d.valueOf=function(){var f=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*f},d.isUTC=function(){return!!this.$u},d.toISOString=function(){return this.toDate().toISOString()},d.toString=function(){return this.toDate().toUTCString()};var h=d.toDate;d.toDate=function(f){return f==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():h.call(this)};var p=d.diff;d.diff=function(f,v,x){if(f&&this.$u===f.$u)return p.call(this,f,v,x);var b=this.local(),w=l(f).local();return p.call(b,w,v,x)}}}))})(Xs)),Xs.exports}var mx=gx();const hx=Za(mx);Ce.extend(hx);Ce.extend(dx);function px(e,n){return n?Ce(e).tz(n).utcOffset()+e.getTimezoneOffset():0}const Ki=(e,n,t)=>{if(!e)return null;if(!n)return e;let o=px(e,n);return t==="remove"&&(o*=-1),Ce(e).add(o,"minutes").toDate()};function On(e,n,t,o){return o||!n?n:Array.isArray(n)?n?.map(a=>Ki(a,t,e)):Ki(n,t,e)}const fx={locale:"en",timezone:null,firstDayOfWeek:1,weekendDays:[0,6],labelSeparator:"",consistentWeeks:!1},vx=y.createContext(fx);function qt(){const e=y.useContext(vx),n=y.useCallback(i=>i||e.locale,[e.locale]),t=y.useCallback(i=>i||e.timezone||void 0,[e.timezone]),o=y.useCallback(i=>typeof i=="number"?i:e.firstDayOfWeek,[e.firstDayOfWeek]),a=y.useCallback(i=>Array.isArray(i)?i:e.weekendDays,[e.weekendDays]),r=y.useCallback(i=>typeof i=="string"?i:e.labelSeparator,[e.labelSeparator]);return{...e,getLocale:n,getTimezone:t,getFirstDayOfWeek:o,getWeekendDays:a,getLabelSeparator:r}}function xx(e,n){const t=qt(),o=a=>On("remove",a,t.getTimezone()).toISOString();if(n==="range"&&Array.isArray(e)){const[a,r]=e;return a?r?`${o(a)} ${o(r)}`:`${o(a)} `:""}return n==="multiple"&&Array.isArray(e)?e?.map(a=>a&&o(a)).filter(Boolean).join(", "):!Array.isArray(e)&&e?o(e):""}function $c({value:e,type:n,name:t,form:o}){return s.jsx("input",{type:"hidden",value:xx(e,n),name:t,form:o})}$c.displayName="@mantine/dates/HiddenDatesInput";var Lc={day:"m_396ce5cb"};const bx={},yx=Ye((e,{size:n})=>({day:{"--day-size":Qe(n,"day-size")}})),Qr=ye((e,n)=>{const t=ge("Day",bx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,date:c,disabled:u,__staticSelector:g,weekend:m,outside:h,selected:p,renderDay:f,inRange:v,firstInRange:x,lastInRange:b,hidden:w,static:C,highlightToday:j,...M}=t,k=Be({name:g||"Day",classes:Lc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:yx,rootSelector:"day"}),S=qt();return s.jsx(Et,{...k("day",{style:w?{display:"none"}:void 0}),component:C?"div":"button",ref:n,disabled:u,"data-today":Ce(c).isSame(On("add",new Date,S.getTimezone()),"day")||void 0,"data-hidden":w||void 0,"data-highlight-today":j||void 0,"data-disabled":u||void 0,"data-weekend":!u&&!h&&m||void 0,"data-outside":!u&&h||void 0,"data-selected":!u&&p||void 0,"data-in-range":v&&!u||void 0,"data-first-in-range":x&&!u||void 0,"data-last-in-range":b&&!u||void 0,"data-static":C||void 0,unstyled:l,...M,children:(f==null?void 0:f(c))||Ce(c).date()})});Qr.classes=Lc;Qr.displayName="@mantine/dates/Day";function wx({locale:e,format:n="dd",firstDayOfWeek:t=1}){const o=Ce().day(t),a=[];for(let r=0;r<7;r+=1)typeof n=="string"?a.push(Ce(o).add(r,"days").locale(e).format(n)):a.push(n(Ce(o).add(r,"days").toDate()));return a}var Vc={weekday:"m_18a3eca"};const jx={},Cx=Ye((e,{size:n})=>({weekdaysRow:{"--wr-fz":kt(n),"--wr-spacing":xt(n)}})),Xr=ye((e,n)=>{const t=ge("WeekdaysRow",jx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,locale:c,firstDayOfWeek:u,weekdayFormat:g,cellComponent:m="th",__staticSelector:h,withWeekNumbers:p,...f}=t,v=Be({name:h||"WeekdaysRow",classes:Vc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Cx,rootSelector:"weekdaysRow"}),x=qt(),b=wx({locale:x.getLocale(c),format:g,firstDayOfWeek:x.getFirstDayOfWeek(u)})?.map((w,C)=>s.jsx(m,{...v("weekday"),children:w},C));return s.jsxs(G,{component:"tr",ref:n,...v("weekdaysRow"),...f,children:[p&&s.jsx(m,{...v("weekday"),children:"#"}),b]})});Xr.classes=Vc;Xr.displayName="@mantine/dates/WeekdaysRow";function Sx(e,n=1){let t=Ce(e);const o=n===0?6:n-1;for(;t.day()!==o;)t=t.add(1,"day");return t.toDate()}function _x(e,n=1){let t=Ce(e);for(;t.day()!==n;)t=t.subtract(1,"day");return t.toDate()}function Mx({month:e,firstDayOfWeek:n=1,consistentWeeks:t}){const o=Ce(e).subtract(Ce(e).date()-1,"day"),a=Ce(o).startOf("day"),r=a.toDate(),i=a.add(+a.daysInMonth()-1,"day").toDate(),l=Sx(i,n),d=_x(r,n),c=[];for(;d<=l;){const u=[];for(let g=0;g<7;g+=1)u.push(new Date(d)),d.setDate(d.getDate()+1);c.push(u)}if(t&&c.length<6){const u=c[c.length-1],g=u[u.length-1],m=new Date(g);for(m.setDate(m.getDate()+1);c.length<6;){const h=[];for(let p=0;p<7;p+=1)h.push(new Date(m)),m.setDate(m.getDate()+1);c.push(h)}}return c}function Bc(e,n){return Ce(e).format("YYYY-MM")===Ce(n).format("YYYY-MM")}function Uc(e,n){return n instanceof Date?Ce(e).isAfter(Ce(n).subtract(1,"day"),"day"):!0}function Hc(e,n){return n instanceof Date?Ce(e).isBefore(Ce(n).add(1,"day"),"day"):!0}function Rx(e,n,t,o,a,r,i){const l=e.flat().filter(u=>{var g;return Hc(u,t)&&Uc(u,n)&&!(a!=null&&a(u))&&!((g=o==null?void 0:o(u))!=null&&g.disabled)&&(!r||Bc(u,i))}),d=l.find(u=>{var g;return(g=o==null?void 0:o(u))==null?void 0:g.selected});if(d)return d;const c=l.find(u=>Ce().isSame(u,"date"));return c||l[0]}var Zs={exports:{}},Nx=Zs.exports,Yi;function kx(){return Yi||(Yi=1,(function(e,n){(function(t,o){e.exports=o()})(Nx,(function(){var t="day";return function(o,a,r){var i=function(c){return c.add(4-c.isoWeekday(),t)},l=a.prototype;l.isoWeekYear=function(){return i(this).year()},l.isoWeek=function(c){if(!this.$utils().u(c))return this.add(7*(c-this.isoWeek()),t);var u,g,m,h,p=i(this),f=(u=this.isoWeekYear(),g=this.$u,m=(g?r.utc:r)().year(u).startOf("year"),h=4-m.isoWeekday(),m.isoWeekday()>4&&(h+=7),m.add(h,t));return p.diff(f,"week")+1},l.isoWeekday=function(c){return this.$utils().u(c)?this.day()||7:this.day(this.day()%7?c:c-7)};var d=l.startOf;l.startOf=function(c,u){var g=this.$utils(),m=!!g.u(u)||u;return g.p(c)==="isoweek"?m?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):d.bind(this)(c,u)}}}))})(Zs)),Zs.exports}var Dx=kx();const Tx=Za(Dx);Ce.extend(Tx);function Ix(e){const n=e.find(t=>Ce(t).day()===1);return Ce(n).isoWeek()}var Gc={month:"m_cc9820d3",monthCell:"m_8f457cd5",weekNumber:"m_6cff9dea"};const Fx={withCellSpacing:!0},Px=Ye((e,{size:n})=>({weekNumber:{"--wn-fz":kt(n),"--wn-size":Qe(n,"wn-size")}})),Oo=ye((e,n)=>{const t=ge("Month",Fx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,__staticSelector:c,locale:u,firstDayOfWeek:g,weekdayFormat:m,month:h,weekendDays:p,getDayProps:f,excludeDate:v,minDate:x,maxDate:b,renderDay:w,hideOutsideDates:C,hideWeekdays:j,getDayAriaLabel:M,static:k,__getDayRef:S,__onDayKeyDown:T,__onDayClick:N,__onDayMouseEnter:F,__preventFocus:E,__stopPropagation:V,withCellSpacing:L,size:B,highlightToday:_,withWeekNumbers:D,...O}=t,P=Be({name:c||"Month",classes:Gc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Px,rootSelector:"month"}),$=qt(),z=Mx({month:h,firstDayOfWeek:$.getFirstDayOfWeek(g),consistentWeeks:$.consistentWeeks}),H=Rx(z,x,b,f,v,C,h),{resolvedClassNames:ae,resolvedStyles:ie}=_n({classNames:o,styles:i,props:t}),Q=z?.map((se,te)=>{const Z=se?.map((I,Y)=>{const ce=!Bc(I,h),ee=(M==null?void 0:M(I))||Ce(I).locale(u||$.locale).format("D MMMM YYYY"),W=f==null?void 0:f(I),me=Ce(I).isSame(H,"date");return s.jsx("td",{...P("monthCell"),"data-with-spacing":L||void 0,children:s.jsx(Qr,{__staticSelector:c||"Month",classNames:ae,styles:ie,unstyled:l,"data-mantine-stop-propagation":V||void 0,highlightToday:_,renderDay:w,date:I,size:B,weekend:$.getWeekendDays(p).includes(I.getDay()),outside:ce,hidden:C?ce:!1,"aria-label":ee,static:k,disabled:(v==null?void 0:v(I))||!Hc(I,b)||!Uc(I,x),ref:le=>S==null?void 0:S(te,Y,le),...W,onKeyDown:le=>{var de;(de=W==null?void 0:W.onKeyDown)==null||de.call(W,le),T==null||T(le,{rowIndex:te,cellIndex:Y,date:I})},onMouseEnter:le=>{var de;(de=W==null?void 0:W.onMouseEnter)==null||de.call(W,le),F==null||F(le,I)},onClick:le=>{var de;(de=W==null?void 0:W.onClick)==null||de.call(W,le),N==null||N(le,I)},onMouseDown:le=>{var de;(de=W==null?void 0:W.onMouseDown)==null||de.call(W,le),E&&le.preventDefault()},tabIndex:E||!me?-1:0})},I.toString())});return s.jsxs("tr",{...P("monthRow"),children:[D&&s.jsx("td",{...P("weekNumber"),children:Ix(se)}),Z]},te)});return s.jsxs(G,{component:"table",...P("month"),size:B,ref:n,...O,children:[!j&&s.jsx("thead",{...P("monthThead"),children:s.jsx(Xr,{__staticSelector:c||"Month",locale:u,firstDayOfWeek:g,weekdayFormat:m,size:B,classNames:ae,styles:ie,unstyled:l,withWeekNumbers:D})}),s.jsx("tbody",{...P("monthTbody"),children:Q})]})});Oo.classes=Gc;Oo.displayName="@mantine/dates/Month";var qc={pickerControl:"m_dc6a3c71"};const Ex={},Ox=Ye((e,{size:n})=>({pickerControl:{"--dpc-fz":kt(n),"--dpc-size":Qe(n,"dpc-size")}})),Ao=ye((e,n)=>{const t=ge("PickerControl",Ex,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,firstInRange:c,lastInRange:u,inRange:g,__staticSelector:m,selected:h,disabled:p,...f}=t,v=Be({name:m||"PickerControl",classes:qc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Ox,rootSelector:"pickerControl"});return s.jsx(Et,{...v("pickerControl"),ref:n,unstyled:l,"data-picker-control":!0,"data-selected":h&&!p||void 0,"data-disabled":p||void 0,"data-in-range":g&&!p&&!h||void 0,"data-first-in-range":c&&!p||void 0,"data-last-in-range":u&&!p||void 0,disabled:p,...f})});Ao.classes=qc;Ao.displayName="@mantine/dates/PickerControl";function Wc(e,n,t){return!n&&!t?!1:!!(n&&Ce(e).isBefore(n,"year")||t&&Ce(e).isAfter(t,"year"))}function Ax(e,n,t,o){const a=e.flat().filter(l=>{var d;return!Wc(l,n,t)&&!((d=o==null?void 0:o(l))!=null&&d.disabled)}),r=a.find(l=>{var d;return(d=o==null?void 0:o(l))==null?void 0:d.selected});if(r)return r;const i=a.find(l=>Ce().isSame(l,"year"));return i||a[0]}function Kc(e){const n=e.getFullYear(),t=n-n%10;let o=0;const a=[[],[],[],[]];for(let r=0;r<4;r+=1){const i=r===3?1:3;for(let l=0;l<i;l+=1)a[r].push(new Date(t+o,0)),o+=1}return a}var Yc={yearsList:"m_9206547b",yearsListCell:"m_c5a19c7d"};const zx={yearsListFormat:"YYYY",withCellSpacing:!0},zo=ye((e,n)=>{const t=ge("YearsList",zx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,decade:c,yearsListFormat:u,locale:g,minDate:m,maxDate:h,getYearControlProps:p,__staticSelector:f,__getControlRef:v,__onControlKeyDown:x,__onControlClick:b,__onControlMouseEnter:w,__preventFocus:C,__stopPropagation:j,withCellSpacing:M,size:k,...S}=t,T=Be({name:f||"YearsList",classes:Yc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,rootSelector:"yearsList"}),N=qt(),F=Kc(c),E=Ax(F,m,h,p),V=F?.map((L,B)=>{const _=L?.map((D,O)=>{const P=p==null?void 0:p(D),$=Ce(D).isSame(E,"year");return s.jsx("td",{...T("yearsListCell"),"data-with-spacing":M||void 0,children:s.jsx(Ao,{...T("yearsListControl"),size:k,unstyled:l,"data-mantine-stop-propagation":j||void 0,disabled:Wc(D,m,h),ref:z=>v==null?void 0:v(B,O,z),...P,onKeyDown:z=>{var H;(H=P==null?void 0:P.onKeyDown)==null||H.call(P,z),x==null||x(z,{rowIndex:B,cellIndex:O,date:D})},onClick:z=>{var H;(H=P==null?void 0:P.onClick)==null||H.call(P,z),b==null||b(z,D)},onMouseEnter:z=>{var H;(H=P==null?void 0:P.onMouseEnter)==null||H.call(P,z),w==null||w(z,D)},onMouseDown:z=>{var H;(H=P==null?void 0:P.onMouseDown)==null||H.call(P,z),C&&z.preventDefault()},tabIndex:C||!$?-1:0,children:Ce(D).locale(N.getLocale(g)).format(u)})},O)});return s.jsx("tr",{...T("yearsListRow"),children:_},B)});return s.jsx(G,{component:"table",ref:n,size:k,...T("yearsList"),...S,children:s.jsx("tbody",{children:V})})});zo.classes=Yc;zo.displayName="@mantine/dates/YearsList";function Qc(e,n,t){return!n&&!t?!1:!!(n&&Ce(e).isBefore(n,"month")||t&&Ce(e).isAfter(t,"month"))}function $x(e,n,t,o){const a=e.flat().filter(l=>{var d;return!Qc(l,n,t)&&!((d=o==null?void 0:o(l))!=null&&d.disabled)}),r=a.find(l=>{var d;return(d=o==null?void 0:o(l))==null?void 0:d.selected});if(r)return r;const i=a.find(l=>Ce().isSame(l,"month"));return i||a[0]}function Lx(e){const n=Ce(e).startOf("year").toDate(),t=[[],[],[],[]];let o=0;for(let a=0;a<4;a+=1)for(let r=0;r<3;r+=1)t[a].push(Ce(n).add(o,"months").toDate()),o+=1;return t}var Xc={monthsList:"m_2a6c32d",monthsListCell:"m_fe27622f"};const Vx={monthsListFormat:"MMM",withCellSpacing:!0},$o=ye((e,n)=>{const t=ge("MonthsList",Vx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,__staticSelector:c,year:u,monthsListFormat:g,locale:m,minDate:h,maxDate:p,getMonthControlProps:f,__getControlRef:v,__onControlKeyDown:x,__onControlClick:b,__onControlMouseEnter:w,__preventFocus:C,__stopPropagation:j,withCellSpacing:M,size:k,...S}=t,T=Be({name:c||"MonthsList",classes:Xc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,rootSelector:"monthsList"}),N=qt(),F=Lx(u),E=$x(F,h,p,f),V=F?.map((L,B)=>{const _=L?.map((D,O)=>{const P=f==null?void 0:f(D),$=Ce(D).isSame(E,"month");return s.jsx("td",{...T("monthsListCell"),"data-with-spacing":M||void 0,children:s.jsx(Ao,{...T("monthsListControl"),size:k,unstyled:l,__staticSelector:c||"MonthsList","data-mantine-stop-propagation":j||void 0,disabled:Qc(D,h,p),ref:z=>v==null?void 0:v(B,O,z),...P,onKeyDown:z=>{var H;(H=P==null?void 0:P.onKeyDown)==null||H.call(P,z),x==null||x(z,{rowIndex:B,cellIndex:O,date:D})},onClick:z=>{var H;(H=P==null?void 0:P.onClick)==null||H.call(P,z),b==null||b(z,D)},onMouseEnter:z=>{var H;(H=P==null?void 0:P.onMouseEnter)==null||H.call(P,z),w==null||w(z,D)},onMouseDown:z=>{var H;(H=P==null?void 0:P.onMouseDown)==null||H.call(P,z),C&&z.preventDefault()},tabIndex:C||!$?-1:0,children:Ce(D).locale(N.getLocale(m)).format(g)})},O)});return s.jsx("tr",{...T("monthsListRow"),children:_},B)});return s.jsx(G,{component:"table",ref:n,size:k,...T("monthsList"),...S,children:s.jsx("tbody",{children:V})})});$o.classes=Xc;$o.displayName="@mantine/dates/MonthsList";var Zc={calendarHeader:"m_730a79ed",calendarHeaderLevel:"m_f6645d97",calendarHeaderControl:"m_2351eeb0",calendarHeaderControlIcon:"m_367dc749"};const Bx={nextDisabled:!1,previousDisabled:!1,hasNextLevel:!0,withNext:!0,withPrevious:!0},Ux=Ye((e,{size:n})=>({calendarHeader:{"--dch-control-size":Qe(n,"dch-control-size"),"--dch-fz":kt(n)}})),Rn=ye((e,n)=>{const t=ge("CalendarHeader",Bx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,nextIcon:c,previousIcon:u,nextLabel:g,previousLabel:m,onNext:h,onPrevious:p,onLevelClick:f,label:v,nextDisabled:x,previousDisabled:b,hasNextLevel:w,levelControlAriaLabel:C,withNext:j,withPrevious:M,__staticSelector:k,__preventFocus:S,__stopPropagation:T,...N}=t,F=Be({name:k||"CalendarHeader",classes:Zc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Ux,rootSelector:"calendarHeader"}),E=S?V=>V.preventDefault():void 0;return s.jsxs(G,{...F("calendarHeader"),ref:n,...N,children:[M&&s.jsx(Et,{...F("calendarHeaderControl"),"data-direction":"previous","aria-label":m,onClick:p,unstyled:l,onMouseDown:E,disabled:b,"data-disabled":b||void 0,tabIndex:S||b?-1:0,"data-mantine-stop-propagation":T||void 0,children:u||s.jsx(Da,{...F("calendarHeaderControlIcon"),"data-direction":"previous",size:"45%"})}),s.jsx(Et,{component:w?"button":"div",...F("calendarHeaderLevel"),onClick:w?f:void 0,unstyled:l,onMouseDown:w?E:void 0,disabled:!w,"data-static":!w||void 0,"aria-label":C,tabIndex:S||!w?-1:0,"data-mantine-stop-propagation":T||void 0,children:v}),j&&s.jsx(Et,{...F("calendarHeaderControl"),"data-direction":"next","aria-label":g,onClick:h,unstyled:l,onMouseDown:E,disabled:x,"data-disabled":x||void 0,tabIndex:S||x?-1:0,"data-mantine-stop-propagation":T||void 0,children:c||s.jsx(Da,{...F("calendarHeaderControlIcon"),"data-direction":"next",size:"45%"})})]})});Rn.classes=Zc;Rn.displayName="@mantine/dates/CalendarHeader";function Hx(e){const n=Kc(e);return[n[0][0],n[3][0]]}const Gx={decadeLabelFormat:"YYYY"},Lo=ye((e,n)=>{const t=ge("DecadeLevel",Gx,e),{decade:o,locale:a,minDate:r,maxDate:i,yearsListFormat:l,getYearControlProps:d,__getControlRef:c,__onControlKeyDown:u,__onControlClick:g,__onControlMouseEnter:m,withCellSpacing:h,__preventFocus:p,nextIcon:f,previousIcon:v,nextLabel:x,previousLabel:b,onNext:w,onPrevious:C,nextDisabled:j,previousDisabled:M,levelControlAriaLabel:k,withNext:S,withPrevious:T,decadeLabelFormat:N,classNames:F,styles:E,unstyled:V,__staticSelector:L,__stopPropagation:B,size:_,...D}=t,O=qt(),[P,$]=Hx(o),z={__staticSelector:L||"DecadeLevel",classNames:F,styles:E,unstyled:V,size:_},H=typeof j=="boolean"?j:i?!Ce($).endOf("year").isBefore(i):!1,ae=typeof M=="boolean"?M:r?!Ce(P).startOf("year").isAfter(r):!1,ie=(Q,se)=>Ce(Q).locale(a||O.locale).format(se);return s.jsxs(G,{"data-decade-level":!0,size:_,ref:n,...D,children:[s.jsx(Rn,{label:typeof N=="function"?N(P,$):`${ie(P,N)} ${ie($,N)}`,__preventFocus:p,__stopPropagation:B,nextIcon:f,previousIcon:v,nextLabel:x,previousLabel:b,onNext:w,onPrevious:C,nextDisabled:H,previousDisabled:ae,hasNextLevel:!1,levelControlAriaLabel:k,withNext:S,withPrevious:T,...z}),s.jsx(zo,{decade:o,locale:a,minDate:r,maxDate:i,yearsListFormat:l,getYearControlProps:d,__getControlRef:c,__onControlKeyDown:u,__onControlClick:g,__onControlMouseEnter:m,__preventFocus:p,__stopPropagation:B,withCellSpacing:h,...z})]})});Lo.classes={...zo.classes,...Rn.classes};Lo.displayName="@mantine/dates/DecadeLevel";const qx={yearLabelFormat:"YYYY"},Vo=ye((e,n)=>{const t=ge("YearLevel",qx,e),{year:o,locale:a,minDate:r,maxDate:i,monthsListFormat:l,getMonthControlProps:d,__getControlRef:c,__onControlKeyDown:u,__onControlClick:g,__onControlMouseEnter:m,withCellSpacing:h,__preventFocus:p,nextIcon:f,previousIcon:v,nextLabel:x,previousLabel:b,onNext:w,onPrevious:C,onLevelClick:j,nextDisabled:M,previousDisabled:k,hasNextLevel:S,levelControlAriaLabel:T,withNext:N,withPrevious:F,yearLabelFormat:E,__staticSelector:V,__stopPropagation:L,size:B,classNames:_,styles:D,unstyled:O,...P}=t,$=qt(),z={__staticSelector:V||"YearLevel",classNames:_,styles:D,unstyled:O,size:B},H=typeof M=="boolean"?M:i?!Ce(o).endOf("year").isBefore(i):!1,ae=typeof k=="boolean"?k:r?!Ce(o).startOf("year").isAfter(r):!1;return s.jsxs(G,{"data-year-level":!0,size:B,ref:n,...P,children:[s.jsx(Rn,{label:typeof E=="function"?E(o):Ce(o).locale(a||$.locale).format(E),__preventFocus:p,__stopPropagation:L,nextIcon:f,previousIcon:v,nextLabel:x,previousLabel:b,onNext:w,onPrevious:C,onLevelClick:j,nextDisabled:H,previousDisabled:ae,hasNextLevel:S,levelControlAriaLabel:T,withNext:N,withPrevious:F,...z}),s.jsx($o,{year:o,locale:a,minDate:r,maxDate:i,monthsListFormat:l,getMonthControlProps:d,__getControlRef:c,__onControlKeyDown:u,__onControlClick:g,__onControlMouseEnter:m,__preventFocus:p,__stopPropagation:L,withCellSpacing:h,...z})]})});Vo.classes={...Rn.classes,...$o.classes};Vo.displayName="@mantine/dates/YearLevel";const Wx={monthLabelFormat:"MMMM YYYY"},Bo=ye((e,n)=>{const t=ge("MonthLevel",Wx,e),{month:o,locale:a,firstDayOfWeek:r,weekdayFormat:i,weekendDays:l,getDayProps:d,excludeDate:c,minDate:u,maxDate:g,renderDay:m,hideOutsideDates:h,hideWeekdays:p,getDayAriaLabel:f,__getDayRef:v,__onDayKeyDown:x,__onDayClick:b,__onDayMouseEnter:w,withCellSpacing:C,highlightToday:j,withWeekNumbers:M,__preventFocus:k,__stopPropagation:S,nextIcon:T,previousIcon:N,nextLabel:F,previousLabel:E,onNext:V,onPrevious:L,onLevelClick:B,nextDisabled:_,previousDisabled:D,hasNextLevel:O,levelControlAriaLabel:P,withNext:$,withPrevious:z,monthLabelFormat:H,classNames:ae,styles:ie,unstyled:Q,__staticSelector:se,size:te,static:Z,...I}=t,Y=qt(),ce={__staticSelector:se||"MonthLevel",classNames:ae,styles:ie,unstyled:Q,size:te},ee=typeof _=="boolean"?_:g?!Ce(o).endOf("month").isBefore(g):!1,W=typeof D=="boolean"?D:u?!Ce(o).startOf("month").isAfter(u):!1;return s.jsxs(G,{"data-month-level":!0,size:te,ref:n,...I,children:[s.jsx(Rn,{label:typeof H=="function"?H(o):Ce(o).locale(a||Y.locale).format(H),__preventFocus:k,__stopPropagation:S,nextIcon:T,previousIcon:N,nextLabel:F,previousLabel:E,onNext:V,onPrevious:L,onLevelClick:B,nextDisabled:ee,previousDisabled:W,hasNextLevel:O,levelControlAriaLabel:P,withNext:$,withPrevious:z,...ce}),s.jsx(Oo,{month:o,locale:a,firstDayOfWeek:r,weekdayFormat:i,weekendDays:l,getDayProps:d,excludeDate:c,minDate:u,maxDate:g,renderDay:m,hideOutsideDates:h,hideWeekdays:p,getDayAriaLabel:f,__getDayRef:v,__onDayKeyDown:x,__onDayClick:b,__onDayMouseEnter:w,__preventFocus:k,__stopPropagation:S,static:Z,withCellSpacing:C,highlightToday:j,withWeekNumbers:M,...ce})]})});Bo.classes={...Oo.classes,...Rn.classes};Bo.displayName="@mantine/dates/MonthLevel";var Jc={levelsGroup:"m_30b26e33"};const Kx={},Nn=ye((e,n)=>{const t=ge("LevelsGroup",Kx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,__staticSelector:c,...u}=t,g=Be({name:c||"LevelsGroup",classes:Jc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,rootSelector:"levelsGroup"});return s.jsx(G,{ref:n,...g("levelsGroup"),...u})});Nn.classes=Jc;Nn.displayName="@mantine/dates/LevelsGroup";const Yx={numberOfColumns:1},Uo=ye((e,n)=>{const t=ge("DecadeLevelGroup",Yx,e),{decade:o,locale:a,minDate:r,maxDate:i,yearsListFormat:l,getYearControlProps:d,__onControlClick:c,__onControlMouseEnter:u,withCellSpacing:g,__preventFocus:m,nextIcon:h,previousIcon:p,nextLabel:f,previousLabel:v,onNext:x,onPrevious:b,nextDisabled:w,previousDisabled:C,classNames:j,styles:M,unstyled:k,__staticSelector:S,__stopPropagation:T,numberOfColumns:N,levelControlAriaLabel:F,decadeLabelFormat:E,size:V,vars:L,...B}=t,_=y.useRef([]),D=Array(N).fill(0)?.map((O,P)=>{const $=Ce(o).add(P*10,"years").toDate();return s.jsx(Lo,{size:V,yearsListFormat:l,decade:$,withNext:P===N-1,withPrevious:P===0,decadeLabelFormat:E,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(z,H)=>Yr({levelIndex:P,rowIndex:H.rowIndex,cellIndex:H.cellIndex,event:z,controlsRef:_}),__getControlRef:(z,H,ae)=>{Array.isArray(_.current[P])||(_.current[P]=[]),Array.isArray(_.current[P][z])||(_.current[P][z]=[]),_.current[P][z][H]=ae},levelControlAriaLabel:typeof F=="function"?F($):F,locale:a,minDate:r,maxDate:i,__preventFocus:m,__stopPropagation:T,nextIcon:h,previousIcon:p,nextLabel:f,previousLabel:v,onNext:x,onPrevious:b,nextDisabled:w,previousDisabled:C,getYearControlProps:d,__staticSelector:S||"DecadeLevelGroup",classNames:j,styles:M,unstyled:k,withCellSpacing:g},P)});return s.jsx(Nn,{classNames:j,styles:M,__staticSelector:S||"DecadeLevelGroup",ref:n,size:V,unstyled:k,...B,children:D})});Uo.classes={...Nn.classes,...Lo.classes};Uo.displayName="@mantine/dates/DecadeLevelGroup";const Qx={numberOfColumns:1},Ho=ye((e,n)=>{const t=ge("YearLevelGroup",Qx,e),{year:o,locale:a,minDate:r,maxDate:i,monthsListFormat:l,getMonthControlProps:d,__onControlClick:c,__onControlMouseEnter:u,withCellSpacing:g,__preventFocus:m,nextIcon:h,previousIcon:p,nextLabel:f,previousLabel:v,onNext:x,onPrevious:b,onLevelClick:w,nextDisabled:C,previousDisabled:j,hasNextLevel:M,classNames:k,styles:S,unstyled:T,__staticSelector:N,__stopPropagation:F,numberOfColumns:E,levelControlAriaLabel:V,yearLabelFormat:L,size:B,vars:_,...D}=t,O=y.useRef([]),P=Array(E).fill(0)?.map(($,z)=>{const H=Ce(o).add(z,"years").toDate();return s.jsx(Vo,{size:B,monthsListFormat:l,year:H,withNext:z===E-1,withPrevious:z===0,yearLabelFormat:L,__stopPropagation:F,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(ae,ie)=>Yr({levelIndex:z,rowIndex:ie.rowIndex,cellIndex:ie.cellIndex,event:ae,controlsRef:O}),__getControlRef:(ae,ie,Q)=>{Array.isArray(O.current[z])||(O.current[z]=[]),Array.isArray(O.current[z][ae])||(O.current[z][ae]=[]),O.current[z][ae][ie]=Q},levelControlAriaLabel:typeof V=="function"?V(H):V,locale:a,minDate:r,maxDate:i,__preventFocus:m,nextIcon:h,previousIcon:p,nextLabel:f,previousLabel:v,onNext:x,onPrevious:b,onLevelClick:w,nextDisabled:C,previousDisabled:j,hasNextLevel:M,getMonthControlProps:d,classNames:k,styles:S,unstyled:T,__staticSelector:N||"YearLevelGroup",withCellSpacing:g},z)});return s.jsx(Nn,{classNames:k,styles:S,__staticSelector:N||"YearLevelGroup",ref:n,size:B,unstyled:T,...D,children:P})});Ho.classes={...Vo.classes,...Nn.classes};Ho.displayName="@mantine/dates/YearLevelGroup";const Xx={numberOfColumns:1},Go=ye((e,n)=>{const t=ge("MonthLevelGroup",Xx,e),{month:o,locale:a,firstDayOfWeek:r,weekdayFormat:i,weekendDays:l,getDayProps:d,excludeDate:c,minDate:u,maxDate:g,renderDay:m,hideOutsideDates:h,hideWeekdays:p,getDayAriaLabel:f,__onDayClick:v,__onDayMouseEnter:x,withCellSpacing:b,highlightToday:w,withWeekNumbers:C,__preventFocus:j,nextIcon:M,previousIcon:k,nextLabel:S,previousLabel:T,onNext:N,onPrevious:F,onLevelClick:E,nextDisabled:V,previousDisabled:L,hasNextLevel:B,classNames:_,styles:D,unstyled:O,numberOfColumns:P,levelControlAriaLabel:$,monthLabelFormat:z,__staticSelector:H,__stopPropagation:ae,size:ie,static:Q,vars:se,...te}=t,Z=y.useRef([]),I=Array(P).fill(0)?.map((Y,ce)=>{const ee=Ce(o).add(ce,"months").toDate();return s.jsx(Bo,{month:ee,withNext:ce===P-1,withPrevious:ce===0,monthLabelFormat:z,__stopPropagation:ae,__onDayClick:v,__onDayMouseEnter:x,__onDayKeyDown:(W,me)=>Yr({levelIndex:ce,rowIndex:me.rowIndex,cellIndex:me.cellIndex,event:W,controlsRef:Z}),__getDayRef:(W,me,le)=>{Array.isArray(Z.current[ce])||(Z.current[ce]=[]),Array.isArray(Z.current[ce][W])||(Z.current[ce][W]=[]),Z.current[ce][W][me]=le},levelControlAriaLabel:typeof $=="function"?$(ee):$,locale:a,firstDayOfWeek:r,weekdayFormat:i,weekendDays:l,getDayProps:d,excludeDate:c,minDate:u,maxDate:g,renderDay:m,hideOutsideDates:h,hideWeekdays:p,getDayAriaLabel:f,__preventFocus:j,nextIcon:M,previousIcon:k,nextLabel:S,previousLabel:T,onNext:N,onPrevious:F,onLevelClick:E,nextDisabled:V,previousDisabled:L,hasNextLevel:B,classNames:_,styles:D,unstyled:O,__staticSelector:H||"MonthLevelGroup",size:ie,static:Q,withCellSpacing:b,highlightToday:w,withWeekNumbers:C},ce)});return s.jsx(Nn,{classNames:_,styles:D,__staticSelector:H||"MonthLevelGroup",ref:n,size:ie,...te,children:I})});Go.classes={...Nn.classes,...Bo.classes};Go.displayName="@mantine/dates/MonthLevelGroup";const Qi=e=>e==="range"?[null,null]:e==="multiple"?[]:null;function Va({type:e,value:n,defaultValue:t,onChange:o,applyTimezone:a=!0}){const r=y.useRef(e),i=qt(),[l,d,c]=$t({value:On("add",n,i.getTimezone(),!a),defaultValue:On("add",t,i.getTimezone(),!a),finalValue:Qi(e),onChange:g=>{o==null||o(On("remove",g,i.getTimezone(),!a))}});let u=l;return r.current!==e&&(r.current=e,n===void 0&&(u=t!==void 0?t:Qi(e),d(u))),[u,d,c]}function ua(e,n){return e?e==="month"?0:e==="year"?1:2:n||0}function Zx(e){return e===0?"month":e===1?"year":"decade"}function ms(e,n,t){return Zx(En(ua(e,0),ua(n,0),ua(t,2)))}const Jx={maxLevel:"decade",minLevel:"month",__updateDateOnYearSelect:!0,__updateDateOnMonthSelect:!0},qo=ye((e,n)=>{const t=ge("Calendar",Jx,e),{vars:o,maxLevel:a,minLevel:r,defaultLevel:i,level:l,onLevelChange:d,date:c,defaultDate:u,onDateChange:g,numberOfColumns:m,columnsToScroll:h,ariaLabels:p,nextLabel:f,previousLabel:v,onYearSelect:x,onMonthSelect:b,onYearMouseEnter:w,onMonthMouseEnter:C,__updateDateOnYearSelect:j,__updateDateOnMonthSelect:M,firstDayOfWeek:k,weekdayFormat:S,weekendDays:T,getDayProps:N,excludeDate:F,renderDay:E,hideOutsideDates:V,hideWeekdays:L,getDayAriaLabel:B,monthLabelFormat:_,nextIcon:D,previousIcon:O,__onDayClick:P,__onDayMouseEnter:$,withCellSpacing:z,highlightToday:H,withWeekNumbers:ae,monthsListFormat:ie,getMonthControlProps:Q,yearLabelFormat:se,yearsListFormat:te,getYearControlProps:Z,decadeLabelFormat:I,classNames:Y,styles:ce,unstyled:ee,minDate:W,maxDate:me,locale:le,__staticSelector:de,size:K,__preventFocus:A,__stopPropagation:ne,onNextDecade:be,onPreviousDecade:ve,onNextYear:Se,onPreviousYear:we,onNextMonth:U,onPreviousMonth:q,static:oe,__timezoneApplied:Ie,...he}=t,{resolvedClassNames:X,resolvedStyles:_e}=_n({classNames:Y,styles:ce,props:t}),[Oe,Xe]=$t({value:l?ms(l,r,a):void 0,defaultValue:i?ms(i,r,a):void 0,finalValue:ms(void 0,r,a),onChange:d}),[ot,et]=Va({type:"default",value:c,defaultValue:u,onChange:g,applyTimezone:!Ie}),J={__staticSelector:de||"Calendar",styles:_e,classNames:X,unstyled:ee,size:K},Ae=qt(),$e=h||m||1,re=new Date,Ke=W&&W>re?W:re,Le=ot||On("add",Ke,Ae.getTimezone()),lt=()=>{const tt=Ce(Le).add($e,"month").toDate();U==null||U(tt),et(tt)},It=()=>{const tt=Ce(Le).subtract($e,"month").toDate();q==null||q(tt),et(tt)},at=()=>{const tt=Ce(Le).add($e,"year").toDate();Se==null||Se(tt),et(tt)},kn=()=>{const tt=Ce(Le).subtract($e,"year").toDate();we==null||we(tt),et(tt)},it=()=>{const tt=Ce(Le).add(10*$e,"year").toDate();be==null||be(tt),et(tt)},us=()=>{const tt=Ce(Le).subtract(10*$e,"year").toDate();ve==null||ve(tt),et(tt)};return s.jsxs(G,{ref:n,size:K,"data-calendar":!0,...he,children:[Oe==="month"&&s.jsx(Go,{month:Le,minDate:W,maxDate:me,firstDayOfWeek:k,weekdayFormat:S,weekendDays:T,getDayProps:N,excludeDate:F,renderDay:E,hideOutsideDates:V,hideWeekdays:L,getDayAriaLabel:B,onNext:lt,onPrevious:It,hasNextLevel:a!=="month",onLevelClick:()=>Xe("year"),numberOfColumns:m,locale:le,levelControlAriaLabel:p==null?void 0:p.monthLevelControl,nextLabel:(p==null?void 0:p.nextMonth)??f,nextIcon:D,previousLabel:(p==null?void 0:p.previousMonth)??v,previousIcon:O,monthLabelFormat:_,__onDayClick:P,__onDayMouseEnter:$,__preventFocus:A,__stopPropagation:ne,static:oe,withCellSpacing:z,highlightToday:H,withWeekNumbers:ae,...J}),Oe==="year"&&s.jsx(Ho,{year:Le,numberOfColumns:m,minDate:W,maxDate:me,monthsListFormat:ie,getMonthControlProps:Q,locale:le,onNext:at,onPrevious:kn,hasNextLevel:a!=="month"&&a!=="year",onLevelClick:()=>Xe("decade"),levelControlAriaLabel:p==null?void 0:p.yearLevelControl,nextLabel:(p==null?void 0:p.nextYear)??f,nextIcon:D,previousLabel:(p==null?void 0:p.previousYear)??v,previousIcon:O,yearLabelFormat:se,__onControlMouseEnter:C,__onControlClick:(tt,xe)=>{M&&et(xe),Xe(ms("month",r,a)),b==null||b(xe)},__preventFocus:A,__stopPropagation:ne,withCellSpacing:z,...J}),Oe==="decade"&&s.jsx(Uo,{decade:Le,minDate:W,maxDate:me,yearsListFormat:te,getYearControlProps:Z,locale:le,onNext:it,onPrevious:us,numberOfColumns:m,nextLabel:(p==null?void 0:p.nextDecade)??f,nextIcon:D,previousLabel:(p==null?void 0:p.previousDecade)??v,previousIcon:O,decadeLabelFormat:I,__onControlMouseEnter:w,__onControlClick:(tt,xe)=>{j&&et(xe),Xe(ms("year",r,a)),x==null||x(xe)},__preventFocus:A,__stopPropagation:ne,withCellSpacing:z,...J})]})});qo.classes={...Uo.classes,...Ho.classes,...Go.classes};qo.displayName="@mantine/dates/Calendar";function eb(e){const{maxLevel:n,minLevel:t,defaultLevel:o,level:a,onLevelChange:r,nextIcon:i,previousIcon:l,date:d,defaultDate:c,onDateChange:u,numberOfColumns:g,columnsToScroll:m,ariaLabels:h,nextLabel:p,previousLabel:f,onYearSelect:v,onMonthSelect:x,onYearMouseEnter:b,onMonthMouseEnter:w,onNextMonth:C,onPreviousMonth:j,onNextYear:M,onPreviousYear:k,onNextDecade:S,onPreviousDecade:T,withCellSpacing:N,highlightToday:F,__updateDateOnYearSelect:E,__updateDateOnMonthSelect:V,withWeekNumbers:L,firstDayOfWeek:B,weekdayFormat:_,weekendDays:D,getDayProps:O,excludeDate:P,renderDay:$,hideOutsideDates:z,hideWeekdays:H,getDayAriaLabel:ae,monthLabelFormat:ie,monthsListFormat:Q,getMonthControlProps:se,yearLabelFormat:te,yearsListFormat:Z,getYearControlProps:I,decadeLabelFormat:Y,allowSingleDateInRange:ce,allowDeselect:ee,minDate:W,maxDate:me,locale:le,...de}=e;return{calendarProps:{maxLevel:n,minLevel:t,defaultLevel:o,level:a,onLevelChange:r,nextIcon:i,previousIcon:l,date:d,defaultDate:c,onDateChange:u,numberOfColumns:g,columnsToScroll:m,ariaLabels:h,nextLabel:p,previousLabel:f,onYearSelect:v,onMonthSelect:x,onYearMouseEnter:b,onMonthMouseEnter:w,onNextMonth:C,onPreviousMonth:j,onNextYear:M,onPreviousYear:k,onNextDecade:S,onPreviousDecade:T,withCellSpacing:N,highlightToday:F,__updateDateOnYearSelect:E,__updateDateOnMonthSelect:V,withWeekNumbers:L,firstDayOfWeek:B,weekdayFormat:_,weekendDays:D,getDayProps:O,excludeDate:P,renderDay:$,hideOutsideDates:z,hideWeekdays:H,getDayAriaLabel:ae,monthLabelFormat:ie,monthsListFormat:Q,getMonthControlProps:se,yearLabelFormat:te,yearsListFormat:Z,getYearControlProps:I,decadeLabelFormat:Y,allowSingleDateInRange:ce,allowDeselect:ee,minDate:W,maxDate:me,locale:le},others:de}}function tb(e,n){if(e===null)return null;const t=On("add",new Date(e),n);return Number.isNaN(t.getTime())||!e?null:t}function nb({date:e,maxDate:n,minDate:t}){return!(e==null||Number.isNaN(e.getTime())||n&&Ce(e).isAfter(n,"date")||t&&Ce(e).isBefore(t,"date"))}const sb={valueFormat:"MMMM D, YYYY",fixOnBlur:!0,preserveTime:!0},Zr=ye((e,n)=>{const t=vu("DateInput",sb,e),{inputProps:o,wrapperProps:a,value:r,defaultValue:i,onChange:l,clearable:d,clearButtonProps:c,popoverProps:u,getDayProps:g,locale:m,valueFormat:h,dateParser:p,minDate:f,maxDate:v,fixOnBlur:x,onFocus:b,onBlur:w,onClick:C,onKeyDown:j,readOnly:M,name:k,form:S,rightSection:T,unstyled:N,classNames:F,styles:E,allowDeselect:V,preserveTime:L,date:B,defaultDate:_,onDateChange:D,...O}=t,P=y.useRef(null),$=y.useRef(null),[z,H]=y.useState(!1),{calendarProps:ae,others:ie}=eb(O),Q=qt(),te=p||(U=>{const q=Ce(U,h,Q.getLocale(m)).toDate();return Number.isNaN(q.getTime())?tb(U,Q.getTimezone()):q}),Z=V!==void 0?V:d,I=U=>U?Ce(U).locale(Q.getLocale(m)).format(h):"",[Y,ce,ee]=Va({type:"default",value:r,defaultValue:i,onChange:l}),[W,me]=Va({type:"default",value:B,defaultValue:i||_,onChange:D});y.useEffect(()=>{ee&&r!==null&&me(r)},[ee,r]);const[le,de]=y.useState(I(Y));y.useEffect(()=>{de(I(Y))},[Q.getLocale(m)]);const K=U=>{const q=U.currentTarget.value;if(de(q),H(!0),q.trim()===""&&d)ce(null);else{const oe=te(q);nb({date:oe,minDate:f,maxDate:v})&&(ce(oe),me(oe))}},A=U=>{w==null||w(U),H(!1),x&&de(I(Y))},ne=U=>{b==null||b(U),H(!0)},be=U=>{C==null||C(U),H(!0)},ve=U=>{U.key==="Escape"&&H(!1),j==null||j(U)},Se=U=>({...g==null?void 0:g(U),selected:Ce(Y).isSame(U,"day"),onClick:q=>{var he,X;(X=g==null?void 0:(he=g(U)).onClick)==null||X.call(he,q);const oe=L?rx(Y,U):U,Ie=d&&Z&&Ce(Y).isSame(U,"day")?null:oe;ce(Ie),!ee&&de(I(Ie)),H(!1)}}),we=T||(d&&Y&&!M?s.jsx(Ka,{variant:"transparent",onMouseDown:U=>U.preventDefault(),tabIndex:-1,onClick:()=>{ce(null),!ee&&de(""),H(!1)},unstyled:N,size:o.size||"sm",...c}):null);return Ga(()=>{Y!==void 0&&!z&&de(I(Y))},[Y]),Gu(()=>H(!1),void 0,[P.current,$.current]),s.jsxs(s.Fragment,{children:[s.jsx(Cs.Wrapper,{...a,__staticSelector:"DateInput",ref:P,children:s.jsxs(Nt,{opened:z,trapFocus:!1,position:"bottom-start",disabled:M,withRoles:!1,unstyled:N,...u,children:[s.jsx(Nt.Target,{children:s.jsx(Cs,{"data-dates-input":!0,"data-read-only":M||void 0,autoComplete:"off",ref:n,value:le,onChange:K,onBlur:A,onFocus:ne,onClick:be,onKeyDown:ve,readOnly:M,rightSection:we,...o,...ie,__staticSelector:"DateInput"})}),s.jsx(Nt.Dropdown,{onMouseDown:U=>U.preventDefault(),"data-dates-dropdown":!0,ref:$,children:s.jsx(qo,{__staticSelector:"DateInput",__timezoneApplied:!0,...ae,classNames:F,styles:E,unstyled:N,__preventFocus:!0,minDate:f,maxDate:v,locale:m,getDayProps:Se,size:o.size,date:W,onDateChange:me})})]})}),s.jsx($c,{name:k,form:S,value:Y,type:"default"})]})});Zr.classes={...Cs.classes,...qo.classes};Zr.displayName="@mantine/dates/DateInput";function Te(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(e);a<o.length;a++)n.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t}var Pt={root:"MRT_TableBody-module_root__kGhRy","root-grid":"MRT_TableBody-module_root-grid__WdOGg","root-no-rows":"MRT_TableBody-module_root-no-rows__iyi9K","root-virtualized":"MRT_TableBody-module_root-virtualized__TxPAi","empty-row-tr-grid":"MRT_TableBody-module_empty-row-tr-grid__LTgxw","empty-row-td-grid":"MRT_TableBody-module_empty-row-td-grid__pzlgG","empty-row-td-content":"MRT_TableBody-module_empty-row-td-content__Cc2XW",pinned:"MRT_TableBody-module_pinned__XHpcs"},ga={root:"MRT_TableBodyRow-module_root__2c3D4","root-grid":"MRT_TableBodyRow-module_root-grid__AwXTe","root-virtualized":"MRT_TableBodyRow-module_root-virtualized__zYgxq"},nn={root:"MRT_TableBodyCell-module_root__Wf-zi","root-grid":"MRT_TableBodyCell-module_root-grid__zIuC-","root-virtualized":"MRT_TableBodyCell-module_root-virtualized__jLl8R","root-data-col":"MRT_TableBodyCell-module_root-data-col__HHcxc","root-nowrap":"MRT_TableBodyCell-module_root-nowrap__-k1Jo","root-cursor-pointer":"MRT_TableBodyCell-module_root-cursor-pointer__4kw7J","root-editable-hover":"MRT_TableBodyCell-module_root-editable-hover__2DKSa","root-cell-hover-reveal":"MRT_TableBodyCell-module_root-cell-hover-reveal__T1fAH","cell-hover-reveal":"MRT_TableBodyCell-module_cell-hover-reveal__Q-1Xj",overflowing:"MRT_TableBodyCell-module_overflowing__QcXP4"};const pe=(e,n)=>e instanceof Function?e(n):e,ma=["string","number"],ob=["text","autocomplete"],Xi=({cell:e,renderedColumnIndex:n=0,renderedRowIndex:t=0,table:o})=>{var a,r;const{getState:i,options:{enableFilterMatchHighlighting:l,mantineHighlightProps:d}}=o,{column:c,row:u}=e,{columnDef:g}=c,{globalFilter:m,globalFilterFn:h}=i(),p=c.getFilterValue(),f=pe(d,{cell:e,column:c,row:u,table:o});let v=e.getIsAggregated()&&g.AggregatedCell?g.AggregatedCell({cell:e,column:c,row:u,table:o}):u.getIsGrouped()&&!e.getIsGrouped()?null:e.getIsGrouped()&&g.GroupedCell?g.GroupedCell({cell:e,column:c,row:u,table:o}):void 0;const x=v!==void 0;if(x||(v=e.renderValue()),l&&g.enableFilterMatchHighlighting!==!1&&v&&ma.includes(typeof v)&&(p&&ma.includes(typeof p)&&ob.includes(g.filterVariant)||m&&ma.includes(typeof m)&&c.getCanGlobalFilter())){let b=((r=(a=c.getFilterValue())!==null&&a!==void 0?a:m)!==null&&r!==void 0?r:"").toString();(p?g._filterFn:h)==="fuzzy"&&(b=b.split(" ")),v=s.jsx(jr,Object.assign({color:"yellow.3",highlight:b},f,{children:v==null?void 0:v.toString()}))}return g.Cell&&!x&&(v=g.Cell({cell:e,column:c,renderedCellValue:v,renderedColumnIndex:n,renderedRowIndex:t,row:u,table:o})),v},Xt=e=>e.replace(/[^a-zA-Z0-9]/g,"_"),ab=e=>{var n,t;return typeof e.primaryShade=="number"?e.primaryShade:(t=(n=e.primaryShade)===null||n===void 0?void 0:n.dark)!==null&&t!==void 0?t:7},rb=(e,n)=>e.colors[e.primaryColor][ab(e)];function no(e,n){const t=`data-${e}`;switch(typeof n){case"boolean":return n?{[t]:""}:null;case"number":return{[t]:`${n}`};case"string":return{[t]:n};default:return null}}var ib={root:"MRT_CopyButton-module_root__mkXy4"};const lb=e=>{var{cell:n,children:t,table:o}=e,a=Te(e,["cell","children","table"]);const{options:{localization:{clickToCopy:r,copiedToClipboard:i},mantineCopyButtonProps:l}}=o,{column:d,row:c}=n,{columnDef:u}=d,g={cell:n,column:d,row:c,table:o},m=Object.assign(Object.assign(Object.assign({},pe(l,g)),pe(u.mantineCopyButtonProps,g)),a);return s.jsx(Bl,{value:n.getValue(),children:({copied:h,copy:p})=>{var f;return s.jsx(We,{color:h?"green":void 0,label:(f=m==null?void 0:m.title)!==null&&f!==void 0?f:h?i:r,openDelay:1e3,withinPortal:!0,children:s.jsx(Et,Object.assign({},m,{className:je("mrt-copy-button",ib.root,m==null?void 0:m.className),onClick:v=>{v.stopPropagation(),p()},role:"presentation",title:void 0,children:t}))})}})},Wo=e=>{var n,{cell:t,table:o}=e,a=Te(e,["cell","table"]);const{getState:r,options:{createDisplayMode:i,editDisplayMode:l,mantineEditSelectProps:d,mantineEditTextInputProps:c},refs:{editInputRefs:u},setCreatingRow:g,setEditingCell:m,setEditingRow:h}=o,{column:p,row:f}=t,{columnDef:v}=p,{creatingRow:x,editingRow:b}=r(),w=(x==null?void 0:x.id)===f.id,C=(b==null?void 0:b.id)===f.id,j=v.editVariant==="select",M=v.editVariant==="multi-select",[k,S]=y.useState(()=>t.getValue()),T={cell:t,column:p,row:f,table:o},N=Object.assign(Object.assign(Object.assign({},pe(c,T)),pe(v.mantineEditTextInputProps,T)),a),F=Object.assign(Object.assign(Object.assign({},pe(d,T)),pe(v.mantineEditSelectProps,T)),a),E=_=>{f._valuesCache[p.id]=_,w?g(f):C&&h(f)},V=_=>{var D;(D=N.onBlur)===null||D===void 0||D.call(N,_),E(k),m(null)},L=_=>{var D,O;(D=N.onKeyDown)===null||D===void 0||D.call(N,_),_.key==="Enter"&&((O=u.current[t.id])===null||O===void 0||O.blur())};if(v.Edit)return(n=v.Edit)===null||n===void 0?void 0:n.call(v,{cell:t,column:p,row:f,table:o});const B={disabled:pe(v.enableEditing,f)===!1,label:["custom","modal"].includes(w?i:l)?p.columnDef.header:void 0,name:t.id,onClick:_=>{var D;_.stopPropagation(),(D=N==null?void 0:N.onClick)===null||D===void 0||D.call(N,_)},placeholder:["custom","modal"].includes(w?i:l)?void 0:v.header,value:k,variant:l==="table"?"unstyled":"default"};return j?s.jsx(tn,Object.assign({},B,{searchable:!0,value:k},F,{onBlur:V,onChange:(_,D)=>{var O,P;(P=(O=F).onChange)===null||P===void 0||P.call(O,_,D),S(_)},onClick:_=>{var D;_.stopPropagation(),(D=F==null?void 0:F.onClick)===null||D===void 0||D.call(F,_)},ref:_=>{_&&(u.current[t.id]=_,F.ref&&(F.ref.current=_))}})):M?s.jsx(_o,Object.assign({},B,{searchable:!0,value:k},F,{onBlur:V,onChange:_=>{var D,O;(O=(D=F).onChange)===null||O===void 0||O.call(D,k),S(_),document.activeElement!==u.current[t.id]&&E(_)},onClick:_=>{var D;_.stopPropagation(),(D=F==null?void 0:F.onClick)===null||D===void 0||D.call(F,_)},ref:_=>{_&&(u.current[t.id]=_,F.ref&&(F.ref.current=_))}})):s.jsx(qe,Object.assign({},B,{onKeyDown:L,value:k??""},N,{onBlur:V,onChange:_=>{var D;(D=N.onChange)===null||D===void 0||D.call(N,_),S(_.target.value)},onClick:_=>{var D;_.stopPropagation(),(D=N==null?void 0:N.onClick)===null||D===void 0||D.call(N,_)},ref:_=>{_&&(u.current[t.id]=_,N.ref&&(N.ref.current=_))}}))},ed=e=>{var n,t,o,a,r,{cell:i,numRows:l=1,renderedColumnIndex:d=0,renderedRowIndex:c=0,rowRef:u,table:g,virtualCell:m}=e,h=Te(e,["cell","numRows","renderedColumnIndex","renderedRowIndex","rowRef","table","virtualCell"]);const p=$n(),{getState:f,options:{columnResizeDirection:v,columnResizeMode:x,createDisplayMode:b,editDisplayMode:w,enableClickToCopy:C,enableColumnOrdering:j,enableColumnPinning:M,enableEditing:k,enableGrouping:S,layoutMode:T,mantineSkeletonProps:N,mantineTableBodyCellProps:F},refs:{editInputRefs:E},setEditingCell:V,setHoveredColumn:L}=g,{columnSizingInfo:B,creatingRow:_,density:D,draggingColumn:O,editingCell:P,editingRow:$,hoveredColumn:z,isLoading:H,showSkeletons:ae}=f(),{column:ie,row:Q}=i,{columnDef:se}=ie,{columnDefType:te}=se,Z={cell:i,column:ie,renderedColumnIndex:d,renderedRowIndex:c,row:Q,table:g},I=Object.assign(Object.assign(Object.assign({},pe(F,Z)),pe(se.mantineTableBodyCellProps,Z)),h),Y=pe(N,Z),[ce,ee]=y.useState(100);y.useEffect(()=>{if(!H&&!ae||ce!==100)return;const _e=ie.getSize();ee(te==="display"?_e/2:Math.round(Math.random()*(_e-_e/3)+_e/3))},[H,ae]);const W={minWidth:`max(calc(var(--col-${Xt(ie==null?void 0:ie.id)}-size) * 1px), ${(n=se.minSize)!==null&&n!==void 0?n:30}px)`,width:`calc(var(--col-${Xt(ie.id)}-size) * 1px)`};T==="grid"?W.flex=`${[0,!1].includes(se.grow)?0:`var(--col-${Xt(ie.id)}-size)`} 0 auto`:T==="grid-no-grow"&&(W.flex=`${+(se.grow||0)} 0 auto`);const me=(O==null?void 0:O.id)===ie.id,le=(z==null?void 0:z.id)===ie.id,de=M&&se.columnDefType!=="group"&&ie.getIsPinned(),K=!i.getIsPlaceholder()&&pe(k,Q)&&pe(se.enableEditing,Q)!==!1,A=K&&!["custom","modal"].includes(w)&&(w==="table"||($==null?void 0:$.id)===Q.id||(P==null?void 0:P.id)===i.id)&&!Q.getIsGrouped(),ne=K&&b==="row"&&(_==null?void 0:_.id)===Q.id,be=pe(C,i)||pe(se.enableClickToCopy,i)&&pe(se.enableClickToCopy,i)!==!1,ve=_e=>{var Oe;(Oe=I==null?void 0:I.onDoubleClick)===null||Oe===void 0||Oe.call(I,_e),K&&w==="cell"&&(V(i),setTimeout(()=>{var Xe;const ot=E.current[i.id];ot&&(ot.focus(),(Xe=ot.select)===null||Xe===void 0||Xe.call(ot))},100))},Se=_e=>{var Oe;(Oe=I==null?void 0:I.onDragEnter)===null||Oe===void 0||Oe.call(I,_e),S&&(z==null?void 0:z.id)==="drop-zone"&&L(null),j&&O&&L(se.enableColumnOrdering!==!1?ie:null)},we={cell:i,renderedColumnIndex:d,renderedRowIndex:c,table:g},U=y.useRef(null),[q,oe]=y.useState(!1),Ie=()=>{if(!se.enableCellHoverReveal)return;const _e=U.current;if(_e){const Oe=_e.scrollWidth>_e.clientWidth;oe(Oe)}},he=()=>{se.enableCellHoverReveal&&oe(!1)},X=()=>{var _e,Oe,Xe;return i.getIsPlaceholder()?(Oe=(_e=se.PlaceholderCell)===null||_e===void 0?void 0:_e.call(se,{cell:i,column:ie,row:Q,table:g}))!==null&&Oe!==void 0?Oe:null:ae!==!1&&(H||ae)?s.jsx(qu,Object.assign({height:20,width:ce},Y)):te==="display"&&(["mrt-row-expand","mrt-row-numbers","mrt-row-select"].includes(ie.id)||!Q.getIsGrouped())?(Xe=se.Cell)===null||Xe===void 0?void 0:Xe.call(se,Object.assign({column:ie,renderedCellValue:i.renderValue(),row:Q,rowRef:u},we)):ne||A?s.jsx(Wo,{cell:i,table:g}):be&&se.enableClickToCopy!==!1?s.jsx(lb,{cell:i,table:g,children:s.jsx(Xi,Object.assign({},we))}):s.jsx(Xi,Object.assign({},we))};return s.jsx(Os,Object.assign({"data-column-pinned":de||void 0,"data-dragging-column":me||void 0,"data-first-right-pinned":de==="right"&&ie.getIsFirstColumn(de)||void 0,"data-hovered-column-target":le||void 0,"data-index":d,"data-last-left-pinned":de==="left"&&ie.getIsLastColumn(de)||void 0,"data-last-row":c===l-1||void 0,"data-resizing":x==="onChange"&&(B==null?void 0:B.isResizingColumn)===ie.id&&v||void 0},I,{__vars:Object.assign({"--mrt-cell-align":(t=I.align)!==null&&t!==void 0?t:p.dir==="rtl"?"right":"left","--mrt-table-cell-left":de==="left"?`${ie.getStart(de)}`:void 0,"--mrt-table-cell-right":de==="right"?`${ie.getAfter(de)}`:void 0},I.__vars),className:je(nn.root,(T==null?void 0:T.startsWith("grid"))&&nn["root-grid"],m&&nn["root-virtualized"],K&&w==="cell"&&nn["root-cursor-pointer"],K&&["cell","table"].includes(w??"")&&te!=="display"&&nn["root-editable-hover"],te==="data"&&nn["root-data-col"],D==="xs"&&nn["root-nowrap"],se.enableCellHoverReveal&&nn["root-cell-hover-reveal"],I==null?void 0:I.className),onDoubleClick:ve,onDragEnter:Se,onMouseEnter:Ie,onMouseLeave:he,style:_e=>Object.assign(Object.assign({},W),pe(I.style,_e)),children:s.jsx(s.Fragment,{children:(o=I.children)!==null&&o!==void 0?o:se.enableCellHoverReveal?s.jsxs("div",{className:je(se.enableCellHoverReveal&&!(ne||A)&&nn["cell-hover-reveal"],q&&nn.overflowing),ref:U,children:[X(),i.getIsGrouped()&&!se.GroupedCell&&s.jsxs(s.Fragment,{children:[" (",(a=Q.subRows)===null||a===void 0?void 0:a.length,")"]})]}):s.jsxs(s.Fragment,{children:[X(),i.getIsGrouped()&&!se.GroupedCell&&s.jsxs(s.Fragment,{children:[" (",(r=Q.subRows)===null||r===void 0?void 0:r.length,")"]})]})})}))},cb=y.memo(ed,(e,n)=>n.cell===e.cell);var Dn={root:"MRT_TableDetailPanel-module_root__vQAlM","root-grid":"MRT_TableDetailPanel-module_root-grid__7UMC6","root-virtual-row":"MRT_TableDetailPanel-module_root-virtual-row__r-X4Z",inner:"MRT_TableDetailPanel-module_inner__o-Fk-","inner-grid":"MRT_TableDetailPanel-module_inner-grid__WLZgF","inner-expanded":"MRT_TableDetailPanel-module_inner-expanded__6tg9T","inner-virtual":"MRT_TableDetailPanel-module_inner-virtual__TItRy"};const db=e=>{var n,t,{parentRowRef:o,renderedRowIndex:a=0,row:r,rowVirtualizer:i,striped:l,table:d,virtualRow:c}=e,u=Te(e,["parentRowRef","renderedRowIndex","row","rowVirtualizer","striped","table","virtualRow"]);const{getState:g,getVisibleLeafColumns:m,options:{layoutMode:h,mantineDetailPanelProps:p,mantineTableBodyRowProps:f,renderDetailPanel:v}}=d,{isLoading:x}=g(),b=pe(f,{isDetailPanel:!0,row:r,table:d}),w=Object.assign(Object.assign({},pe(p,{row:r,table:d})),u),C=r.getAllCells().filter(M=>M.column.columnDef.columnDefType==="data")?.map(M=>s.jsx(Wo,{cell:M,table:d},M.id)),j=!x&&r.getIsExpanded()&&(v==null?void 0:v({internalEditComponents:C,row:r,table:d}));return s.jsx(an,Object.assign({"data-index":v?a*2+1:a,"data-striped":l,ref:M=>{var k;M&&((k=i==null?void 0:i.measureElement)===null||k===void 0||k.call(i,M))}},b,{__vars:Object.assign({"--mrt-parent-row-height":c?`${(t=(n=o.current)===null||n===void 0?void 0:n.getBoundingClientRect())===null||t===void 0?void 0:t.height}px`:void 0,"--mrt-virtual-row-start":c?`${c.start}px`:void 0},b==null?void 0:b.__vars),className:je("mantine-Table-tr-detail-panel",Dn.root,(h==null?void 0:h.startsWith("grid"))&&Dn["root-grid"],c&&Dn["root-virtual-row"],b==null?void 0:b.className),children:s.jsx(Os,Object.assign({colSpan:m().length,component:"td"},w,{__vars:{"--mrt-inner-width":`${d.getTotalSize()}px`},className:je("mantine-Table-td-detail-panel",Dn.inner,(h==null?void 0:h.startsWith("grid"))&&Dn["inner-grid"],r.getIsExpanded()&&Dn["inner-expanded"],c&&Dn["inner-virtual"]),p:r.getIsExpanded()&&j?"md":0,children:i?r.getIsExpanded()&&j:s.jsx(as,{in:r.getIsExpanded(),children:j})}))}))},ub=(e,n,t)=>{let o=0;return e.columnFiltersMeta[t]&&(o=Bv(e.columnFiltersMeta[t],n.columnFiltersMeta[t])),o===0?Pn.alphanumeric(e,n,t):o},gb=Object.assign(Object.assign({},Pn),{fuzzy:ub}),mb=(e,n)=>Math.max(...Object.values(n.columnFiltersMeta)?.map(t=>t.rank))-Math.max(...Object.values(e.columnFiltersMeta)?.map(t=>t.rank)),td=(e,n)=>{const{getCenterRows:t,getPrePaginationRowModel:o,getRowModel:a,getState:r,getTopRows:i,options:{createDisplayMode:l,enablePagination:d,enableRowPinning:c,manualPagination:u,positionCreatingRow:g,rowPinningDisplayMode:m}}=e,{creatingRow:h,pagination:p}=r(),f=hb(e);let v=[];if(!f)v=!c||m!=null&&m.includes("sticky")?n?o().rows:a().rows:t();else{if(v=o().rows.sort((x,b)=>mb(x,b)),d&&!u&&!n){const x=p.pageIndex*p.pageSize;v=v.slice(x,x+p.pageSize)}c&&!(m!=null&&m.includes("sticky"))&&(v=v.filter(x=>!x.getIsPinned()))}if(c&&(m!=null&&m.includes("sticky"))){const x=v.filter(b=>b.getIsPinned())?.map(b=>b.id);v=[...i().filter(b=>!x.includes(b.id)),...v]}if(g!==void 0&&h&&l==="row"){const x=isNaN(+g)?g==="top"?0:v.length:+g;v=[...v.slice(0,x),h,...v.slice(x)]}return v},nd=e=>{const{getState:n,options:{enableGlobalFilterRankedResults:t,manualExpanding:o,manualFiltering:a,manualGrouping:r,manualSorting:i}}=e,{expanded:l,globalFilterFn:d}=n();return!o&&!a&&!r&&!i&&t&&d==="fuzzy"&&l!==!0&&!Object.values(l)?.some(Boolean)},hb=e=>{const{globalFilter:n,sorting:t}=e.getState();return nd(e)&&n&&!Object.values(t)?.some(Boolean)},so=({row:e,table:n})=>{const{options:{enableRowSelection:t}}=n;return e.getIsSelected()||pe(t,e)&&e.getCanSelectSubRows()&&e.getIsAllSubRowsSelected()},pb=({renderedRowIndex:e=0,row:n,table:t})=>(o,a)=>{var r;const{getState:i,options:{enableBatchRowSelection:l,enableMultiRowSelection:d,enableRowPinning:c,manualPagination:u,rowPinningDisplayMode:g},refs:{lastSelectedRowId:m}}=t,{pagination:{pageIndex:h,pageSize:p}}=i(),f=u?0:p*h,v=so({row:n,table:t});n.toggleSelected(a??!v);const x=new Set([n.id]);if(l&&d&&o.nativeEvent.shiftKey&&m.current!==null){const b=td(t,!0),w=b.findIndex(C=>C.id===m.current);if(w!==-1){const C=so({row:b==null?void 0:b[w],table:t}),j=e+f,[M,k]=w<j?[w,j]:[j,w];if(v!==C)for(let S=M;S<=k;S++)b[S].toggleSelected(!v),x.add(b[S].id)}}m.current=n.id,n.getCanSelectSubRows()&&n.getIsAllSubRowsSelected()&&((r=n.subRows)===null||r===void 0||r.forEach(b=>b.toggleSelected(!1))),c&&(g!=null&&g.includes("select"))&&x.forEach(b=>{t.getRow(b).pin(v?!1:g!=null&&g.includes("bottom")?"bottom":"top")})},sd=({table:e})=>(n,t,o)=>{const{options:{enableRowPinning:a,rowPinningDisplayMode:r,selectAllMode:i},refs:{lastSelectedRowId:l}}=e;i==="all"||o?e.toggleAllRowsSelected(t??n.target.checked):e.toggleAllPageRowsSelected(t??n.target.checked),a&&(r!=null&&r.includes("select"))&&e.setRowPinning({bottom:[],top:[]}),l.current=null},js=e=>{var n,t,o,{children:a,columnVirtualizer:r,numRows:i,pinnedRowIds:l,renderedRowIndex:d=0,row:c,rowVirtualizer:u,table:g,tableProps:m,virtualRow:h}=e,p=Te(e,["children","columnVirtualizer","numRows","pinnedRowIds","renderedRowIndex","row","rowVirtualizer","table","tableProps","virtualRow"]);const{getState:f,options:{enableRowOrdering:v,enableRowPinning:x,enableStickyFooter:b,enableStickyHeader:w,layoutMode:C,mantineTableBodyRowProps:j,memoMode:M,renderDetailPanel:k,rowPinningDisplayMode:S},refs:{tableFooterRef:T,tableHeadRef:N},setHoveredRow:F}=g,{density:E,draggingColumn:V,draggingRow:L,editingCell:B,editingRow:_,hoveredRow:D,isFullScreen:O,rowPinning:P}=f(),$=c.getVisibleCells(),{virtualColumns:z,virtualPaddingLeft:H,virtualPaddingRight:ae}=r??{},ie=so({row:c,table:g}),Q=x&&c.getIsPinned(),se=Q&&(S==null?void 0:S.includes("sticky"))&&"sticky",te=(L==null?void 0:L.id)===c.id,Z=(D==null?void 0:D.id)===c.id,I=Object.assign(Object.assign({},pe(j,{renderedRowIndex:d,row:c,table:g})),p),[Y,ce]=y.useMemo(()=>!x||!se||!l||!c.getIsPinned()?[]:[[...l].reverse().indexOf(c.id),l.indexOf(c.id)],[l,P]),ee=(w||O)&&((n=N.current)===null||n===void 0?void 0:n.clientHeight)||0,W=b&&((t=T.current)===null||t===void 0?void 0:t.clientHeight)||0,me=parseInt((o=I==null?void 0:I.style)===null||o===void 0?void 0:o.height,10)||(E==="xs"?37:E==="md"?53:69),le=A=>{v&&L&&F(c)},de=y.useRef(null);let K=m.striped;return K&&(K===!0&&(K="odd"),K==="odd"&&d%2!==0&&(K=!1),K==="even"&&d%2===0&&(K=!1)),s.jsxs(s.Fragment,{children:[s.jsxs(an,Object.assign({"data-dragging-row":te||void 0,"data-hovered-row-target":Z||void 0,"data-index":k?d*2:d,"data-row-pinned":se||Q||void 0,"data-selected":ie||void 0,"data-striped":K,onDragEnter:le,ref:A=>{A&&(de.current=A,u==null||u.measureElement(A))}},I,{__vars:Object.assign(Object.assign({},I==null?void 0:I.__vars),{"--mrt-pinned-row-bottom":!h&&Y!==void 0&&Q?`${Y*me+(b?W-1:0)}`:void 0,"--mrt-pinned-row-top":h?void 0:ce!==void 0&&Q?`${ce*me+(w||O?ee-1:0)}`:void 0,"--mrt-virtual-row-start":h?`${h.start}`:void 0}),className:je(ga.root,(C==null?void 0:C.startsWith("grid"))&&ga["root-grid"],h&&ga["root-virtualized"],I==null?void 0:I.className),children:[H?s.jsx(G,{component:"td",display:"flex",w:H}):null,a||(z??c.getVisibleCells())?.map((A,ne)=>{let be=A;r&&(ne=A.index,be=$[ne]);const ve={cell:be,numRows:i,renderedColumnIndex:ne,renderedRowIndex:d,rowRef:de,table:g,virtualCell:r?A:void 0};return M==="cells"&&be.column.columnDef.columnDefType==="data"&&!V&&!L&&(B==null?void 0:B.id)!==be.id&&(_==null?void 0:_.id)!==c.id?s.jsx(cb,Object.assign({},ve),be.id):s.jsx(ed,Object.assign({},ve),be.id)}),ae?s.jsx(G,{component:"td",display:"flex",w:ae}):null]})),k&&!c.getIsGrouped()&&s.jsx(db,{parentRowRef:de,renderedRowIndex:d,row:c,rowVirtualizer:u,striped:K,table:g,virtualRow:h})]})},ha=y.memo(js,(e,n)=>e.row===n.row);var hs={root:"MRT_ExpandButton-module_root__IFYio","root-ltr":"MRT_ExpandButton-module_root-ltr__FHNnp",chevron:"MRT_ExpandButton-module_chevron__XzC5P",right:"MRT_ExpandButton-module_right__-pC-A",up:"MRT_ExpandButton-module_up__TZGBo","root-rtl":"MRT_ExpandButton-module_root-rtl__zoudS"};const Ba=e=>{var n,t,{row:o,table:a}=e,r=Te(e,["row","table"]);const i=$n(),{options:{icons:{IconChevronDown:l},localization:d,mantineExpandButtonProps:c,positionExpandColumn:u,renderDetailPanel:g}}=a,m=Object.assign(Object.assign({},pe(c,{row:o,table:a})),r),h=o.getAllCells().filter(w=>w.column.columnDef.columnDefType==="data")?.map(w=>s.jsx(Wo,{cell:w,table:a},w.id)),p=o.getCanExpand(),f=o.getIsExpanded(),v=!!(g!=null&&g({internalEditComponents:h,row:o,table:a})),x=w=>{var C;w.stopPropagation(),o.toggleExpanded(),(C=m==null?void 0:m.onClick)===null||C===void 0||C.call(m,w)},b=i.dir==="rtl"||u==="last";return s.jsx(We,{disabled:!p&&!v,label:(n=m==null?void 0:m.title)!==null&&n!==void 0?n:f?d.collapse:d.expand,openDelay:1e3,withinPortal:!0,children:s.jsx(Ee,Object.assign({"aria-label":d.expand,color:"gray",disabled:!p&&!v,variant:"subtle"},m,{__vars:{"--mrt-row-depth":`${o.depth}`},className:je("mrt-expand-button",hs.root,hs[`root-${b?"rtl":"ltr"}`],m==null?void 0:m.className),onClick:x,title:void 0,children:(t=m==null?void 0:m.children)!==null&&t!==void 0?t:s.jsx(l,{className:je("mrt-expand-button-chevron",hs.chevron,!p&&!g?hs.right:f?hs.up:void 0)})}))})},fb=e=>{var n,t,{table:o,tableProps:a}=e,r=Te(e,["table","tableProps"]);const{getState:i,options:{layoutMode:l,localization:d,renderDetailPanel:c,renderEmptyRowsFallback:u},refs:{tablePaperRef:g}}=o,{columnFilters:m,globalFilter:h}=i(),p=y.useMemo(()=>ds(o,"mrt-row-empty",{},0,0),[]),f=Object.assign(Object.assign({},r),{renderedRowIndex:0,row:p,virtualRow:void 0});return s.jsxs(js,Object.assign({className:je("mrt-table-body-row",(l==null?void 0:l.startsWith("grid"))&&Pt["empty-row-tr-grid"]),table:o,tableProps:a},f,{children:[c&&s.jsx(Os,{className:je("mrt-table-body-cell",(l==null?void 0:l.startsWith("grid"))&&Pt["empty-row-td-grid"]),colSpan:1,children:s.jsx(Ba,{row:p,table:o})}),s.jsx("td",{className:je("mrt-table-body-cell",(l==null?void 0:l.startsWith("grid"))&&Pt["empty-row-td-grid"]),colSpan:o.getVisibleLeafColumns().length,children:(n=u==null?void 0:u({table:o}))!==null&&n!==void 0?n:s.jsx(ue,{__vars:{"--mrt-paper-width":`${(t=g.current)===null||t===void 0?void 0:t.clientWidth}`},className:je(Pt["empty-row-td-content"]),children:h||m.length?d.noResultsFound:d.noRecordsToDisplay})})]}))},vb=e=>{const{getRowModel:n,getState:t,options:{data:o,enableGlobalFilterRankedResults:a,positionCreatingRow:r}}=e,{creatingRow:i,expanded:l,globalFilter:d,pagination:c,rowPinning:u,sorting:g}=t();return y.useMemo(()=>td(e),[i,o,a,l,n().rows,d,c.pageIndex,c.pageSize,r,u,g])},od=(e,n)=>{const t=Ec(e);return n===void 0||(n>=0&&n<Math.max(e.startIndex-e.overscan,0)&&t.unshift(n),n>=0&&n>e.endIndex+e.overscan&&t.push(n)),t},xb=(e,n)=>{var t;const{getRowModel:o,getState:a,options:{enableRowVirtualization:r,renderDetailPanel:i,rowVirtualizerInstanceRef:l,rowVirtualizerOptions:d},refs:{tableContainerRef:c}}=e,{density:u,draggingRow:g,expanded:m}=a();if(!r)return;const h=pe(d,{table:e}),p=(t=n==null?void 0:n.length)!==null&&t!==void 0?t:o().rows.length,f=u==="xs"?42.7:u==="md"?54.7:70.7,v=Ac(Object.assign({count:i?p*2:p,estimateSize:x=>i&&x%2===1?m===!0?100:0:f,getScrollElement:()=>c.current,measureElement:typeof window<"u"&&navigator.userAgent.indexOf("Firefox")===-1?x=>x==null?void 0:x.getBoundingClientRect().height:void 0,overscan:4,rangeExtractor:y.useCallback(x=>{var b;return od(x,(b=g==null?void 0:g.index)!==null&&b!==void 0?b:0)},[g])},h));return v.virtualRows=v.getVirtualItems(),l&&(l.current=v),v},ad=e=>{var n,t,o,{columnVirtualizer:a,table:r,tableProps:i}=e,l=Te(e,["columnVirtualizer","table","tableProps"]);const{getBottomRows:d,getIsSomeRowsPinned:c,getRowModel:u,getState:g,getTopRows:m,options:{enableStickyFooter:h,enableStickyHeader:p,layoutMode:f,mantineTableBodyProps:v,memoMode:x,renderDetailPanel:b,rowPinningDisplayMode:w},refs:{tableFooterRef:C,tableHeadRef:j}}=r,{isFullScreen:M,rowPinning:k}=g(),S=Object.assign(Object.assign({},pe(v,{table:r})),l),T=(p||M)&&((n=j.current)===null||n===void 0?void 0:n.clientHeight)||0,N=h&&((t=C.current)===null||t===void 0?void 0:t.clientHeight)||0,F=y.useMemo(()=>{var _,D;return!(!((_=k.bottom)===null||_===void 0)&&_.length)&&!(!((D=k.top)===null||D===void 0)&&D.length)?[]:u().rows.filter(O=>O.getIsPinned())?.map(O=>O.id)},[k,u().rows]),E=vb(r),V=xb(r,E),{virtualRows:L}=V??{},B={columnVirtualizer:a,numRows:E.length,table:r,tableProps:i};return s.jsxs(s.Fragment,{children:[!(w!=null&&w.includes("sticky"))&&c("top")&&s.jsx(bs,Object.assign({},S,{__vars:Object.assign({"--mrt-table-head-height":`${T}`},S==null?void 0:S.__vars),className:je(Pt.pinned,(f==null?void 0:f.startsWith("grid"))&&Pt["root-grid"],S==null?void 0:S.className),children:m()?.map((_,D)=>{const O=Object.assign(Object.assign({},B),{renderedRowIndex:D,row:_});return x==="rows"?s.jsx(ha,Object.assign({},O),_.id):s.jsx(js,Object.assign({},O),_.id)})})),s.jsx(bs,Object.assign({},S,{__vars:Object.assign({"--mrt-table-body-height":V?`${V.getTotalSize()}px`:void 0},S==null?void 0:S.__vars),className:je(Pt.root,(f==null?void 0:f.startsWith("grid"))&&Pt["root-grid"],!E.length&&Pt["root-no-rows"],V&&Pt["root-virtualized"],S==null?void 0:S.className),children:(o=S==null?void 0:S.children)!==null&&o!==void 0?o:E.length?s.jsx(s.Fragment,{children:(L??E)?.map((_,D)=>{if(V)if(b){if(_.index%2===1)return null;D=_.index/2}else D=_.index;const O=V?E[D]:_,P=Object.assign(Object.assign({},B),{pinnedRowIds:F,renderedRowIndex:D,row:O,rowVirtualizer:V,virtualRow:V?_:void 0}),$=`${O.id}-${O.index}`;return x==="rows"?s.jsx(ha,Object.assign({},P),$):s.jsx(js,Object.assign({},P),$)})}):s.jsx(fb,Object.assign({},B))})),!(w!=null&&w.includes("sticky"))&&c("bottom")&&s.jsx(bs,Object.assign({},S,{__vars:Object.assign({"--mrt-table-footer-height":`${N}`},S==null?void 0:S.__vars),className:je(Pt.pinned,(f==null?void 0:f.startsWith("grid"))&&Pt["root-grid"],S==null?void 0:S.className),children:d()?.map((_,D)=>{const O=Object.assign(Object.assign({},B),{renderedRowIndex:D,row:_});return x==="rows"?s.jsx(ha,Object.assign({},O),_.id):s.jsx(js,Object.assign({},O),_.id)})}))]})},bb=y.memo(ad,(e,n)=>e.table.options.data===n.table.options.data);var yb={"grab-icon":"MRT_GrabHandleButton-module_grab-icon__mQimy"};const Jr=({actionIconProps:e,onDragEnd:n,onDragStart:t,table:{options:{icons:{IconGripHorizontal:o},localization:{move:a}}}})=>{var r,i;return s.jsx(We,{label:(r=e==null?void 0:e.title)!==null&&r!==void 0?r:a,openDelay:1e3,withinPortal:!0,children:s.jsx(Ee,Object.assign({"aria-label":(i=e==null?void 0:e.title)!==null&&i!==void 0?i:a,draggable:!0},e,{className:je("mrt-grab-handle-button",yb["grab-icon"],e==null?void 0:e.className),color:"gray",onClick:l=>{var d;l.stopPropagation(),(d=e==null?void 0:e.onClick)===null||d===void 0||d.call(e,l)},onDragEnd:n,onDragStart:t,size:"sm",title:void 0,variant:"transparent",children:s.jsx(o,{size:"100%"})}))})},wb=e=>{var{row:n,rowRef:t,table:o}=e,a=Te(e,["row","rowRef","table"]);const{options:{mantineRowDragHandleProps:r}}=o,i=Object.assign(Object.assign({},pe(r,{row:n,table:o})),a),l=c=>{var u;(u=i==null?void 0:i.onDragStart)===null||u===void 0||u.call(i,c),c.dataTransfer.setDragImage(t.current,0,0),o.setDraggingRow(n)},d=c=>{var u;(u=i==null?void 0:i.onDragEnd)===null||u===void 0||u.call(i,c),o.setDraggingRow(null),o.setHoveredRow(null)};return s.jsx(Jr,{actionIconProps:i,onDragEnd:d,onDragStart:l,table:o})},pa=e=>{var{pinningPosition:n,row:t,table:o}=e,a=Te(e,["pinningPosition","row","table"]);const{options:{icons:{IconPinned:r,IconX:i},localization:l,rowPinningDisplayMode:d}}=o,c=t.getIsPinned(),[u,g]=y.useState(!1),m=h=>{g(!1),h.stopPropagation(),t.pin(c?!1:n)};return s.jsx(We,{label:c?l.unpin:l.pin,openDelay:1e3,opened:u,children:s.jsx(Ee,Object.assign({"aria-label":l.pin,color:"gray",onClick:m,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),size:"xs",style:{height:"24px",width:"24px"},variant:"subtle"},a,{children:c?s.jsx(i,{}):s.jsx(r,{fontSize:"small",style:{transform:`rotate(${d==="sticky"?135:n==="top"?180:0}deg)`}})}))})},jb=e=>{var{row:n,table:t}=e,o=Te(e,["row","table"]);const{getState:a,options:{enableRowPinning:r,rowPinningDisplayMode:i}}=t,{density:l}=a();if(!pe(r,n))return null;const c=Object.assign({row:n,table:t},o);return i==="top-and-bottom"&&!n.getIsPinned()?s.jsxs(G,{style:{display:"flex",flexDirection:l==="xs"?"row":"column"},children:[s.jsx(pa,Object.assign({pinningPosition:"top"},c)),s.jsx(pa,Object.assign({pinningPosition:"bottom"},c))]}):s.jsx(pa,Object.assign({pinningPosition:i==="bottom"?"bottom":"top"},c))};var fa={root:"MRT_ColumnPinningButtons-module_root__scTtW",left:"MRT_ColumnPinningButtons-module_left__W6Aog",right:"MRT_ColumnPinningButtons-module_right__7AJE3"};const Cb=({column:e,table:n})=>{const{options:{icons:{IconPinned:t,IconPinnedOff:o},localization:a}}=n;return s.jsx(st,{className:je("mrt-column-pinning-buttons",fa.root),children:e.getIsPinned()?s.jsx(We,{label:a.unpin,withinPortal:!0,children:s.jsx(Ee,{color:"gray",onClick:()=>e.pin(!1),size:"md",variant:"subtle",children:s.jsx(o,{})})}):s.jsxs(s.Fragment,{children:[s.jsx(We,{label:a.pinToLeft,withinPortal:!0,children:s.jsx(Ee,{color:"gray",onClick:()=>e.pin("left"),size:"md",variant:"subtle",children:s.jsx(t,{className:fa.left})})}),s.jsx(We,{label:a.pinToRight,withinPortal:!0,children:s.jsx(Ee,{color:"gray",onClick:()=>e.pin("right"),size:"md",variant:"subtle",children:s.jsx(t,{className:fa.right})})})]})})};var Sb={root:"MRT_EditActionButtons-module_root__BfxVZ"};const rd=e=>{var{row:n,table:t,variant:o="icon"}=e,a=Te(e,["row","table","variant"]);const{getState:r,options:{icons:{IconCircleX:i,IconDeviceFloppy:l},localization:d,onCreatingRowCancel:c,onCreatingRowSave:u,onEditingRowCancel:g,onEditingRowSave:m},refs:{editInputRefs:h},setCreatingRow:p,setEditingRow:f}=t,{creatingRow:v,editingRow:x,isSaving:b}=r(),w=(v==null?void 0:v.id)===n.id,C=(x==null?void 0:x.id)===n.id,j=()=>{w?(c==null||c({row:n,table:t}),p(null)):C&&(g==null||g({row:n,table:t}),f(null)),n._valuesCache={}},M=()=>{var k;(k=Object.values(h==null?void 0:h.current).filter(S=>{var T,N;return n.id===((N=(T=S==null?void 0:S.name)===null||T===void 0?void 0:T.split("_"))===null||N===void 0?void 0:N[0])}))===null||k===void 0||k.forEach(S=>{S.value!==void 0&&Object.hasOwn(n==null?void 0:n._valuesCache,S.name)&&(n._valuesCache[S.name]=S.value)}),w?u==null||u({exitCreatingMode:()=>p(null),row:n,table:t,values:n._valuesCache}):C&&(m==null||m({exitEditingMode:()=>f(null),row:n,table:t,values:n==null?void 0:n._valuesCache}))};return s.jsx(G,Object.assign({className:je("mrt-edit-action-buttons",Sb.root),onClick:k=>k.stopPropagation()},a,{children:o==="icon"?s.jsxs(s.Fragment,{children:[s.jsx(We,{label:d.cancel,withinPortal:!0,children:s.jsx(Ee,{"aria-label":d.cancel,color:"red",onClick:j,variant:"subtle",children:s.jsx(i,{})})}),s.jsx(We,{label:d.save,withinPortal:!0,children:s.jsx(Ee,{"aria-label":d.save,color:"blue",loading:b,onClick:M,variant:"subtle",children:s.jsx(l,{})})})]}):s.jsxs(s.Fragment,{children:[s.jsx(pt,{onClick:j,variant:"subtle",children:d.cancel}),s.jsx(pt,{loading:b,onClick:M,variant:"filled",children:d.save})]})}))};var Us={root:"MRT_ExpandAllButton-module_root__gkBZD",chevron:"MRT_ExpandAllButton-module_chevron__Iep0j",up:"MRT_ExpandAllButton-module_up__Xth3U",right:"MRT_ExpandAllButton-module_right__bS4L-"};const _b=e=>{var n,t,{table:o}=e,a=Te(e,["table"]);const{getCanSomeRowsExpand:r,getIsAllRowsExpanded:i,getIsSomeRowsExpanded:l,getState:d,options:{icons:{IconChevronsDown:c},localization:u,mantineExpandAllButtonProps:g,renderDetailPanel:m},toggleAllRowsExpanded:h}=o,{density:p,isLoading:f}=d(),v=Object.assign(Object.assign({},pe(g,{table:o})),a),x=i();return s.jsx(We,{label:((n=v==null?void 0:v.title)!==null&&n!==void 0?n:x)?u.collapseAll:u.expandAll,openDelay:1e3,withinPortal:!0,children:s.jsx(Ee,Object.assign({"aria-label":u.expandAll,color:"gray",variant:"subtle"},v,{className:je("mrt-expand-all-button",Us.root,v==null?void 0:v.className,p),disabled:f||!m&&!r(),onClick:()=>h(!x),title:void 0,children:(t=v==null?void 0:v.children)!==null&&t!==void 0?t:s.jsx(c,{className:je(Us.chevron,x?Us.up:l()?Us.right:void 0)})}))})};var Zi={root:"MRT_ShowHideColumnsMenu-module_root__2UWak",content:"MRT_ShowHideColumnsMenu-module_content__ehkWQ"},qn={root:"MRT_ShowHideColumnsMenuItems-module_root__wYgv-",menu:"MRT_ShowHideColumnsMenuItems-module_menu__CeATR",grab:"MRT_ShowHideColumnsMenuItems-module_grab__a-d-y",pin:"MRT_ShowHideColumnsMenuItems-module_pin__P437b",switch:"MRT_ShowHideColumnsMenuItems-module_switch__tMsdt",header:"MRT_ShowHideColumnsMenuItems-module_header__xVkKb"};const Yn=e=>{var n,t,o,a;return(a=(n=e.id)!==null&&n!==void 0?n:(o=(t=e.accessorKey)===null||t===void 0?void 0:t.toString)===null||o===void 0?void 0:o.call(t))!==null&&a!==void 0?a:e.header},oo=e=>{const n=[],t=o=>{o.forEach(a=>{a.columns?t(a.columns):n.push(a)})};return t(e),n},id=({columnDefs:e,tableOptions:n})=>{const{aggregationFns:t={},defaultDisplayColumn:o,filterFns:a={},sortingFns:r={},state:{columnFilterFns:i={}}={}}=n;return e?.map(l=>{var d,c;if(l.id||(l.id=Yn(l)),l.columnDefType||(l.columnDefType="data"),!((d=l.columns)===null||d===void 0)&&d.length)l.columnDefType="group",l.columns=id({columnDefs:l.columns,tableOptions:n});else if(l.columnDefType==="data"){if(Array.isArray(l.aggregationFn)){const u=l.aggregationFn;l.aggregationFn=(g,m,h)=>u?.map(p=>{var f;return(f=t[p])===null||f===void 0?void 0:f.call(t,g,m,h)})}Object.keys(a).includes(i[l.id])&&(l.filterFn=(c=a[i[l.id]])!==null&&c!==void 0?c:a.fuzzy,l._filterFn=i[l.id]),Object.keys(r).includes(l.sortingFn)&&(l.sortingFn=r[l.sortingFn])}else l.columnDefType==="display"&&(l=Object.assign(Object.assign({},o),l));return l})},ld=(e,n,t)=>{e.getCanPin()&&e.pin(n.getIsPinned());const o=[...t];return o.splice(o.indexOf(n.id),0,o.splice(o.indexOf(e.id),1)[0]),o},Mb=e=>{const{filterVariant:n}=e;return n==="multi-select"?"arrIncludesSome":n!=null&&n.includes("range")?"betweenInclusive":["checkbox","date","select"].includes(n||"")?"equals":"fuzzy"},cd=({allColumns:e,column:n,hoveredColumn:t,setHoveredColumn:o,table:a})=>{var r;const i=An(),{getState:l,options:{enableColumnOrdering:d,enableColumnPinning:c,enableHiding:u,localization:g},setColumnOrder:m}=a,{columnOrder:h}=l(),{columnDef:p}=n,{columnDefType:f}=p,v=f!=="group"&&n.getIsVisible()||f==="group"&&n.getLeafColumns()?.some(S=>S.getIsVisible()),x=S=>{var T,N;f==="group"?(N=(T=S==null?void 0:S.columns)===null||T===void 0?void 0:T.forEach)===null||N===void 0||N.call(T,F=>{F.toggleVisibility(!v)}):S.toggleVisibility()},b=y.useRef(null),[w,C]=y.useState(!1),j=S=>{C(!0),S.dataTransfer.setDragImage(b.current,0,0)},M=S=>{C(!1),o(null),t&&m(ld(n,t,h))},k=S=>{!w&&p.enableColumnOrdering!==!1&&o(n)};return!p.header||p.visibleInShowHideMenu===!1?null:s.jsxs(s.Fragment,{children:[s.jsx(De.Item,Object.assign({className:qn.root,component:"span",onDragEnter:k,ref:b,style:{"--_column-depth":`${(n.depth+.5)*2}rem`,"--_hover-color":rb(i)}},no("dragging",w),no("order-hovered",(t==null?void 0:t.id)===n.id),{children:s.jsxs(G,{className:qn.menu,children:[f!=="group"&&d&&!e?.some(S=>S.columnDef.columnDefType==="group")&&(p.enableColumnOrdering!==!1?s.jsx(Jr,{onDragEnd:M,onDragStart:j,table:a}):s.jsx(G,{className:qn.grab})),c&&(n.getCanPin()?s.jsx(Cb,{column:n,table:a}):s.jsx(G,{className:qn.pin})),u?s.jsx(We,{label:g.toggleVisibility,openDelay:1e3,withinPortal:!0,children:s.jsx(Sl,{checked:v,className:qn.switch,disabled:!n.getCanHide(),label:p.header,onChange:()=>x(n)})}):s.jsx(ue,{className:qn.header,children:p.header})]})})),(r=n.columns)===null||r===void 0?void 0:r?.map((S,T)=>s.jsx(cd,{allColumns:e,column:S,hoveredColumn:t,setHoveredColumn:o,table:a},`${T}-${S.id}`))]})};function Un({header:e,id:n,size:t,tableOptions:o}){const{defaultDisplayColumn:a,displayColumnDefOptions:r,localization:i}=o;return Object.assign(Object.assign(Object.assign(Object.assign({},a),{header:e?i[e]:"",size:t}),r==null?void 0:r[n]),{id:n})}const dd=e=>{const{enableRowPinning:n,rowPinningDisplayMode:t}=e;return!!(n&&!(t!=null&&t.startsWith("select")))},ud=e=>{const{enableRowDragging:n,enableRowOrdering:t}=e;return!!(n||t)},ei=e=>{const{enableExpanding:n,enableGrouping:t,renderDetailPanel:o,state:{grouping:a}}=e;return!!(n||t&&(a!=null&&a.length)||o)},ti=e=>{const{createDisplayMode:n,editDisplayMode:t,enableEditing:o,enableRowActions:a,state:{creatingRow:r}}=e;return!!(a||r&&n==="row"||o&&["modal","row"].includes(t??""))},gd=e=>!!e.enableRowSelection,md=e=>!!e.enableRowNumbers,hd=e=>e.layoutMode==="grid-no-grow",Rb=e=>[dd(e)&&"mrt-row-pin",ud(e)&&"mrt-row-drag",e.positionActionsColumn==="first"&&ti(e)&&"mrt-row-actions",e.positionExpandColumn==="first"&&ei(e)&&"mrt-row-expand",gd(e)&&"mrt-row-select",md(e)&&"mrt-row-numbers"].filter(Boolean),Nb=e=>[e.positionActionsColumn==="last"&&ti(e)&&"mrt-row-actions",e.positionExpandColumn==="last"&&ei(e)&&"mrt-row-expand",hd(e)&&"mrt-row-spacer"].filter(Boolean),ni=(e,n=!1)=>{const{state:{columnOrder:t=[]}}=e,o=Rb(e),a=Nb(e),r=oo(e.columns)?.map(l=>Yn(l));let i=n?r:Array.from(new Set([...t,...r]));return i=i.filter(l=>!o.includes(l)&&!a.includes(l)),[...o,...i,...a]},kb=({table:e})=>{const{getAllColumns:n,getAllLeafColumns:t,getCenterLeafColumns:o,getIsAllColumnsVisible:a,getIsSomeColumnsPinned:r,getIsSomeColumnsVisible:i,getLeftLeafColumns:l,getRightLeafColumns:d,getState:c,options:{enableColumnOrdering:u,enableColumnPinning:g,enableHiding:m,localization:h}}=e,{columnOrder:p,columnPinning:f}=c(),v=C=>{t().filter(j=>j.columnDef.enableHiding!==!1).forEach(j=>j.toggleVisibility(C))},x=y.useMemo(()=>{const C=n();return p.length>0&&!C?.some(j=>j.columnDef.columnDefType==="group")?[...l(),...Array.from(new Set(p))?.map(j=>o().find(M=>(M==null?void 0:M.id)===j)),...d()].filter(Boolean):C},[p,f,n(),o(),l(),d()]),[b,w]=y.useState(null);return s.jsxs(De.Dropdown,{className:je("mrt-show-hide-columns-menu",Zi.root),children:[s.jsxs(st,{className:Zi.content,children:[m&&s.jsx(pt,{disabled:!i(),onClick:()=>v(!1),variant:"subtle",children:h.hideAll}),u&&s.jsx(pt,{onClick:()=>e.setColumnOrder(ni(e.options,!0)),variant:"subtle",children:h.resetOrder}),g&&s.jsx(pt,{disabled:!r(),onClick:()=>e.resetColumnPinning(!0),variant:"subtle",children:h.unpinAll}),m&&s.jsx(pt,{disabled:a(),onClick:()=>v(!0),variant:"subtle",children:h.showAll})]}),s.jsx(De.Divider,{}),x?.map((C,j)=>s.jsx(cd,{allColumns:x,column:C,hoveredColumn:b,setHoveredColumn:w,table:e},`${j}-${C.id}`))]})},pd=e=>{var{table:n,title:t}=e,o=Te(e,["table","title"]);const{icons:{IconColumns:a},localization:{showHideColumns:r}}=n.options;return s.jsxs(De,{closeOnItemClick:!1,withinPortal:!0,children:[s.jsx(We,{label:t??r,withinPortal:!0,children:s.jsx(De.Target,{children:s.jsx(Ee,Object.assign({"aria-label":t??r,color:"gray",size:"lg",variant:"subtle"},o,{children:s.jsx(a,{})}))})}),s.jsx(kb,{table:n})]})},Db={md:"xs",xl:"md",xs:"xl"},fd=e=>{var{table:{getState:n,options:{icons:{IconBaselineDensityLarge:t,IconBaselineDensityMedium:o,IconBaselineDensitySmall:a},localization:{toggleDensity:r}},setDensity:i},title:l}=e,d=Te(e,["table","title"]);const{density:c}=n();return s.jsx(We,{label:l??r,withinPortal:!0,children:s.jsx(Ee,Object.assign({"aria-label":l??r,color:"gray",onClick:()=>i(u=>Db[u]),size:"lg",variant:"subtle"},d,{children:c==="xs"?s.jsx(a,{}):c==="md"?s.jsx(o,{}):s.jsx(t,{})}))})},vd=e=>{var{table:{getState:n,options:{icons:{IconFilter:t,IconFilterOff:o},localization:{showHideFilters:a}},setShowColumnFilters:r},title:i}=e,l=Te(e,["table","title"]);const{showColumnFilters:d}=n();return s.jsx(We,{label:i??a,withinPortal:!0,children:s.jsx(Ee,Object.assign({"aria-label":i??a,color:"gray",onClick:()=>r(c=>!c),size:"lg",variant:"subtle"},l,{children:d?s.jsx(o,{}):s.jsx(t,{})}))})},xd=e=>{var{table:{getState:n,options:{icons:{IconMaximize:t,IconMinimize:o},localization:{toggleFullScreen:a}},setIsFullScreen:r},title:i}=e,l=Te(e,["table","title"]);const{isFullScreen:d}=n(),[c,u]=y.useState(!1),g=()=>{u(!1),r(m=>!m)};return s.jsx(We,{label:i??a,opened:c,withinPortal:!0,children:s.jsx(Ee,Object.assign({"aria-label":i??a,color:"gray",onClick:g,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),size:"lg",variant:"subtle"},l,{children:d?s.jsx(o,{}):s.jsx(t,{})}))})},bd=e=>{var{table:{getState:n,options:{icons:{IconSearch:t,IconSearchOff:o},localization:{showHideSearch:a}},refs:{searchInputRef:r},setShowGlobalFilter:i},title:l}=e,d=Te(e,["table","title"]);const{globalFilter:c,showGlobalFilter:u}=n(),g=()=>{i(!u),setTimeout(()=>{var m;return(m=r.current)===null||m===void 0?void 0:m.focus()},100)};return s.jsx(We,{label:l??a,withinPortal:!0,children:s.jsx(Ee,Object.assign({"aria-label":l??a,color:"gray",disabled:!!c,onClick:g,size:"lg",variant:"subtle"},d,{children:u?s.jsx(o,{}):s.jsx(t,{})}))})},Tb=e=>{var{handleEdit:n,row:t,table:o}=e,a=Te(e,["handleEdit","row","table"]);const{options:{editDisplayMode:r,enableEditing:i,icons:{IconDots:l,IconEdit:d},localization:c,positionActionsColumn:u,renderRowActionMenuItems:g}}=o;return s.jsxs(De,{closeOnItemClick:!0,position:u==="first"?"bottom-start":u==="last"?"bottom-end":void 0,withinPortal:!0,children:[s.jsx(We,{label:c.rowActions,openDelay:1e3,withinPortal:!0,children:s.jsx(De.Target,{children:s.jsx(Ee,Object.assign({"aria-label":c.rowActions,color:"gray",onClick:m=>m.stopPropagation(),size:"sm",variant:"subtle"},a,{children:s.jsx(l,{})}))})}),s.jsxs(De.Dropdown,{onClick:m=>m.stopPropagation(),children:[i&&r!=="table"&&s.jsx(De.Item,{leftSection:s.jsx(d,{}),onClick:n,children:c.edit}),g==null?void 0:g({row:t,table:o})]})]})},Ib=({cell:e,row:n,table:t})=>{const{getState:o,options:{createDisplayMode:a,editDisplayMode:r,enableEditing:i,icons:{IconEdit:l},localization:{edit:d},renderRowActionMenuItems:c,renderRowActions:u},setEditingRow:g}=t,{creatingRow:m,editingRow:h}=o(),p=(m==null?void 0:m.id)===n.id,f=(h==null?void 0:h.id)===n.id,v=b=>{b.stopPropagation(),g(Object.assign({},n))},x=p&&a==="row"||f&&r==="row";return s.jsx(s.Fragment,{children:u&&!x?u({cell:e,row:n,table:t}):x?s.jsx(rd,{row:n,table:t}):!c&&pe(i,n)?s.jsx(We,{label:d,openDelay:1e3,position:"right",withinPortal:!0,children:s.jsx(Ee,{"aria-label":d,color:"gray",disabled:!!h&&h.id!==n.id,onClick:v,size:"md",variant:"subtle",children:s.jsx(l,{})})}):c?s.jsx(Tb,{handleEdit:v,row:n,table:t}):null})};var va={root:"MRT_TableFooter-module_root__-JXpw",grid:"MRT_TableFooter-module_grid__J3Ga-",sticky:"MRT_TableFooter-module_sticky__GcoK6"},Ji={root:"MRT_TableFooterRow-module_root__EuoPr","layout-mode-grid":"MRT_TableFooterRow-module_layout-mode-grid__dUEMF"},xa={root:"MRT_TableFooterCell-module_root__d8Scs",grid:"MRT_TableFooterCell-module_grid__H9jLk",group:"MRT_TableFooterCell-module_group__l3-p-"};const Fb=e=>{var n,t,o,a,r,{footer:i,renderedColumnIndex:l,table:d}=e,c=Te(e,["footer","renderedColumnIndex","table"]);const u=$n(),{options:{enableColumnPinning:g,layoutMode:m,mantineTableFooterCellProps:h}}=d,{column:p}=i,{columnDef:f}=p,{columnDefType:v}=f,x=g&&f.columnDefType!=="group"&&p.getIsPinned(),b={column:p,table:d},w=Object.assign(Object.assign(Object.assign({},pe(h,b)),pe(f.mantineTableFooterCellProps,b)),c),C={minWidth:`max(calc(var(--header-${Xt(i==null?void 0:i.id)}-size) * 1px), ${(n=f.minSize)!==null&&n!==void 0?n:30}px)`,width:`calc(var(--header-${Xt(i.id)}-size) * 1px)`};return m==="grid"?C.flex=`${[0,!1].includes(f.grow)?0:`var(--header-${Xt(i.id)}-size)`} 0 auto`:m==="grid-no-grow"&&(C.flex=`${+(f.grow||0)} 0 auto`),s.jsx(ts,Object.assign({colSpan:i.colSpan,"data-column-pinned":x||void 0,"data-first-right-pinned":x==="right"&&p.getIsFirstColumn(x)||void 0,"data-index":l,"data-last-left-pinned":x==="left"&&p.getIsLastColumn(x)||void 0},w,{__vars:Object.assign({"--mrt-cell-align":(t=w.align)!==null&&t!==void 0?t:v==="group"?"center":u.dir==="rtl"?"right":"left","--mrt-table-cell-left":x==="left"?`${p.getStart(x)}`:void 0,"--mrt-table-cell-right":x==="right"?`${p.getAfter(x)}`:void 0},w==null?void 0:w.__vars),className:je(xa.root,(m==null?void 0:m.startsWith("grid"))&&xa.grid,v==="group"&&xa.group,w==null?void 0:w.className),style:j=>Object.assign(Object.assign({},C),pe(w.style,j)),children:(o=w.children)!==null&&o!==void 0?o:i.isPlaceholder?null:(r=(a=pe(f.Footer,{column:p,footer:i,table:d}))!==null&&a!==void 0?a:f.footer)!==null&&r!==void 0?r:null}))},Pb=e=>{var n,{columnVirtualizer:t,footerGroup:o,table:a}=e,r=Te(e,["columnVirtualizer","footerGroup","table"]);const{options:{layoutMode:i,mantineTableFooterRowProps:l}}=a,{virtualColumns:d,virtualPaddingLeft:c,virtualPaddingRight:u}=t??{};if(!(!((n=o.headers)===null||n===void 0)&&n?.some(m=>typeof m.column.columnDef.footer=="string"&&!!m.column.columnDef.footer||m.column.columnDef.Footer)))return null;const g=Object.assign(Object.assign({},pe(l,{footerGroup:o,table:a})),r);return s.jsxs(an,Object.assign({className:je(Ji.root,(i==null?void 0:i.startsWith("grid"))&&Ji["layout-mode-grid"])},g,{children:[c?s.jsx(G,{component:"th",display:"flex",w:c}):null,(d??o.headers)?.map((m,h)=>{let p=m;return t&&(h=m.index,p=o.headers[h]),s.jsx(Fb,{footer:p,renderedColumnIndex:h,table:a},p.id)}),u?s.jsx(G,{component:"th",display:"flex",w:u}):null]}))},Eb=e=>{var{columnVirtualizer:n,table:t}=e,o=Te(e,["columnVirtualizer","table"]);const{getFooterGroups:a,getState:r,options:{enableStickyFooter:i,layoutMode:l,mantineTableFooterProps:d},refs:{tableFooterRef:c}}=t,{isFullScreen:u}=r(),g=Object.assign(Object.assign({},pe(d,{table:t})),o),m=(u||i)&&i!==!1;return s.jsx(zr,Object.assign({},g,{className:je(va.root,g==null?void 0:g.className,m&&va.sticky,(l==null?void 0:l.startsWith("grid"))&&va.grid),ref:h=>{c.current=h,g!=null&&g.ref&&(g.ref.current=h)},children:a()?.map(h=>s.jsx(Pb,{columnVirtualizer:n,footerGroup:h,table:t},h.id))}))};var fn={root:"MRT_TableHead-module_root__j9NkO","root-grid":"MRT_TableHead-module_root-grid__c3aGl","root-table-row-group":"MRT_TableHead-module_root-table-row-group__d9FO4","root-sticky":"MRT_TableHead-module_root-sticky__0kuDE","banner-tr":"MRT_TableHead-module_banner-tr__EhT-x","banner-th":"MRT_TableHead-module_banner-th__KwM5a",grid:"MRT_TableHead-module_grid__OJ-td"},ba={root:"MRT_TableHeadRow-module_root__hUKv4","layout-mode-grid":"MRT_TableHeadRow-module_layout-mode-grid__4ZGri",sticky:"MRT_TableHeadRow-module_sticky__Ej7Ax"},dt={root:"MRT_TableHeadCell-module_root__6y50a","root-grid":"MRT_TableHeadCell-module_root-grid__bAf1d","root-virtualized":"MRT_TableHeadCell-module_root-virtualized__CWLit","root-no-select":"MRT_TableHeadCell-module_root-no-select__BEOVU",content:"MRT_TableHeadCell-module_content__-pzSK","content-spaced":"MRT_TableHeadCell-module_content-spaced__S85Aa","content-center":"MRT_TableHeadCell-module_content-center__c-17L","content-right":"MRT_TableHeadCell-module_content-right__NSRZU","content-wrapper":"MRT_TableHeadCell-module_content-wrapper__py6aJ","content-wrapper-hidden-overflow":"MRT_TableHeadCell-module_content-wrapper-hidden-overflow__QY40r","content-wrapper-nowrap":"MRT_TableHeadCell-module_content-wrapper-nowrap__-4aIg",labels:"MRT_TableHeadCell-module_labels__oiMSr","labels-right":"MRT_TableHeadCell-module_labels-right__6ZJp-","labels-center":"MRT_TableHeadCell-module_labels-center__MM9q8","labels-sortable":"MRT_TableHeadCell-module_labels-sortable__tyuLr","labels-data":"MRT_TableHeadCell-module_labels-data__PvFGO","content-actions":"MRT_TableHeadCell-module_content-actions__utxbm"},Ob={"filter-mode-label":"MRT_TableHeadCellFilterContainer-module_filter-mode-label__8reK-"};const yd=(e,n,t,o)=>{const a=$v(e.getValue(n),t,{threshold:vt.MATCHES});return o(a),a.passed};yd.autoRemove=e=>!e;const wd=(e,n,t)=>{var o;return(o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim().includes(t.toString().toLowerCase().trim())};wd.autoRemove=e=>!e;const jd=(e,n,t)=>{var o;return(o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim().startsWith(t.toString().toLowerCase().trim())};jd.autoRemove=e=>!e;const Cd=(e,n,t)=>{var o;return(o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim().endsWith(t.toString().toLowerCase().trim())};Cd.autoRemove=e=>!e;const Ko=(e,n,t)=>{var o;return((o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim())===(t==null?void 0:t.toString().toLowerCase().trim())};Ko.autoRemove=e=>!e;const Sd=(e,n,t)=>{var o;return((o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim())!==t.toString().toLowerCase().trim()};Sd.autoRemove=e=>!e;const Yo=(e,n,t)=>{var o;return!isNaN(+t)&&!isNaN(+e.getValue(n))?+e.getValue(n)>+t:((o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim())>(t==null?void 0:t.toString().toLowerCase().trim())};Yo.autoRemove=e=>!e;const si=(e,n,t)=>Ko(e,n,t)||Yo(e,n,t);si.autoRemove=e=>!e;const Qo=(e,n,t)=>{var o;return!isNaN(+t)&&!isNaN(+e.getValue(n))?+e.getValue(n)<+t:((o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim())<(t==null?void 0:t.toString().toLowerCase().trim())};Qo.autoRemove=e=>!e;const oi=(e,n,t)=>Ko(e,n,t)||Qo(e,n,t);oi.autoRemove=e=>!e;const _d=(e,n,t)=>(["",void 0].includes(t[0])||Yo(e,n,t[0]))&&(!isNaN(+t[0])&&!isNaN(+t[1])&&+t[0]>+t[1]||["",void 0].includes(t[1])||Qo(e,n,t[1]));_d.autoRemove=e=>!e;const Md=(e,n,t)=>(["",void 0].includes(t[0])||si(e,n,t[0]))&&(!isNaN(+t[0])&&!isNaN(+t[1])&&+t[0]>+t[1]||["",void 0].includes(t[1])||oi(e,n,t[1]));Md.autoRemove=e=>!e;const Rd=(e,n,t)=>{var o;return!(!((o=e.getValue(n))===null||o===void 0)&&o.toString().trim())};Rd.autoRemove=e=>!e;const Nd=(e,n,t)=>{var o;return!!(!((o=e.getValue(n))===null||o===void 0)&&o.toString().trim())};Nd.autoRemove=e=>!e;const Ab=Object.assign(Object.assign({},sn),{between:_d,betweenInclusive:Md,contains:wd,empty:Rd,endsWith:Cd,equals:Ko,fuzzy:yd,greaterThan:Yo,greaterThanOrEqualTo:si,lessThan:Qo,lessThanOrEqualTo:oi,notEmpty:Nd,notEquals:Sd,startsWith:jd});function ai(e,n){var t;if(!n)return"";const o=`filter${n[0].toUpperCase()}${n.slice(1)}`;return(t=e[o])!==null&&t!==void 0?t:""}var zb={root:"MRT_FilterCheckBox-module_root__59h9r"};const $b=e=>{var n,t,o,{column:a,table:r}=e,i=Te(e,["column","table"]);const{getState:l,options:{localization:d,mantineFilterCheckboxProps:c}}=r,{density:u}=l(),{columnDef:g}=a,m={column:a,table:r},h=Object.assign(Object.assign(Object.assign({},pe(c,m)),pe(g.mantineFilterCheckboxProps,m)),i),p=(n=d.filterByColumn)===null||n===void 0?void 0:n.replace("{column}",g.header),f=a.getFilterValue();return s.jsx(We,{label:(t=h==null?void 0:h.title)!==null&&t!==void 0?t:p,openDelay:1e3,withinPortal:!0,children:s.jsx(_l,Object.assign({checked:f==="true",className:je("mrt-filter-checkbox",zb.root),indeterminate:f===void 0,label:(o=h.title)!==null&&o!==void 0?o:p,size:u==="xs"?"sm":"md"},h,{onChange:v=>{var x;a.setFilterValue(a.getFilterValue()===void 0?"true":a.getFilterValue()==="true"?"false":void 0),(x=h==null?void 0:h.onChange)===null||x===void 0||x.call(h,v)},onClick:v=>{var x;v.stopPropagation(),(x=h==null?void 0:h.onClick)===null||x===void 0||x.call(h,v)},title:void 0}))})};var Lb={root:"MRT_FilterRangeFields-module_root__KfCcg"},ps={root:"MRT_FilterTextInput-module_root__Ss8Ql","date-filter":"MRT_FilterTextInput-module_date-filter__jOBLB","range-filter":"MRT_FilterTextInput-module_range-filter__JQHAL","not-filter-chip":"MRT_FilterTextInput-module_not-filter-chip__u8b1y","filter-chip-badge":"MRT_FilterTextInput-module_filter-chip-badge__Sel2k"};const Ua=e=>{var n,t,o,a,r,i,l,d,{header:c,rangeFilterIndex:u,table:g}=e,m=Te(e,["header","rangeFilterIndex","table"]);const{options:{columnFilterDisplayMode:h,columnFilterModeOptions:p,icons:{IconX:f},localization:v,mantineFilterAutocompleteProps:x,mantineFilterDateInputProps:b,mantineFilterMultiSelectProps:w={clearable:!0},mantineFilterSelectProps:C,mantineFilterTextInputProps:j,manualFiltering:M},refs:{filterInputRefs:k},setColumnFilterFns:S}=g,{column:T}=c,{columnDef:N}=T,F={column:T,rangeFilterIndex:u,table:g},E=Object.assign(Object.assign(Object.assign({},pe(j,F)),pe(N.mantineFilterTextInputProps,F)),m),V=Object.assign(Object.assign({},pe(C,F)),pe(N.mantineFilterSelectProps,F)),L=Object.assign(Object.assign({},pe(w,F)),pe(N.mantineFilterMultiSelectProps,F)),B=Object.assign(Object.assign({},pe(b,F)),pe(N.mantineFilterDateInputProps,F)),_=Object.assign(Object.assign({},pe(x,F)),pe(N.mantineFilterAutocompleteProps,F)),D=N.filterVariant==="range"||N.filterVariant==="date-range"||u!==void 0,O=N.filterVariant==="select",P=N.filterVariant==="multi-select",$=N.filterVariant==="date"||N.filterVariant==="date-range",z=N.filterVariant==="autocomplete",H=(n=N==null?void 0:N.columnFilterModeOptions)!==null&&n!==void 0?n:p,ae=N._filterFn,ie=["empty","notEmpty"].includes(ae)?ai(v,ae):"",Q=D?u===0?v.min:u===1?v.max:"":(t=E==null?void 0:E.placeholder)!==null&&t!==void 0?t:(o=v.filterByColumn)===null||o===void 0?void 0:o.replace("{column}",String(N.header)),se=T.getFacetedUniqueValues(),te=y.useMemo(()=>{var A,ne,be;return((be=(ne=(A=_==null?void 0:_.data)!==null&&A!==void 0?A:V==null?void 0:V.data)!==null&&ne!==void 0?ne:L==null?void 0:L.data)!==null&&be!==void 0?be:(z||O||P)&&se?Array.from(se.keys()).filter(ve=>ve!==null).sort((ve,Se)=>ve.localeCompare(Se)):[]).filter(ve=>ve!=null)},[_==null?void 0:_.data,se,z,P,O,L==null?void 0:L.data,V==null?void 0:V.data]),Z=y.useRef(!1),[I,Y]=y.useState(()=>{var A,ne;return P?T.getFilterValue()||[]:D?((A=T.getFilterValue())===null||A===void 0?void 0:A[u])||"":(ne=T.getFilterValue())!==null&&ne!==void 0?ne:""}),[ce]=Rl(I,M?400:200);y.useEffect(()=>{Z.current&&(D?T.setFilterValue(A=>{const ne=Array.isArray(A)?A:["",""];return ne[u]=ce,ne}):T.setFilterValue(ce??void 0))},[ce]),y.useEffect(()=>{if(!Z.current){Z.current=!0;return}const A=T.getFilterValue();A===void 0?ee():Y(D&&u!==void 0?(A??["",""])[u]:A??"")},[T.getFilterValue()]);const ee=()=>{P?(Y([]),T.setFilterValue([])):D?(Y(""),T.setFilterValue(A=>{const ne=Array.isArray(A)?A:["",""];return ne[u]=void 0,ne})):O?(Y(null),T.setFilterValue(null)):(Y(""),T.setFilterValue(void 0))},W=()=>{P?(Y([]),T.setFilterValue([])):(Y(""),T.setFilterValue(void 0)),S(A=>{var ne;return Object.assign(Object.assign({},A),{[c.id]:(ne=H==null?void 0:H[0])!==null&&ne!==void 0?ne:"fuzzy"})})},me={"aria-label":Q,className:je("mrt-filter-text-input",ps.root,$?ps["date-filter"]:D?ps["range-filter"]:!ie&&ps["not-filter-chip"]),disabled:!!ie,onChange:Y,onClick:A=>A.stopPropagation(),placeholder:Q,style:Object.assign({},P?L==null?void 0:L.style:O?V==null?void 0:V.style:$?B==null?void 0:B.style:E==null?void 0:E.style),title:Q,value:P&&!Array.isArray(I)?[]:I,variant:"unstyled"},{className:le}=me,de=Te(me,["className"]),K=I?s.jsx(Ee,{"aria-label":v.clearFilter,color:"var(--mantine-color-gray-7)",onClick:ee,size:"sm",title:(a=v.clearFilter)!==null&&a!==void 0?a:"",variant:"transparent",children:s.jsx(f,{})}):null;return N.Filter?s.jsx(s.Fragment,{children:(r=N.Filter)===null||r===void 0?void 0:r.call(N,{column:T,header:c,rangeFilterIndex:u,table:g})}):ie?s.jsx(G,{style:de.style,children:s.jsx(nt,{className:ps["filter-chip-badge"],onClick:W,rightSection:K,size:"lg",children:ie})}):P?s.jsx(_o,Object.assign({},de,{searchable:!0},L,{className:je(le,L.className),data:te,onChange:A=>Y(A),ref:A=>{A&&(k.current[`${T.id}-${u??0}`]=A,L.ref&&(L.ref.current=A))},rightSection:!((i=I==null?void 0:I.toString())===null||i===void 0)&&i.length&&(L!=null&&L.clearable)?K:void 0,style:de.style})):O?s.jsx(tn,Object.assign({},de,{clearable:!0,searchable:!0},V,{className:je(le,V.className),clearButtonProps:{size:"md"},data:te,ref:A=>{A&&(k.current[`${T.id}-${u??0}`]=A,V.ref&&(V.ref.current=A))},style:de.style})):$?s.jsx(Zr,Object.assign({},de,{allowDeselect:!0,clearable:!0,popoverProps:{withinPortal:h!=="popover"}},B,{className:je(le,B.className),onChange:A=>de.onChange(A===null?"":A),ref:A=>{A&&(k.current[`${T.id}-${u??0}`]=A,B.ref&&(B.ref.current=A))},style:de.style})):z?s.jsx(vr,Object.assign({},de,{onChange:A=>Y(A),rightSection:!((l=I==null?void 0:I.toString())===null||l===void 0)&&l.length?K:void 0},_,{className:je(le,_.className),data:te,ref:A=>{A&&(k.current[`${T.id}-${u??0}`]=A,_.ref&&(_.ref.current=A))},style:de.style})):s.jsx(qe,Object.assign({},de,{onChange:A=>Y(A.target.value),rightSection:!((d=I==null?void 0:I.toString())===null||d===void 0)&&d.length?K:void 0},E,{className:je(le,E.className),mt:0,ref:A=>{A&&(k.current[`${T.id}-${u??0}`]=A,E.ref&&(E.ref.current=A))},style:de.style}))},Vb=e=>{var{header:n,table:t}=e,o=Te(e,["header","table"]);return s.jsxs(G,Object.assign({},o,{className:je("mrt-filter-range-fields",Lb.root,o.className),children:[s.jsx(Ua,{header:n,rangeFilterIndex:0,table:t}),s.jsx(Ua,{header:n,rangeFilterIndex:1,table:t})]}))};var Bb={root:"MRT_FilterRangeSlider-module_root__uwYEk"};const Ub=e=>{var n,{header:t,table:o}=e,a=Te(e,["header","table"]);const{options:{mantineFilterRangeSliderProps:r},refs:{filterInputRefs:i}}=o,{column:l}=t,{columnDef:d}=l,c={column:l,table:o},u=Object.assign(Object.assign(Object.assign({},pe(r,c)),pe(d.mantineFilterRangeSliderProps,c)),a);let[g,m]=u.min!==void 0&&u.max!==void 0?[u.min,u.max]:(n=l.getFacetedMinMaxValues())!==null&&n!==void 0?n:[0,1];Array.isArray(g)&&(g=g[0]),Array.isArray(m)&&(m=m[0]),g===null&&(g=0),m===null&&(m=1);const[h,p]=y.useState([g,m]),f=l.getFilterValue(),v=y.useRef(!1);return y.useEffect(()=>{v.current&&(f===void 0?p([g,m]):Array.isArray(f)&&p(f)),v.current=!0},[f,g,m]),s.jsx(Or,Object.assign({className:je("mrt-filter-range-slider",Bb.root),max:m,min:g,onChange:x=>{p(x)},onChangeEnd:x=>{Array.isArray(x)&&(x[0]<=g&&x[1]>=m?l.setFilterValue(void 0):l.setFilterValue(x))},value:h},u,{ref:x=>{x&&(i.current[`${l.id}-0`]=x,u!=null&&u.ref&&(u.ref=x))}}))};var Hb={symbol:"MRT_FilterOptionMenu-module_symbol__a1Bsy"};const Gb=e=>[{divider:!1,label:e.filterFuzzy,option:"fuzzy",symbol:"≈"},{divider:!1,label:e.filterContains,option:"contains",symbol:"*"},{divider:!1,label:e.filterStartsWith,option:"startsWith",symbol:"a"},{divider:!0,label:e.filterEndsWith,option:"endsWith",symbol:"z"},{divider:!1,label:e.filterEquals,option:"equals",symbol:"="},{divider:!0,label:e.filterNotEquals,option:"notEquals",symbol:"≠"},{divider:!1,label:e.filterBetween,option:"between",symbol:"⇿"},{divider:!0,label:e.filterBetweenInclusive,option:"betweenInclusive",symbol:"⬌"},{divider:!1,label:e.filterGreaterThan,option:"greaterThan",symbol:">"},{divider:!1,label:e.filterGreaterThanOrEqualTo,option:"greaterThanOrEqualTo",symbol:"≥"},{divider:!1,label:e.filterLessThan,option:"lessThan",symbol:"<"},{divider:!0,label:e.filterLessThanOrEqualTo,option:"lessThanOrEqualTo",symbol:"≤"},{divider:!1,label:e.filterEmpty,option:"empty",symbol:"∅"},{divider:!1,label:e.filterNotEmpty,option:"notEmpty",symbol:"!∅"}],Hs=["between","betweenInclusive","inNumberRange"],ya=["empty","notEmpty"],qb=["arrIncludesSome","arrIncludesAll","arrIncludes"],el=["range-slider","date-range","range"],kd=({header:e,onSelect:n,table:t})=>{var o,a,r,i;const{getState:l,options:{columnFilterModeOptions:d,globalFilterModeOptions:c,localization:u,renderColumnFilterModeMenuItems:g,renderGlobalFilterModeMenuItems:m},setColumnFilterFns:h,setGlobalFilterFn:p}=t,{globalFilterFn:f}=l(),{column:v}=e??{},{columnDef:x}=v??{},b=v==null?void 0:v.getFilterValue();let w=(o=x==null?void 0:x.columnFilterModeOptions)!==null&&o!==void 0?o:d;el.includes(x==null?void 0:x.filterVariant)&&(w=[...Hs,...w??[]].filter(k=>Hs.includes(k)));const C=y.useMemo(()=>Gb(u).filter(k=>x?w===void 0||(w==null?void 0:w.includes(k.option)):(!c||c.includes(k.option))&&["contains","fuzzy","startsWith"].includes(k.option)),[]),j=k=>{var S;const T=(S=x==null?void 0:x._filterFn)!==null&&S!==void 0?S:"";!e||!v?p(k):k!==T&&(h(N=>Object.assign(Object.assign({},N),{[e.id]:k})),ya.includes(k)?b!==" "&&!ya.includes(T)?v.setFilterValue(" "):b&&v.setFilterValue(b):(x==null?void 0:x.filterVariant)==="multi-select"||qb.includes(k)?b instanceof String||b!=null&&b.length?v.setFilterValue([]):b&&v.setFilterValue(b):el.includes(x==null?void 0:x.filterVariant)||Hs.includes(k)?!Array.isArray(b)||!(b!=null&&b.every(N=>N===""))&&!Hs.includes(T)?v.setFilterValue(["",""]):v.setFilterValue(b):Array.isArray(b)?v.setFilterValue(""):b===" "&&ya.includes(T)?v.setFilterValue(void 0):v.setFilterValue(b)),n==null||n()},M=e&&x?x._filterFn:f;return s.jsx(De.Dropdown,{children:(i=e&&v&&x?(r=(a=x.renderColumnFilterModeMenuItems)===null||a===void 0?void 0:a.call(x,{column:v,internalFilterOptions:C,onSelectFilterMode:j,table:t}))!==null&&r!==void 0?r:g==null?void 0:g({column:v,internalFilterOptions:C,onSelectFilterMode:j,table:t}):m==null?void 0:m({internalFilterOptions:C,onSelectFilterMode:j,table:t}))!==null&&i!==void 0?i:C?.map(({divider:k,label:S,option:T,symbol:N},F)=>s.jsxs(y.Fragment,{children:[s.jsx(De.Item,{color:T===M?"blue":void 0,leftSection:s.jsx("span",{className:Hb.symbol,children:N}),onClick:()=>j(T),value:T,children:S}),k&&s.jsx(De.Divider,{})]},F))})},Dd=e=>{var n,t,{header:o,table:a}=e,r=Te(e,["header","table"]);const{getState:i,options:{columnFilterDisplayMode:l,columnFilterModeOptions:d,enableColumnFilterModes:c,icons:{IconFilterCog:u},localization:g},refs:{filterInputRefs:m}}=a,{showColumnFilters:h}=i(),{column:p}=o,{columnDef:f}=p,v=f._filterFn,x=(n=f==null?void 0:f.columnFilterModeOptions)!==null&&n!==void 0?n:d,b=c&&f.enableColumnFilterModes!==!1&&(x===void 0||!!(x!=null&&x.length));return s.jsx(as,{in:h||l==="popover",children:s.jsxs(st,Object.assign({direction:"column"},r,{children:[s.jsxs(st,{align:"flex-end",children:[f.filterVariant==="checkbox"?s.jsx($b,{column:p,table:a}):f.filterVariant==="range-slider"?s.jsx(Ub,{header:o,table:a}):["date-range","range"].includes((t=f.filterVariant)!==null&&t!==void 0?t:"")||["between","betweenInclusive","inNumberRange"].includes(f._filterFn)?s.jsx(Vb,{header:o,table:a}):s.jsx(Ua,{header:o,table:a}),b&&s.jsxs(De,{withinPortal:l!=="popover",children:[s.jsx(We,{label:g.changeFilterMode,position:"bottom-start",withinPortal:!0,children:s.jsx(De.Target,{children:s.jsx(Ee,{"aria-label":g.changeFilterMode,color:"gray",size:"md",variant:"subtle",children:s.jsx(u,{})})})}),s.jsx(kd,{header:o,onSelect:()=>setTimeout(()=>{var w;return(w=m.current[`${p.id}-0`])===null||w===void 0?void 0:w.focus()},100),table:a})]})]}),b?s.jsx(ue,{c:"dimmed",className:Ob["filter-mode-label"],component:"label",children:g.filterMode.replace("{filterType}",ai(g,v))}):null]}))})};var Wb={root:"MRT_TableHeadCellFilterLabel-module_root__Rur2R"};const Kb=e=>{var n,t,o,{header:a,table:r}=e,i=Te(e,["header","table"]);const{options:{columnFilterDisplayMode:l,icons:{IconFilter:d},localization:c},refs:{filterInputRefs:u},setShowColumnFilters:g}=r,{column:m}=a,{columnDef:h}=m,p=m.getFilterValue(),[f,v]=y.useState(!1),x=Array.isArray(p)&&p?.some(Boolean)||!!p&&!Array.isArray(p),b=h.filterVariant==="range"||h.filterVariant==="date-range"||["between","betweenInclusive","inNumberRange"].includes(h._filterFn),w=h._filterFn,C=h.filterTooltipValueFn||(M=>M),j=l==="popover"&&!x?(n=c.filterByColumn)===null||n===void 0?void 0:n.replace("{column}",String(h.header)):c.filteringByColumn.replace("{column}",String(h.header)).replace("{filterType}",ai(c,w)).replace("{filterValue}",`"${Array.isArray(m.getFilterValue())?m.getFilterValue()?.map(M=>C(M)).join(`" ${b?c.and:c.or} "`):C(m.getFilterValue())}"`).replace('" "',"");return s.jsx(s.Fragment,{children:s.jsxs(Nt,{keepMounted:h.filterVariant==="range-slider",onChange:v,onClose:()=>v(!1),opened:f,position:"top",shadow:"xl",width:360,withinPortal:!0,children:[s.jsx(ss,{mounted:l==="popover"||!!m.getFilterValue()&&!b||b&&(!!(!((t=m.getFilterValue())===null||t===void 0)&&t[0])||!!(!((o=m.getFilterValue())===null||o===void 0)&&o[1])),transition:"scale",children:()=>s.jsx(Nt.Target,{children:s.jsx(We,{disabled:f,label:j,multiline:!0,w:j.length>40?300:void 0,withinPortal:!0,children:s.jsx(Ee,Object.assign({className:je("mrt-table-head-cell-filter-label-icon",Wb.root),size:18},no("active",x),{onClick:M=>{M.stopPropagation(),l==="popover"?v(k=>!k):g(!0),setTimeout(()=>{const k=u.current[`${m.id}-0`];k==null||k.focus(),k==null||k.select()},100)}},i,{children:s.jsx(d,{size:"100%"})}))})})}),l==="popover"&&s.jsx(Nt.Dropdown,{onClick:M=>M.stopPropagation(),onKeyDown:M=>M.key==="Enter"&&v(!1),onMouseDown:M=>M.stopPropagation(),children:s.jsx(Dd,{header:a,table:r})})]})})},Yb=e=>{var{column:n,table:t,tableHeadCellRef:o}=e,a=Te(e,["column","table","tableHeadCellRef"]);const{getState:r,options:{enableColumnOrdering:i,mantineColumnDragHandleProps:l},setColumnOrder:d,setDraggingColumn:c,setHoveredColumn:u}=t,{columnDef:g}=n,{columnOrder:m,draggingColumn:h,hoveredColumn:p}=r(),f={column:n,table:t},v=Object.assign(Object.assign(Object.assign({},pe(l,f)),pe(g.mantineColumnDragHandleProps,f)),a),x=w=>{var C;(C=v==null?void 0:v.onDragStart)===null||C===void 0||C.call(v,w),c(n),w.dataTransfer.setDragImage(o.current,0,0)},b=w=>{var C;(C=v==null?void 0:v.onDragEnd)===null||C===void 0||C.call(v,w),(p==null?void 0:p.id)==="drop-zone"?n.toggleGrouping():i&&p&&(p==null?void 0:p.id)!==(h==null?void 0:h.id)&&d(ld(n,p,m)),c(null),u(null)};return s.jsx(Jr,{actionIconProps:v,onDragEnd:b,onDragStart:x,table:t})};var wa={root:"MRT_TableHeadCellResizeHandle-module_root__paufe","root-ltr":"MRT_TableHeadCellResizeHandle-module_root-ltr__652AZ","root-rtl":"MRT_TableHeadCellResizeHandle-module_root-rtl__5VlSo","root-hide":"MRT_TableHeadCellResizeHandle-module_root-hide__-ILlD"};const Qb=e=>{var n,{header:t,table:o}=e,a=Te(e,["header","table"]);const{getState:r,options:{columnResizeDirection:i,columnResizeMode:l},setColumnSizingInfo:d}=o,{density:c}=r(),{column:u}=t,g=t.getResizeHandler(),m=u.getIsResizing()&&l==="onEnd"?`translateX(${(i==="rtl"?-1:1)*((n=r().columnSizingInfo.deltaOffset)!==null&&n!==void 0?n:0)}px)`:void 0;return s.jsx(G,Object.assign({onDoubleClick:()=>{d(h=>Object.assign(Object.assign({},h),{isResizingColumn:!1})),u.resetSize()},onMouseDown:g,onTouchStart:g,role:"separator"},a,{__vars:Object.assign({"--mrt-transform":m},a.__vars),className:je("mrt-table-head-cell-resize-handle",wa.root,wa[`root-${i}`],!t.subHeaders.length&&l==="onChange"&&wa["root-hide"],c,a.className)}))};var tl={"sort-icon":"MRT_TableHeadCellSortLabel-module_sort-icon__zs1xA","multi-sort-indicator":"MRT_TableHeadCellSortLabel-module_multi-sort-indicator__MGBj2"};const Xb=e=>{var{header:n,table:t}=e,o=Te(e,["header","table"]);const{getState:a,options:{icons:{IconArrowsSort:r,IconSortAscending:i,IconSortDescending:l},localization:d}}=t,c=n.column,{columnDef:u}=c,{sorting:g}=a(),m=c.getIsSorted(),h=c.getSortIndex(),p=m?m==="desc"?d.sortedByColumnDesc.replace("{column}",u.header):d.sortedByColumnAsc.replace("{column}",u.header):c.getNextSortingOrder()==="desc"?d.sortByColumnDesc.replace("{column}",u.header):d.sortByColumnAsc.replace("{column}",u.header),f=s.jsx(Ee,Object.assign({"aria-label":p},no("sorted",m),o,{className:je("mrt-table-head-sort-button",tl["sort-icon"],o.className),children:m==="desc"?s.jsx(l,{size:"100%"}):m==="asc"?s.jsx(i,{size:"100%"}):s.jsx(r,{size:"100%"})}));return s.jsx(We,{label:p,openDelay:1e3,withinPortal:!0,children:g.length<2||h===-1?f:s.jsx(Cr,{className:je("mrt-table-head-multi-sort-indicator",tl["multi-sort-indicator"]),inline:!0,label:h+1,offset:4,children:f})})};var nl={left:"MRT_ColumnActionMenu-module_left__cfNmY",right:"MRT_ColumnActionMenu-module_right__-nK56"};const Zb=e=>{var n,t,o,a,r,i,l,d,c,u,{header:g,table:m}=e,h=Te(e,["header","table"]);const{getState:p,options:{columnFilterDisplayMode:f,enableColumnFilters:v,enableColumnPinning:x,enableColumnResizing:b,enableGrouping:w,enableHiding:C,enableSorting:j,enableSortingRemoval:M,icons:{IconArrowAutofitContent:k,IconBoxMultiple:S,IconClearAll:T,IconColumns:N,IconDotsVertical:F,IconEyeOff:E,IconFilter:V,IconFilterOff:L,IconPinned:B,IconPinnedOff:_,IconSortAscending:D,IconSortDescending:O},localization:P,mantineColumnActionsButtonProps:$,renderColumnActionsMenuItems:z},refs:{filterInputRefs:H},setColumnOrder:ae,setColumnSizingInfo:ie,setShowColumnFilters:Q,toggleAllColumnsVisible:se}=m,{column:te}=g,{columnDef:Z}=te,{columnSizing:I,columnVisibility:Y}=p(),ce={column:te,table:m},ee=Object.assign(Object.assign({},pe($,ce)),pe(Z.mantineColumnActionsButtonProps,ce)),W=()=>{te.clearSorting()},me=()=>{te.toggleSorting(!1)},le=()=>{te.toggleSorting(!0)},de=()=>{ie(U=>Object.assign(Object.assign({},U),{isResizingColumn:!1})),te.resetSize()},K=()=>{te.toggleVisibility(!1)},A=U=>{te.pin(U)},ne=()=>{te.toggleGrouping(),ae(U=>["mrt-row-expand",...U])},be=()=>{te.setFilterValue("")},ve=()=>{Q(!0),setTimeout(()=>{var U;return(U=H.current[`${te.id}-0`])===null||U===void 0?void 0:U.focus()},100)},Se=()=>{se(!0)},we=s.jsxs(s.Fragment,{children:[j&&te.getCanSort()&&s.jsxs(s.Fragment,{children:[M!==!1&&s.jsx(De.Item,{disabled:!te.getIsSorted(),leftSection:s.jsx(T,{}),onClick:W,children:P.clearSort}),s.jsx(De.Item,{disabled:te.getIsSorted()==="asc",leftSection:s.jsx(D,{}),onClick:me,children:(n=P.sortByColumnAsc)===null||n===void 0?void 0:n.replace("{column}",String(Z.header))}),s.jsx(De.Item,{disabled:te.getIsSorted()==="desc",leftSection:s.jsx(O,{}),onClick:le,children:(t=P.sortByColumnDesc)===null||t===void 0?void 0:t.replace("{column}",String(Z.header))}),(v||w||C)&&s.jsx(De.Divider,{},3)]}),v&&f!=="popover"&&te.getCanFilter()&&s.jsxs(s.Fragment,{children:[s.jsx(De.Item,{disabled:!te.getFilterValue(),leftSection:s.jsx(L,{}),onClick:be,children:P.clearFilter}),s.jsx(De.Item,{leftSection:s.jsx(V,{}),onClick:ve,children:(o=P.filterByColumn)===null||o===void 0?void 0:o.replace("{column}",String(Z.header))}),(w||C)&&s.jsx(De.Divider,{},2)]}),w&&te.getCanGroup()&&s.jsxs(s.Fragment,{children:[s.jsx(De.Item,{leftSection:s.jsx(S,{}),onClick:ne,children:(a=P[te.getIsGrouped()?"ungroupByColumn":"groupByColumn"])===null||a===void 0?void 0:a.replace("{column}",String(Z.header))}),x&&s.jsx(De.Divider,{})]}),x&&te.getCanPin()&&s.jsxs(s.Fragment,{children:[s.jsx(De.Item,{disabled:te.getIsPinned()==="left"||!te.getCanPin(),leftSection:s.jsx(B,{className:nl.left}),onClick:()=>A("left"),children:P.pinToLeft}),s.jsx(De.Item,{disabled:te.getIsPinned()==="right"||!te.getCanPin(),leftSection:s.jsx(B,{className:nl.right}),onClick:()=>A("right"),children:P.pinToRight}),s.jsx(De.Item,{disabled:!te.getIsPinned(),leftSection:s.jsx(_,{}),onClick:()=>A(!1),children:P.unpin}),C&&s.jsx(De.Divider,{})]}),b&&te.getCanResize()&&s.jsx(De.Item,{disabled:!I[te.id],leftSection:s.jsx(k,{}),onClick:de,children:P.resetColumnSize},0),C&&s.jsxs(s.Fragment,{children:[s.jsx(De.Item,{disabled:!te.getCanHide(),leftSection:s.jsx(E,{}),onClick:K,children:(r=P.hideColumn)===null||r===void 0?void 0:r.replace("{column}",String(Z.header))},0),s.jsx(De.Item,{disabled:!Object.values(Y).filter(U=>!U).length,leftSection:s.jsx(N,{}),onClick:Se,children:(i=P.showAllColumns)===null||i===void 0?void 0:i.replace("{column}",String(Z.header))},1)]})]});return s.jsxs(De,Object.assign({closeOnItemClick:!0,position:"bottom-start",withinPortal:!0},h,{children:[s.jsx(We,{label:(l=ee==null?void 0:ee.title)!==null&&l!==void 0?l:P.columnActions,openDelay:1e3,withinPortal:!0,children:s.jsx(De.Target,{children:s.jsx(Ee,Object.assign({"aria-label":P.columnActions,color:"gray",size:"sm",variant:"subtle"},ee,{children:s.jsx(F,{size:"100%"})}))})}),s.jsx(De.Dropdown,{children:(u=(c=(d=Z.renderColumnActionsMenuItems)===null||d===void 0?void 0:d.call(Z,{column:te,internalColumnMenuItems:we,table:m}))!==null&&c!==void 0?c:z==null?void 0:z({column:te,internalColumnMenuItems:we,table:m}))!==null&&u!==void 0?u:we})]}))},Jb=e=>{var n,t,o,a,r,i,{columnVirtualizer:l,header:d,renderedHeaderIndex:c=0,table:u}=e,g=Te(e,["columnVirtualizer","header","renderedHeaderIndex","table"]);const m=$n(),{getState:h,options:{columnFilterDisplayMode:p,columnResizeDirection:f,columnResizeMode:v,enableColumnActions:x,enableColumnDragging:b,enableColumnOrdering:w,enableColumnPinning:C,enableGrouping:j,enableHeaderActionsHoverReveal:M,enableMultiSort:k,layoutMode:S,mantineTableHeadCellProps:T},refs:{tableHeadCellRefs:N},setHoveredColumn:F}=u,{columnSizingInfo:E,draggingColumn:V,grouping:L,hoveredColumn:B}=h(),{column:_}=d,{columnDef:D}=_,{columnDefType:O}=D,P={column:_,table:u},$=Object.assign(Object.assign(Object.assign({},pe(T,P)),pe(D.mantineTableHeadCellProps,P)),g),z={minWidth:`max(calc(var(--header-${Xt(d==null?void 0:d.id)}-size) * 1px), ${(n=D.minSize)!==null&&n!==void 0?n:30}px)`,width:`calc(var(--header-${Xt(d.id)}-size) * 1px)`};S==="grid"?z.flex=`${[0,!1].includes(D.grow)?0:`var(--header-${Xt(d.id)}-size)`} 0 auto`:S==="grid-no-grow"&&(z.flex=`${+(D.grow||0)} 0 auto`);const H=C&&D.columnDefType!=="group"&&_.getIsPinned(),ae=(V==null?void 0:V.id)===_.id,ie=(B==null?void 0:B.id)===_.id,{hovered:Q,ref:se}=dg(),[te,Z]=y.useState(!1),I=(x||D.enableColumnActions)&&D.enableColumnActions!==!1,Y=!M||te||Q&&!u.getVisibleFlatColumns().find(le=>le.getIsResizing()),ce=b!==!1&&D.enableColumnDragging!==!1&&(b||w&&D.enableColumnOrdering!==!1||j&&D.enableGrouping!==!1&&!L.includes(_.id))&&Y,ee=y.useMemo(()=>{let le=0;return _.getCanSort()&&le++,Y&&(le+=1.75),ce&&(le+=1.25),le},[Y,ce]),W=le=>{j&&(B==null?void 0:B.id)==="drop-zone"&&F(null),w&&V&&O!=="group"&&F(D.enableColumnOrdering!==!1?_:null)},me=(D==null?void 0:D.Header)instanceof Function?(t=D==null?void 0:D.Header)===null||t===void 0?void 0:t.call(D,{column:_,header:d,table:u}):(o=D==null?void 0:D.Header)!==null&&o!==void 0?o:D.header;return s.jsxs(ts,Object.assign({colSpan:d.colSpan,"data-column-pinned":H||void 0,"data-dragging-column":ae||void 0,"data-first-right-pinned":H==="right"&&_.getIsFirstColumn(H)||void 0,"data-hovered-column-target":ie||void 0,"data-index":c,"data-last-left-pinned":H==="left"&&_.getIsLastColumn(H)||void 0,"data-resizing":v==="onChange"&&(E==null?void 0:E.isResizingColumn)===_.id&&f||void 0},$,{__vars:{"--mrt-table-cell-left":H==="left"?`${_.getStart(H)}`:void 0,"--mrt-table-cell-right":H==="right"?`${_.getAfter(H)}`:void 0},align:O==="group"?"center":m.dir==="rtl"?"right":"left",className:je(dt.root,(S==null?void 0:S.startsWith("grid"))&&dt["root-grid"],k&&_.getCanSort()&&dt["root-no-select"],l&&dt["root-virtualized"],$==null?void 0:$.className),onDragEnter:W,ref:le=>{var de;le&&(N.current[_.id]=le,se.current=le,O!=="group"&&((de=l==null?void 0:l.measureElement)===null||de===void 0||de.call(l,le)))},style:le=>Object.assign(Object.assign({},z),pe($==null?void 0:$.style,le)),children:[d.isPlaceholder?null:(a=$.children)!==null&&a!==void 0?a:s.jsxs(st,{className:je("mrt-table-head-cell-content",dt.content,(O==="group"||($==null?void 0:$.align)==="center")&&dt["content-center"],($==null?void 0:$.align)==="right"&&dt["content-right"],_.getCanResize()&&dt["content-spaced"]),children:[s.jsxs(st,{__vars:{"--mrt-table-head-cell-labels-padding-left":`${ee}`},className:je("mrt-table-head-cell-labels",dt.labels,_.getCanSort()&&O!=="group"&&dt["labels-sortable"],($==null?void 0:$.align)==="right"?dt["labels-right"]:($==null?void 0:$.align)==="center"&&dt["labels-center"],O==="data"&&dt["labels-data"]),onClick:_.getToggleSortingHandler(),children:[s.jsx(st,{className:je("mrt-table-head-cell-content-wrapper",dt["content-wrapper"],O==="data"&&dt["content-wrapper-hidden-overflow"],((i=(r=D.header)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0)<20&&dt["content-wrapper-nowrap"]),children:me}),_.getCanFilter()&&(_.getIsFiltered()||Y)&&s.jsx(Kb,{header:d,table:u}),_.getCanSort()&&(_.getIsSorted()||Y)&&s.jsx(Xb,{header:d,table:u})]}),O!=="group"&&s.jsxs(st,{className:je("mrt-table-head-cell-content-actions",dt["content-actions"]),children:[ce&&s.jsx(Yb,{column:_,table:u,tableHeadCellRef:{current:N.current[_.id]}}),I&&Y&&s.jsx(Zb,{header:d,onChange:Z,opened:te,table:u})]}),_.getCanResize()&&s.jsx(Qb,{header:d,table:u})]}),p==="subheader"&&_.getCanFilter()&&s.jsx(Dd,{header:d,table:u})]}))},ey=e=>{var{columnVirtualizer:n,headerGroup:t,table:o}=e,a=Te(e,["columnVirtualizer","headerGroup","table"]);const{getState:r,options:{enableStickyHeader:i,layoutMode:l,mantineTableHeadRowProps:d}}=o,{isFullScreen:c}=r(),{virtualColumns:u,virtualPaddingLeft:g,virtualPaddingRight:m}=n??{},h=Object.assign(Object.assign({},pe(d,{headerGroup:t,table:o})),a);return s.jsxs(an,Object.assign({},h,{className:je(ba.root,(i||c)&&ba.sticky,(l==null?void 0:l.startsWith("grid"))&&ba["layout-mode-grid"],h==null?void 0:h.className),children:[g?s.jsx(G,{component:"th",display:"flex",w:g}):null,(u??t.headers)?.map((p,f)=>{let v=p;return n&&(f=p.index,v=t.headers[f]),s.jsx(Jb,{columnVirtualizer:n,header:v,renderedHeaderIndex:f,table:o},v.id)}),m?s.jsx(G,{component:"th",display:"flex",w:m}):null]}))};var Wn={alert:"MRT_ToolbarAlertBanner-module_alert__PAhUK","alert-stacked":"MRT_ToolbarAlertBanner-module_alert-stacked__HR7Nq","alert-bottom":"MRT_ToolbarAlertBanner-module_alert-bottom__u9L-S","alert-badge":"MRT_ToolbarAlertBanner-module_alert-badge__GwDmX","toolbar-alert":"MRT_ToolbarAlertBanner-module_toolbar-alert__3sJGU","head-overlay":"MRT_ToolbarAlertBanner-module_head-overlay__Hw7jK"};const Ha=e=>{var n,{renderedRowIndex:t=0,row:o,table:a}=e,r=Te(e,["renderedRowIndex","row","table"]);const{getState:i,options:{enableMultiRowSelection:l,localization:d,mantineSelectAllCheckboxProps:c,mantineSelectCheckboxProps:u,selectAllMode:g,selectDisplayMode:m}}=a,{density:h,isLoading:p}=i(),f=!o,v=f?g==="page"?a.getIsAllPageRowsSelected():a.getIsAllRowsSelected():void 0,x=f?v:so({row:o,table:a}),b=Object.assign(Object.assign({},f?pe(c,{table:a}):pe(u,{row:o,table:a})),r),w=o?pb({renderedRowIndex:t,row:o,table:a}):void 0,C=sd({table:a}),j=Object.assign(Object.assign({"aria-label":f?d.toggleSelectAll:d.toggleSelectRow,checked:x,disabled:p||o&&!o.getCanSelect()||(o==null?void 0:o.id)==="mrt-row-create",onChange:M=>{M.stopPropagation(),f?C(M):w(M)},size:h==="xs"?"sm":"md"},b),{onClick:M=>{var k;M.stopPropagation(),(k=b==null?void 0:b.onClick)===null||k===void 0||k.call(b,M)},title:void 0});return s.jsx(We,{label:(n=b==null?void 0:b.title)!==null&&n!==void 0?n:f?d.toggleSelectAll:d.toggleSelectRow,openDelay:1e3,withinPortal:!0,children:s.jsx("span",{children:m==="switch"?s.jsx(Sl,Object.assign({},j)):m==="radio"||l===!1?s.jsx(Vu,Object.assign({},j)):s.jsx(_l,Object.assign({indeterminate:!x&&f?a.getIsSomeRowsSelected():(o==null?void 0:o.getIsSomeSelected())&&o.getCanSelectSubRows()},j))})})},ri=e=>{var n,t,o,{stackAlertBanner:a,table:r}=e,i=Te(e,["stackAlertBanner","table"]);const{getFilteredSelectedRowModel:l,getPrePaginationRowModel:d,getState:c,options:{enableRowSelection:u,enableSelectAll:g,icons:{IconX:m},localization:h,mantineToolbarAlertBannerBadgeProps:p,mantineToolbarAlertBannerProps:f,manualPagination:v,positionToolbarAlertBanner:x,renderToolbarAlertBannerContent:b,rowCount:w}}=r,{density:C,grouping:j,rowSelection:M,showAlertBanner:k}=c(),S=Object.assign(Object.assign({},pe(f,{table:r})),i),T=pe(p,{table:r}),N=w??d().flatRows.length,F=y.useMemo(()=>v?Object.values(M).filter(Boolean).length:l().rows.length,[M,N,v]),E=F?s.jsxs(st,{align:"center",gap:"sm",children:[(t=(n=h.selectedCountOfRowCountRowsSelected)===null||n===void 0?void 0:n.replace("{selectedCount}",F.toString()))===null||t===void 0?void 0:t.replace("{rowCount}",N.toString()),s.jsx(pt,{onClick:L=>sd({table:r})(L,!1,!0),size:"compact-xs",variant:"subtle",children:h.clearSelection})]}):null,V=j.length>0?s.jsxs(st,{children:[h.groupedBy," ",j?.map((L,B)=>s.jsxs(y.Fragment,{children:[B>0?h.thenBy:"",s.jsxs(nt,Object.assign({className:Wn["alert-badge"],rightSection:s.jsx(Ee,{color:"white",onClick:()=>r.getColumn(L).toggleGrouping(),size:"xs",variant:"subtle",children:s.jsx(m,{style:{transform:"scale(0.8)"}})}),variant:"filled"},T,{children:[r.getColumn(L).columnDef.header," "]}))]},`${B}-${L}`))]}):null;return s.jsx(as,{in:k||!!E||!!V,transitionDuration:a?200:0,children:s.jsx(wo,Object.assign({color:"blue",icon:!1},S,{className:je(Wn.alert,a&&!x&&Wn["alert-stacked"],!a&&x==="bottom"&&Wn["alert-bottom"],S==null?void 0:S.className),children:(o=b==null?void 0:b({groupedAlert:V,selectedAlert:E,table:r}))!==null&&o!==void 0?o:s.jsxs(st,{className:je(Wn["toolbar-alert"],x==="head-overlay"&&Wn["head-overlay"],C),children:[u&&g&&x==="head-overlay"&&s.jsx(Ha,{table:r}),s.jsxs(fe,{children:[S==null?void 0:S.children,E,V]})]})}))})},ty=e=>{var{columnVirtualizer:n,table:t}=e,o=Te(e,["columnVirtualizer","table"]);const{getHeaderGroups:a,getSelectedRowModel:r,getState:i,options:{enableStickyHeader:l,layoutMode:d,mantineTableHeadProps:c,positionToolbarAlertBanner:u},refs:{tableHeadRef:g}}=t,{isFullScreen:m,showAlertBanner:h}=i(),p=Object.assign(Object.assign({},pe(c,{table:t})),o),f=l||m;return s.jsx(Ar,Object.assign({},p,{className:je(fn.root,d!=null&&d.startsWith("grid")?fn["root-grid"]:fn["root-table-row-group"],f&&fn["root-sticky"],p==null?void 0:p.className),pos:f&&(d!=null&&d.startsWith("grid"))?"sticky":"relative",ref:v=>{g.current=v,p!=null&&p.ref&&(p.ref.current=v)},children:u==="head-overlay"&&(h||r().rows.length>0)?s.jsx(an,{className:je(fn["banner-tr"],(d==null?void 0:d.startsWith("grid"))&&fn.grid),children:s.jsx(ts,{className:je(fn["banner-th"],(d==null?void 0:d.startsWith("grid"))&&fn.grid),colSpan:t.getVisibleLeafColumns().length,children:s.jsx(ri,{table:t})})}):a()?.map(v=>s.jsx(ey,{columnVirtualizer:n,headerGroup:v,table:t},v.id))}))};var sl={root:"MRT_GlobalFilterTextInput-module_root__Xmcpv",collapse:"MRT_GlobalFilterTextInput-module_collapse__v311d"};const ja=e=>{var{table:n}=e,t=Te(e,["table"]);const{getState:o,options:{enableGlobalFilterModes:a,icons:{IconSearch:r,IconX:i},localization:l,mantineSearchTextInputProps:d,manualFiltering:c,positionGlobalFilter:u},refs:{searchInputRef:g},setGlobalFilter:m}=n,{globalFilter:h,showGlobalFilter:p}=o(),f=Object.assign(Object.assign({},pe(d,{table:n})),t),v=y.useRef(!1),[x,b]=y.useState(h??""),[w]=Rl(x,c?500:250);y.useEffect(()=>{m(w||void 0)},[w]);const C=()=>{b(""),m(void 0)};return y.useEffect(()=>{v.current&&(h===void 0?C():b(h)),v.current=!0},[h]),s.jsxs(as,{className:sl.collapse,in:p,children:[a&&s.jsxs(De,{withinPortal:!0,children:[s.jsx(De.Target,{children:s.jsx(Ee,{"aria-label":l.changeSearchMode,color:"gray",size:"sm",variant:"transparent",children:s.jsx(r,{})})}),s.jsx(kd,{onSelect:C,table:n})]}),s.jsx(qe,Object.assign({leftSection:!a&&s.jsx(r,{}),mt:0,mx:u!=="left"?"mx":void 0,onChange:j=>b(j.target.value),placeholder:l.search,rightSection:x?s.jsx(Ee,{"aria-label":l.clearSearch,color:"gray",disabled:!(x!=null&&x.length),onClick:C,size:"sm",variant:"transparent",children:s.jsx(We,{label:l.clearSearch,withinPortal:!0,children:s.jsx(i,{})})}):null,value:x??"",variant:"filled"},f,{className:je("mrt-global-filter-text-input",sl.root,f==null?void 0:f.className),ref:j=>{j&&(g.current=j,f!=null&&f.ref&&(f.ref=j))}}))]})},ny=(e,n,t=-1,o=0,a,r)=>ds(e,"mrt-row-create",Object.assign({},...oo(e.options.columns)?.map(i=>({[Yn(i)]:""}))),t,o,a,r),sy=e=>Object.assign({Cell:({cell:n,row:t,table:o})=>s.jsx(Ib,{cell:n,row:t,table:o})},Un({header:"actions",id:"mrt-row-actions",size:70,tableOptions:e})),oy=e=>Object.assign({Cell:({row:n,rowRef:t,table:o})=>s.jsx(wb,{row:n,rowRef:t,table:o}),grow:!1},Un({header:"move",id:"mrt-row-drag",size:60,tableOptions:e})),ay=e=>{var n;const{defaultColumn:t,enableExpandAll:o,groupedColumnMode:a,positionExpandColumn:r,renderDetailPanel:i,state:{grouping:l}}=e,d=r==="last"?{align:"right"}:void 0;return Object.assign({Cell:({cell:c,column:u,row:g,table:m})=>{var h,p,f;const v={row:g,table:m},x=(h=g.subRows)===null||h===void 0?void 0:h.length;return e.groupedColumnMode==="remove"&&g.groupingColumnId?s.jsxs(st,{align:"center",gap:"0.25rem",children:[s.jsx(Ba,Object.assign({},v)),s.jsx(We,{label:m.getColumn(g.groupingColumnId).columnDef.header,openDelay:1e3,position:"right",children:s.jsx("span",{children:g.groupingValue})}),!!x&&s.jsxs("span",{children:["(",x,")"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,Object.assign({},v)),(f=(p=u.columnDef).GroupedCell)===null||f===void 0?void 0:f.call(p,{cell:c,column:u,row:g,table:m})]})},Header:o?({table:c})=>{var u;return s.jsxs(st,{align:"center",children:[s.jsx(_b,{table:c}),a==="remove"&&((u=l==null?void 0:l?.map(g=>c.getColumn(g).columnDef.header))===null||u===void 0?void 0:u.join(", "))]})}:void 0,mantineTableBodyCellProps:d,mantineTableHeadCellProps:d},Un({header:"expand",id:"mrt-row-expand",size:a==="remove"?(n=t==null?void 0:t.size)!==null&&n!==void 0?n:180:i?o?60:70:100,tableOptions:e}))},ry=e=>{const{localization:n,rowNumberDisplayMode:t}=e,{pagination:{pageIndex:o,pageSize:a}}=e.state;return Object.assign({Cell:({renderedRowIndex:r=0,row:i})=>{var l;return((l=t==="static"?r+a*o:i.index)!==null&&l!==void 0?l:0)+1},grow:!1,Header:()=>n.rowNumber},Un({header:"rowNumbers",id:"mrt-row-numbers",size:50,tableOptions:e}))},iy=e=>Object.assign({Cell:({row:n,table:t})=>s.jsx(jb,{row:n,table:t}),grow:!1},Un({header:"pin",id:"mrt-row-pin",size:60,tableOptions:e})),ly=e=>{const{enableMultiRowSelection:n,enableSelectAll:t}=e;return Object.assign({Cell:({renderedRowIndex:o,row:a,table:r})=>s.jsx(Ha,{renderedRowIndex:o,row:a,table:r}),grow:!1,Header:t&&n?({table:o})=>s.jsx(Ha,{table:o}):void 0},Un({header:"select",id:"mrt-row-select",size:t?60:70,tableOptions:e}))},cy=Object.assign({},Ys),dy={IconArrowAutofitContent:Hp,IconArrowsSort:Wp,IconBaselineDensityLarge:Yp,IconBaselineDensityMedium:Xp,IconBaselineDensitySmall:Jp,IconBoxMultiple:tf,IconChevronDown:uf,IconChevronLeft:pf,IconChevronLeftPipe:mf,IconChevronRight:Br,IconChevronRightPipe:vf,IconChevronsDown:yf,IconCircleX:jf,IconClearAll:Sf,IconColumns:Mf,IconDeviceFloppy:Nf,IconDots:Ur,IconDotsVertical:Df,IconEdit:on,IconEyeOff:Of,IconFilter:Bf,IconFilterCog:zf,IconFilterOff:Lf,IconGripHorizontal:qf,IconMaximize:i0,IconMinimize:c0,IconPinned:f0,IconPinnedOff:h0,IconSearch:ys,IconSearchOff:y0,IconSortAscending:_0,IconSortDescending:R0,IconX:wc},uy={actions:"Actions",and:"and",cancel:"Cancel",changeFilterMode:"Change filter mode",changeSearchMode:"Change search mode",clearFilter:"Clear filter",clearSearch:"Clear search",clearSelection:"Clear selection",clearSort:"Clear sort",clickToCopy:"Click to copy",copy:"Copy",collapse:"Collapse",collapseAll:"Collapse all",columnActions:"Column Actions",copiedToClipboard:"Copied to clipboard",dropToGroupBy:"Drop to group by {column}",edit:"Edit",expand:"Expand",expandAll:"Expand all",filterArrIncludes:"Includes",filterArrIncludesAll:"Includes all",filterArrIncludesSome:"Includes",filterBetween:"Between",filterBetweenInclusive:"Between Inclusive",filterByColumn:"Filter by {column}",filterContains:"Contains",filterEmpty:"Empty",filterEndsWith:"Ends With",filterEquals:"Equals",filterEqualsString:"Equals",filterFuzzy:"Fuzzy",filterGreaterThan:"Greater Than",filterGreaterThanOrEqualTo:"Greater Than Or Equal To",filterInNumberRange:"Between",filterIncludesString:"Contains",filterIncludesStringSensitive:"Contains",filterLessThan:"Less Than",filterLessThanOrEqualTo:"Less Than Or Equal To",filterMode:"Filter Mode: {filterType}",filterNotEmpty:"Not Empty",filterNotEquals:"Not Equals",filterStartsWith:"Starts With",filterWeakEquals:"Equals",filteringByColumn:"Filtering by {column} - {filterType} {filterValue}",goToFirstPage:"Go to first page",goToLastPage:"Go to last page",goToNextPage:"Go to next page",goToPreviousPage:"Go to previous page",grab:"Grab",groupByColumn:"Group by {column}",groupedBy:"Grouped by ",hideAll:"Hide all",hideColumn:"Hide {column} column",max:"Max",min:"Min",move:"Move",noRecordsToDisplay:"No records to display",noResultsFound:"No results found",of:"of",or:"or",pin:"Pin",pinToLeft:"Pin to left",pinToRight:"Pin to right",resetColumnSize:"Reset column size",resetOrder:"Reset order",rowActions:"Row Actions",rowNumber:"#",rowNumbers:"Row Numbers",rowsPerPage:"Rows per page",save:"Save",search:"Search",selectedCountOfRowCountRowsSelected:"{selectedCount} of {rowCount} row(s) selected",select:"Select",showAll:"Show all",showAllColumns:"Show all columns",showHideColumns:"Show/Hide columns",showHideFilters:"Show/Hide filters",showHideSearch:"Show/Hide search",sortByColumnAsc:"Sort by {column} ascending",sortByColumnDesc:"Sort by {column} descending",sortedByColumnAsc:"Sorted by {column} ascending",sortedByColumnDesc:"Sorted by {column} descending",thenBy:", then by ",toggleDensity:"Toggle density",toggleFullScreen:"Toggle full screen",toggleSelectAll:"Toggle select all",toggleSelectRow:"Toggle select row",toggleVisibility:"Toggle visibility",ungroupByColumn:"Ungroup by {column}",unpin:"Unpin",unpinAll:"Unpin all"},gy={filterVariant:"text",maxSize:1e3,minSize:40,size:180},Td={columnDefType:"display",enableClickToCopy:!1,enableColumnActions:!1,enableColumnDragging:!1,enableColumnFilter:!1,enableColumnOrdering:!1,enableEditing:!1,enableGlobalFilter:!1,enableGrouping:!1,enableHiding:!1,enableResizing:!1,enableSorting:!1},my=e=>{var n,{aggregationFns:t,autoResetExpanded:o=!1,columnFilterDisplayMode:a="subheader",columnResizeDirection:r,columnResizeMode:i="onChange",createDisplayMode:l="modal",defaultColumn:d,defaultDisplayColumn:c,editDisplayMode:u="modal",enableBatchRowSelection:g=!0,enableBottomToolbar:m=!0,enableColumnActions:h=!0,enableColumnFilters:p=!0,enableColumnOrdering:f=!1,enableColumnPinning:v=!1,enableColumnResizing:x=!1,enableColumnVirtualization:b,enableDensityToggle:w=!0,enableExpandAll:C=!0,enableExpanding:j,enableFacetedValues:M=!1,enableFilterMatchHighlighting:k=!0,enableFilters:S=!0,enableFullScreenToggle:T=!0,enableGlobalFilter:N=!0,enableGlobalFilterRankedResults:F=!0,enableGrouping:E=!1,enableHeaderActionsHoverReveal:V=!1,enableHiding:L=!0,enableMultiRowSelection:B=!0,enableMultiSort:_=!0,enablePagination:D=!0,enableRowPinning:O=!1,enableRowSelection:P=!1,enableRowVirtualization:$,enableSelectAll:z=!0,enableSorting:H=!0,enableStickyHeader:ae=!1,enableTableFooter:ie=!0,enableTableHead:Q=!0,enableToolbarInternalActions:se=!0,enableTopToolbar:te=!0,filterFns:Z,icons:I,layoutMode:Y,localization:ce,manualFiltering:ee,manualGrouping:W,manualPagination:me,manualSorting:le,paginationDisplayMode:de="default",positionActionsColumn:K="first",positionCreatingRow:A="top",positionExpandColumn:ne="first",positionGlobalFilter:be="right",positionPagination:ve="bottom",positionToolbarAlertBanner:Se="top",positionToolbarDropZone:we="top",rowNumberDisplayMode:U="static",rowPinningDisplayMode:q="sticky",selectAllMode:oe="page",sortingFns:Ie}=e,he=Te(e,["aggregationFns","autoResetExpanded","columnFilterDisplayMode","columnResizeDirection","columnResizeMode","createDisplayMode","defaultColumn","defaultDisplayColumn","editDisplayMode","enableBatchRowSelection","enableBottomToolbar","enableColumnActions","enableColumnFilters","enableColumnOrdering","enableColumnPinning","enableColumnResizing","enableColumnVirtualization","enableDensityToggle","enableExpandAll","enableExpanding","enableFacetedValues","enableFilterMatchHighlighting","enableFilters","enableFullScreenToggle","enableGlobalFilter","enableGlobalFilterRankedResults","enableGrouping","enableHeaderActionsHoverReveal","enableHiding","enableMultiRowSelection","enableMultiSort","enablePagination","enableRowPinning","enableRowSelection","enableRowVirtualization","enableSelectAll","enableSorting","enableStickyHeader","enableTableFooter","enableTableHead","enableToolbarInternalActions","enableTopToolbar","filterFns","icons","layoutMode","localization","manualFiltering","manualGrouping","manualPagination","manualSorting","paginationDisplayMode","positionActionsColumn","positionCreatingRow","positionExpandColumn","positionGlobalFilter","positionPagination","positionToolbarAlertBanner","positionToolbarDropZone","rowNumberDisplayMode","rowPinningDisplayMode","selectAllMode","sortingFns"]);const X=$n();return I=y.useMemo(()=>Object.assign(Object.assign({},dy),I),[I]),ce=y.useMemo(()=>Object.assign(Object.assign({},uy),ce),[ce]),t=y.useMemo(()=>Object.assign(Object.assign({},cy),t),[]),Z=y.useMemo(()=>Object.assign(Object.assign({},Ab),Z),[]),Ie=y.useMemo(()=>Object.assign(Object.assign({},gb),Ie),[]),d=y.useMemo(()=>Object.assign(Object.assign({},gy),d),[d]),c=y.useMemo(()=>Object.assign(Object.assign({},Td),c),[c]),[b,$]=y.useMemo(()=>[b,$],[]),r||(r=X.dir||"ltr"),Y=Y||(x?"grid-no-grow":"semantic"),Y==="semantic"&&($||b)&&(Y="grid"),$&&(ae=!0),D===!1&&me===void 0&&(me=!0),!((n=he.data)===null||n===void 0)&&n.length||(ee=!0,W=!0,me=!0,le=!0),Object.assign({aggregationFns:t,autoResetExpanded:o,columnFilterDisplayMode:a,columnResizeDirection:r,columnResizeMode:i,createDisplayMode:l,defaultColumn:d,defaultDisplayColumn:c,editDisplayMode:u,enableBatchRowSelection:g,enableBottomToolbar:m,enableColumnActions:h,enableColumnFilters:p,enableColumnOrdering:f,enableColumnPinning:v,enableColumnResizing:x,enableColumnVirtualization:b,enableDensityToggle:w,enableExpandAll:C,enableExpanding:j,enableFacetedValues:M,enableFilterMatchHighlighting:k,enableFilters:S,enableFullScreenToggle:T,enableGlobalFilter:N,enableGlobalFilterRankedResults:F,enableGrouping:E,enableHeaderActionsHoverReveal:V,enableHiding:L,enableMultiRowSelection:B,enableMultiSort:_,enablePagination:D,enableRowPinning:O,enableRowSelection:P,enableRowVirtualization:$,enableSelectAll:z,enableSorting:H,enableStickyHeader:ae,enableTableFooter:ie,enableTableHead:Q,enableToolbarInternalActions:se,enableTopToolbar:te,filterFns:Z,getCoreRowModel:Cv(),getExpandedRowModel:j||E?Sv():void 0,getFacetedMinMaxValues:M?_v():void 0,getFacetedRowModel:M?Nv():void 0,getFacetedUniqueValues:M?kv():void 0,getFilteredRowModel:p||N||S?Dv():void 0,getGroupedRowModel:E?Tv():void 0,getPaginationRowModel:D?Fv():void 0,getSortedRowModel:H?Pv():void 0,getSubRows:_e=>_e==null?void 0:_e.subRows,icons:I,layoutMode:Y,localization:ce,manualFiltering:ee,manualGrouping:W,manualPagination:me,manualSorting:le,paginationDisplayMode:de,positionActionsColumn:K,positionCreatingRow:A,positionExpandColumn:ne,positionGlobalFilter:be,positionPagination:ve,positionToolbarAlertBanner:Se,positionToolbarDropZone:we,rowNumberDisplayMode:U,rowPinningDisplayMode:q,selectAllMode:oe,sortingFns:Ie},he)},Ca={children:null,style:{minWidth:0,padding:0,width:0}},hy=e=>Object.assign(Object.assign(Object.assign(Object.assign({},Un({id:"mrt-row-spacer",size:0,tableOptions:e})),{grow:!0}),Td),{mantineTableBodyCellProps:Ca,mantineTableFooterCellProps:Ca,mantineTableHeadCellProps:Ca}),py=e=>{const{getIsSomeRowsPinned:n,getPrePaginationRowModel:t,getState:o,options:{enablePagination:a,enableRowPinning:r,rowCount:i}}=e,{columnOrder:l,density:d,globalFilter:c,isFullScreen:u,isLoading:g,pagination:m,showSkeletons:h,sorting:p}=o(),f=e.options.columns.length,v=i??t().rows.length,x=y.useReducer(()=>({}),{})[1],b=y.useRef(),w=y.useRef();y.useEffect(()=>{typeof window<"u"&&(b.current=document.body.style.height)},[]),y.useEffect(()=>{if(typeof window<"u")if(u)w.current=document.body.getBoundingClientRect().top,document.body.style.height="100dvh";else{if(document.body.style.height=b.current,!w.current)return;window.scrollTo({behavior:"instant",top:-1*w.current})}},[u]),y.useEffect(()=>{f!==l.length&&e.setColumnOrder(ni(e.options))},[f]),y.useEffect(()=>{if(!a||g||h)return;const{pageIndex:j,pageSize:M}=m,k=j*M;k>=v&&k>0&&e.setPageIndex(Math.ceil(v/M)-1)},[v]);const C=y.useRef(p);y.useEffect(()=>{p.length&&(C.current=p)},[p]),y.useEffect(()=>{nd(e)&&(c?e.setSorting([]):e.setSorting(()=>C.current||[]))},[c]),y.useEffect(()=>{r&&n()&&setTimeout(()=>{x()},150)},[d])},fy=e=>{var n,t,o,a,r,i,l,d,c,u,g,m,h,p,f,v,x,b,w,C,j,M,k,S,T,N,F,E,V,L,B,_,D;const O=y.useRef(null),P=y.useRef(null),$=y.useRef({}),z=y.useRef({}),H=y.useRef(null),ae=y.useRef(null),ie=y.useRef({}),Q=y.useRef(null),se=y.useRef(null),te=y.useRef(null),Z=y.useRef(null),I=y.useMemo(()=>{var ct,gt,Wt;const Kt=(ct=e.initialState)!==null&&ct!==void 0?ct:{};return Kt.columnOrder=(gt=Kt.columnOrder)!==null&&gt!==void 0?gt:ni(Object.assign(Object.assign({},e),{state:Object.assign(Object.assign({},e.initialState),e.state)})),Kt.globalFilterFn=(Wt=e.globalFilterFn)!==null&&Wt!==void 0?Wt:"fuzzy",Kt},[]);e.initialState=I;const[Y,ce]=y.useState((n=I.creatingRow)!==null&&n!==void 0?n:null),[ee,W]=y.useState(()=>Object.assign({},...oo(e.columns)?.map(ct=>{var gt,Wt,Kt,Hn;return{[Yn(ct)]:ct.filterFn instanceof Function?(gt=ct.filterFn.name)!==null&&gt!==void 0?gt:"custom":(Hn=(Wt=ct.filterFn)!==null&&Wt!==void 0?Wt:(Kt=I==null?void 0:I.columnFilterFns)===null||Kt===void 0?void 0:Kt[Yn(ct)])!==null&&Hn!==void 0?Hn:Mb(ct)}}))),[me,le]=y.useState((t=I.columnOrder)!==null&&t!==void 0?t:[]),[de,K]=y.useState((o=I.columnSizingInfo)!==null&&o!==void 0?o:{}),[A,ne]=y.useState((a=I==null?void 0:I.density)!==null&&a!==void 0?a:"md"),[be,ve]=y.useState((r=I.draggingColumn)!==null&&r!==void 0?r:null),[Se,we]=y.useState((i=I.draggingRow)!==null&&i!==void 0?i:null),[U,q]=y.useState((l=I.editingCell)!==null&&l!==void 0?l:null),[oe,Ie]=y.useState((d=I.editingRow)!==null&&d!==void 0?d:null),[he,X]=y.useState((c=I.globalFilterFn)!==null&&c!==void 0?c:"fuzzy"),[_e,Oe]=y.useState((u=I.grouping)!==null&&u!==void 0?u:[]),[Xe,ot]=y.useState((g=I.hoveredColumn)!==null&&g!==void 0?g:null),[et,J]=y.useState((m=I.hoveredRow)!==null&&m!==void 0?m:null),[Ae,$e]=y.useState((h=I==null?void 0:I.isFullScreen)!==null&&h!==void 0?h:!1),[re,Ke]=y.useState((p=I==null?void 0:I.pagination)!==null&&p!==void 0?p:{pageIndex:0,pageSize:10}),[Le,lt]=y.useState((f=I==null?void 0:I.showAlertBanner)!==null&&f!==void 0?f:!1),[It,at]=y.useState((v=I==null?void 0:I.showColumnFilters)!==null&&v!==void 0?v:!1),[kn,it]=y.useState((x=I==null?void 0:I.showGlobalFilter)!==null&&x!==void 0?x:!1),[us,tt]=y.useState((b=I==null?void 0:I.showToolbarDropZone)!==null&&b!==void 0?b:!1);e.state=Object.assign({columnFilterFns:ee,columnOrder:me,columnSizingInfo:de,creatingRow:Y,density:A,draggingColumn:be,draggingRow:Se,editingCell:U,editingRow:oe,globalFilterFn:he,grouping:_e,hoveredColumn:Xe,hoveredRow:et,isFullScreen:Ae,pagination:re,showAlertBanner:Le,showColumnFilters:It,showGlobalFilter:kn,showToolbarDropZone:us},e.state);const xe=e,mn=y.useRef([]);xe.columns=xe.state.columnSizingInfo.isResizingColumn||xe.state.draggingColumn||xe.state.draggingRow?mn.current:id({columnDefs:[...[dd(xe)&&iy(xe),ud(xe)&&oy(xe),ti(xe)&&sy(xe),ei(xe)&&ay(xe),gd(xe)&&ly(xe),md(xe)&&ry(xe)].filter(Boolean),...xe.columns,...[hd(xe)&&hy(xe)].filter(Boolean)],tableOptions:xe}),mn.current=xe.columns,xe.data=y.useMemo(()=>(xe.state.isLoading||xe.state.showSkeletons)&&!xe.data.length?[...Array(Math.min(xe.state.pagination.pageSize,20)).fill(null)]?.map(()=>Object.assign({},...oo(xe.columns)?.map(ct=>({[Yn(ct)]:null})))):xe.data,[xe.data,xe.state.isLoading,xe.state.showSkeletons]);const Je=Ev(Object.assign(Object.assign({onColumnOrderChange:le,onColumnSizingInfoChange:K,onGroupingChange:Oe,onPaginationChange:Ke},xe),{globalFilterFn:(w=xe.filterFns)===null||w===void 0?void 0:w[he??"fuzzy"]}));return Je.refs={bottomToolbarRef:P,editInputRefs:$,filterInputRefs:z,lastSelectedRowId:O,searchInputRef:H,tableContainerRef:ae,tableFooterRef:Z,tableHeadCellRefs:ie,tableHeadRef:te,tablePaperRef:Q,topToolbarRef:se},Je.setCreatingRow=ct=>{let gt=ct;ct===!0&&(gt=ny(Je)),xe!=null&&xe.onCreatingRowChange?xe.onCreatingRowChange(gt):ce(gt)},Je.setColumnFilterFns=(C=xe.onColumnFilterFnsChange)!==null&&C!==void 0?C:W,Je.setDensity=(j=xe.onDensityChange)!==null&&j!==void 0?j:ne,Je.setDraggingColumn=(M=xe.onDraggingColumnChange)!==null&&M!==void 0?M:ve,Je.setDraggingRow=(k=xe.onDraggingRowChange)!==null&&k!==void 0?k:we,Je.setEditingCell=(S=xe.onEditingCellChange)!==null&&S!==void 0?S:q,Je.setEditingRow=(T=xe.onEditingRowChange)!==null&&T!==void 0?T:Ie,Je.setGlobalFilterFn=(N=xe.onGlobalFilterFnChange)!==null&&N!==void 0?N:X,Je.setHoveredColumn=(F=xe.onHoveredColumnChange)!==null&&F!==void 0?F:ot,Je.setHoveredRow=(E=xe.onHoveredRowChange)!==null&&E!==void 0?E:J,Je.setIsFullScreen=(V=xe.onIsFullScreenChange)!==null&&V!==void 0?V:$e,Je.setShowAlertBanner=(L=xe.onShowAlertBannerChange)!==null&&L!==void 0?L:lt,Je.setShowColumnFilters=(B=xe.onShowColumnFiltersChange)!==null&&B!==void 0?B:at,Je.setShowGlobalFilter=(_=xe.onShowGlobalFilterChange)!==null&&_!==void 0?_:it,Je.setShowToolbarDropZone=(D=xe.onShowToolbarDropZoneChange)!==null&&D!==void 0?D:tt,py(Je),Je},Id=e=>fy(my(e));var vy={root:"MRT_TablePaper-module_root__q0v5L"},Sa={root:"MRT_TableContainer-module_root__JIsGB","root-sticky":"MRT_TableContainer-module_root-sticky__uC4qx","root-fullscreen":"MRT_TableContainer-module_root-fullscreen__aM8Jg"},ol={root:"MRT_Table-module_root__ms2uS","root-grid":"MRT_Table-module_root-grid__2Pynz"};const xy=e=>{var n,t,o,a;const{getLeftLeafColumns:r,getRightLeafColumns:i,getState:l,getVisibleLeafColumns:d,options:{columnVirtualizerInstanceRef:c,columnVirtualizerOptions:u,enableColumnPinning:g,enableColumnVirtualization:m},refs:{tableContainerRef:h}}=e,{columnPinning:p,draggingColumn:f}=l();if(!m)return;const v=pe(u,{table:e}),x=d(),[b,w]=y.useMemo(()=>g?[r()?.map(N=>N.getPinnedIndex()),i()?.map(N=>x.length-N.getPinnedIndex()-1).sort((N,F)=>N-F)]:[[],[]],[x.length,p,g]),C=b.length,j=w.length,M=y.useMemo(()=>f!=null&&f.id?x.findIndex(N=>N.id===(f==null?void 0:f.id)):void 0,[f==null?void 0:f.id]),k=Ac(Object.assign({count:x.length,estimateSize:N=>x[N].getSize(),getScrollElement:()=>h.current,horizontal:!0,overscan:3,rangeExtractor:y.useCallback(N=>{const F=od(N,M);return!C&&!j?F:[...new Set([...b,...F,...w])]},[b,w,M])},v)),S=k.getVirtualItems();k.virtualColumns=S;const T=S.length;if(T){const N=k.getTotalSize(),F=((n=S[C])===null||n===void 0?void 0:n.start)||0,E=((t=S[b.length-1])===null||t===void 0?void 0:t.end)||0,V=((o=S[T-j])===null||o===void 0?void 0:o.start)||0,L=((a=S[T-j-1])===null||a===void 0?void 0:a.end)||0;k.virtualPaddingLeft=F-E,k.virtualPaddingRight=N-L-(j?N-V:0)}return c&&(c.current=k),k},by=e=>{var{table:n}=e,t=Te(e,["table"]);const{getFlatHeaders:o,getState:a,options:{columns:r,enableTableFooter:i,enableTableHead:l,layoutMode:d,mantineTableProps:c,memoMode:u}}=n,{columnSizing:g,columnSizingInfo:m,columnVisibility:h,density:p}=a(),f=Object.assign(Object.assign({highlightOnHover:!0,horizontalSpacing:p,verticalSpacing:p},pe(c,{table:n})),t),v=y.useMemo(()=>{const j=o(),M={};for(let k=0;k<j.length;k++){const S=j[k],T=S.getSize();M[`--header-${Xt(S.id)}-size`]=T,M[`--col-${Xt(S.column.id)}-size`]=T}return M},[r,g,m,h]),b={columnVirtualizer:xy(n),table:n},{colorScheme:w}=xu(),{stripedColor:C}=f;return s.jsxs(Gt,Object.assign({className:je("mrt-table",ol.root,(d==null?void 0:d.startsWith("grid"))&&ol["root-grid"],f.className)},f,{__vars:Object.assign(Object.assign(Object.assign({},v),{"--mrt-striped-row-background-color":C,"--mrt-striped-row-hover-background-color":C?w==="dark"?mg(C,.08):bu(C,.12):void 0}),f.__vars),children:[l&&s.jsx(ty,Object.assign({},b)),u==="table-body"||m.isResizingColumn?s.jsx(bb,Object.assign({},b,{tableProps:f})):s.jsx(ad,Object.assign({},b,{tableProps:f})),i&&s.jsx(Eb,Object.assign({},b))]}))},yy=e=>{var n,{open:t,table:o}=e,a=Te(e,["open","table"]);const{getState:r,options:{mantineCreateRowModalProps:i,mantineEditRowModalProps:l,onCreatingRowCancel:d,onEditingRowCancel:c,renderCreateRowModalContent:u,renderEditRowModalContent:g},setCreatingRow:m,setEditingRow:h}=o,{creatingRow:p,editingRow:f}=r(),v=p??f,x={row:v,table:o},b=Object.assign(Object.assign(Object.assign({},pe(l,x)),p&&pe(i,x)),a),w=v.getAllCells().filter(j=>j.column.columnDef.columnDefType==="data")?.map(j=>s.jsx(Wo,{cell:j,table:o},j.id)),C=()=>{var j;p?(d==null||d({row:v,table:o}),m(null)):(c==null||c({row:v,table:o}),h(null)),v._valuesCache={},(j=b.onClose)===null||j===void 0||j.call(b)};return y.createElement(xl,Object.assign({opened:t,withCloseButton:!1},b,{key:v.id,onClose:C}),(n=p&&(u==null?void 0:u({internalEditComponents:w,row:v,table:o}))||(g==null?void 0:g({internalEditComponents:w,row:v,table:o})))!==null&&n!==void 0?n:s.jsxs(s.Fragment,{children:[s.jsx("form",{onSubmit:j=>j.preventDefault(),children:s.jsx(fe,{gap:"lg",pb:24,pt:16,children:w})}),s.jsx(st,{justify:"flex-end",children:s.jsx(rd,{row:v,table:o,variant:"text"})})]}))},wy=typeof window<"u"?y.useLayoutEffect:y.useEffect,jy=e=>{var{table:n}=e,t=Te(e,["table"]);const{getState:o,options:{createDisplayMode:a,editDisplayMode:r,enableStickyHeader:i,mantineLoadingOverlayProps:l,mantineTableContainerProps:d},refs:{bottomToolbarRef:c,tableContainerRef:u,topToolbarRef:g}}=n,{creatingRow:m,editingRow:h,isFullScreen:p,isLoading:f,showLoadingOverlay:v}=o(),[x,b]=y.useState(0),w=Object.assign(Object.assign({},pe(d,{table:n})),t),C=pe(l,{table:n});wy(()=>{var k,S,T,N;const F=typeof document<"u"&&(S=(k=g.current)===null||k===void 0?void 0:k.offsetHeight)!==null&&S!==void 0?S:0,E=typeof document<"u"&&(N=(T=c==null?void 0:c.current)===null||T===void 0?void 0:T.offsetHeight)!==null&&N!==void 0?N:0;b(F+E)});const j=a==="modal"&&m,M=r==="modal"&&h;return s.jsxs(G,Object.assign({},w,{__vars:Object.assign({"--mrt-top-toolbar-height":`${x}`},w==null?void 0:w.__vars),className:je("mrt-table-container",Sa.root,i&&Sa["root-sticky"],p&&Sa["root-fullscreen"],w==null?void 0:w.className),ref:k=>{k&&(u.current=k,w!=null&&w.ref&&(w.ref.current=k))},children:[s.jsx(Sr,Object.assign({visible:f||v,zIndex:2},C)),s.jsx(by,{table:n}),(j||M)&&s.jsx(yy,{open:!0,table:n})]}))};var Fd={"common-toolbar-styles":"common-styles-module_common-toolbar-styles__DnjR8"},fs={root:"MRT_BottomToolbar-module_root__VDeWo","root-fullscreen":"MRT_BottomToolbar-module_root-fullscreen__esE15","custom-toolbar-container":"MRT_BottomToolbar-module_custom-toolbar-container__XcDRF","paginator-container":"MRT_BottomToolbar-module_paginator-container__A3eWY","paginator-container-alert-banner":"MRT_BottomToolbar-module_paginator-container-alert-banner__gyqtO"},al={collapse:"MRT_ProgressBar-module_collapse__rOLJH","collapse-top":"MRT_ProgressBar-module_collapse-top__oCi0h"};const Pd=e=>{var{isTopToolbar:n,table:t}=e,o=Te(e,["isTopToolbar","table"]);const{getState:a,options:{mantineProgressProps:r}}=t,{isSaving:i,showProgressBars:l}=a(),d=Object.assign(Object.assign({},pe(r,{isTopToolbar:n,table:t})),o);return s.jsx(as,{className:je(al.collapse,n&&al["collapse-top"]),in:i||l,children:s.jsx(cs,Object.assign({animated:!0,"aria-busy":"true","aria-label":"Loading",radius:0,value:100},d))})};var _a={root:"MRT_TablePagination-module_root__yZ8pm",pagesize:"MRT_TablePagination-module_pagesize__-vmTn","with-top-margin":"MRT_TablePagination-module_with-top-margin__aM5-m"};const rl=[5,10,15,20,25,30,50,100]?.map(e=>e.toString()),Ed=e=>{var n,{position:t="bottom",table:o}=e,a=Te(e,["position","table"]);const{getPrePaginationRowModel:r,getState:i,options:{enableToolbarInternalActions:l,icons:{IconChevronLeft:d,IconChevronLeftPipe:c,IconChevronRight:u,IconChevronRightPipe:g},localization:m,mantinePaginationProps:h,paginationDisplayMode:p,rowCount:f},setPageIndex:v,setPageSize:x}=o,{pagination:{pageIndex:b=0,pageSize:w=10},showGlobalFilter:C}=i(),j=Object.assign(Object.assign({},pe(h,{table:o})),a),M=f??r().rows.length,k=Math.ceil(M/w),S=k>2,T=b*w,N=Math.min(b*w+w,M),F=j??{},{rowsPerPageOptions:E=rl,showRowsPerPage:V=!0,withEdges:L=S}=F,B=Te(F,["rowsPerPageOptions","showRowsPerPage","withEdges"]),_=t==="top"&&l&&!C;return s.jsxs(G,{className:je("mrt-table-pagination",_a.root,_&&_a["with-top-margin"]),children:[(j==null?void 0:j.showRowsPerPage)!==!1&&s.jsxs(Fe,{gap:"xs",children:[s.jsx(ue,{id:"rpp-label",children:m.rowsPerPage}),s.jsx(tn,{allowDeselect:!1,"aria-labelledby":"rpp-label",className:_a.pagesize,data:(n=j==null?void 0:j.rowsPerPageOptions)!==null&&n!==void 0?n:rl,onChange:D=>x(+D),value:w.toString()})]}),p==="pages"?s.jsx(Ht,Object.assign({firstIcon:c,lastIcon:g,nextIcon:u,onChange:D=>v(D-1),previousIcon:d,total:k,value:b+1,withEdges:L},B)):p==="default"?s.jsxs(s.Fragment,{children:[s.jsx(ue,{children:`${N===0?0:(T+1).toLocaleString()}-${N.toLocaleString()} ${m.of} ${M.toLocaleString()}`}),s.jsxs(Fe,{gap:6,children:[L&&s.jsx(Ee,{"aria-label":m.goToFirstPage,color:"gray",disabled:b<=0,onClick:()=>v(0),variant:"subtle",children:s.jsx(c,{})}),s.jsx(Ee,{"aria-label":m.goToPreviousPage,color:"gray",disabled:b<=0,onClick:()=>v(b-1),variant:"subtle",children:s.jsx(d,{})}),s.jsx(Ee,{"aria-label":m.goToNextPage,color:"gray",disabled:N>=M,onClick:()=>v(b+1),variant:"subtle",children:s.jsx(u,{})}),L&&s.jsx(Ee,{"aria-label":m.goToLastPage,color:"gray",disabled:N>=M,onClick:()=>v(k-1),variant:"subtle",children:s.jsx(g,{})})]})]}):null]})};var il={root:"MRT_ToolbarDropZone-module_root__eGTXb",hovered:"MRT_ToolbarDropZone-module_hovered__g7PeJ"};const Od=e=>{var{table:n}=e,t=Te(e,["table"]);const{getState:o,options:{enableGrouping:a,localization:r},setHoveredColumn:i,setShowToolbarDropZone:l}=n,{draggingColumn:d,grouping:c,hoveredColumn:u,showToolbarDropZone:g}=o(),m=h=>{i({id:"drop-zone"})};return y.useEffect(()=>{var h;((h=n.options.state)===null||h===void 0?void 0:h.showToolbarDropZone)!==void 0&&l(!!a&&!!d&&d.columnDef.enableGrouping!==!1&&!c.includes(d.id))},[a,d,c]),s.jsx(ss,{mounted:g,transition:"fade",children:()=>{var h,p;return s.jsx(st,Object.assign({className:je("mrt-toolbar-dropzone",il.root,(u==null?void 0:u.id)==="drop-zone"&&il.hovered),onDragEnter:m},t,{children:s.jsx(ue,{children:r.dropToGroupBy.replace("{column}",(p=(h=d==null?void 0:d.columnDef)===null||h===void 0?void 0:h.header)!==null&&p!==void 0?p:"")})}))}})},Cy=e=>{var{table:n}=e,t=Te(e,["table"]);const{getState:o,options:{enablePagination:a,mantineBottomToolbarProps:r,positionPagination:i,positionToolbarAlertBanner:l,positionToolbarDropZone:d,renderBottomToolbarCustomActions:c},refs:{bottomToolbarRef:u}}=n,{isFullScreen:g}=o(),m=ka("(max-width: 720px)"),h=Object.assign(Object.assign({},pe(r,{table:n})),t),p=m||!!c;return s.jsxs(G,Object.assign({},h,{className:je("mrt-bottom-toolbar",fs.root,Fd["common-toolbar-styles"],g&&fs["root-fullscreen"],h==null?void 0:h.className),ref:f=>{f&&(u.current=f,h!=null&&h.ref&&(h.ref.current=f))},children:[s.jsx(Pd,{isTopToolbar:!1,table:n}),l==="bottom"&&s.jsx(ri,{stackAlertBanner:p,table:n}),["both","bottom"].includes(d??"")&&s.jsx(Od,{table:n}),s.jsxs(G,{className:fs["custom-toolbar-container"],children:[c?c({table:n}):s.jsx("span",{}),s.jsx(G,{className:je(fs["paginator-container"],p&&fs["paginator-container-alert-banner"]),children:a&&["both","bottom"].includes(i??"")&&s.jsx(Ed,{position:"bottom",table:n})})]})]}))};var Gs={root:"MRT_TopToolbar-module_root__r4-V9","root-fullscreen":"MRT_TopToolbar-module_root-fullscreen__3itT8","actions-container":"MRT_TopToolbar-module_actions-container__-uL0u","actions-container-stack-alert":"MRT_TopToolbar-module_actions-container-stack-alert__OYDL6"},Sy={root:"MRT_ToolbarInternalButtons-module_root__NKoUG"};const _y=e=>{var n,{table:t}=e,o=Te(e,["table"]);const{options:{columnFilterDisplayMode:a,enableColumnFilters:r,enableColumnOrdering:i,enableColumnPinning:l,enableDensityToggle:d,enableFilters:c,enableFullScreenToggle:u,enableGlobalFilter:g,enableHiding:m,initialState:h,renderToolbarInternalActions:p}}=t;return s.jsx(st,Object.assign({},o,{className:je("mrt-toolbar-internal-buttons",Sy.root,o==null?void 0:o.className),children:(n=p==null?void 0:p({table:t}))!==null&&n!==void 0?n:s.jsxs(s.Fragment,{children:[c&&g&&!(h!=null&&h.showGlobalFilter)&&s.jsx(bd,{table:t}),c&&r&&a!=="popover"&&s.jsx(vd,{table:t}),(m||i||l)&&s.jsx(pd,{table:t}),d&&s.jsx(fd,{table:t}),u&&s.jsx(xd,{table:t})]})}))},My=e=>{var n,{table:t}=e,o=Te(e,["table"]);const{getState:a,options:{enableGlobalFilter:r,enablePagination:i,enableToolbarInternalActions:l,mantineTopToolbarProps:d,positionGlobalFilter:c,positionPagination:u,positionToolbarAlertBanner:g,positionToolbarDropZone:m,renderTopToolbarCustomActions:h},refs:{topToolbarRef:p}}=t,{isFullScreen:f,showGlobalFilter:v}=a(),x=ka("(max-width:720px)"),b=ka("(max-width:1024px)"),w=Object.assign(Object.assign({},pe(d,{table:t})),o),C=x||!!h||v&&b,j={style:b?void 0:{zIndex:3},table:t};return s.jsxs(G,Object.assign({},w,{className:je(Fd["common-toolbar-styles"],Gs.root,f&&Gs["root-fullscreen"],w==null?void 0:w.className),ref:M=>{M&&(p.current=M,w!=null&&w.ref&&(w.ref.current=M))},children:[g==="top"&&s.jsx(ri,{stackAlertBanner:C,table:t}),["both","top"].includes(m??"")&&s.jsx(Od,{table:t}),s.jsxs(st,{className:je(Gs["actions-container"],C&&Gs["actions-container-stack-alert"]),children:[r&&c==="left"&&s.jsx(ja,Object.assign({},j)),(n=h==null?void 0:h({table:t}))!==null&&n!==void 0?n:s.jsx("span",{}),l?s.jsxs(st,{justify:"end",wrap:"wrap-reverse",children:[r&&c==="right"&&s.jsx(ja,Object.assign({},j)),s.jsx(_y,{table:t})]}):r&&c==="right"&&s.jsx(ja,Object.assign({},j))]}),i&&["both","top"].includes(u??"")&&s.jsx(st,{justify:"end",children:s.jsx(Ed,{position:"top",table:t})}),s.jsx(Pd,{isTopToolbar:!0,table:t})]}))},Ry=e=>{var n,t,{table:o}=e,a=Te(e,["table"]);const{getState:r,options:{enableBottomToolbar:i,enableTopToolbar:l,mantinePaperProps:d,renderBottomToolbar:c,renderTopToolbar:u},refs:{tablePaperRef:g}}=o,{isFullScreen:m}=r(),h=Object.assign(Object.assign({},pe(d,{table:o})),a);return s.jsxs(Zt,Object.assign({shadow:"xs",withBorder:!0},h,{className:je("mrt-table-paper",vy.root,m&&"mrt-table-paper-fullscreen",h==null?void 0:h.className),ref:p=>{g.current=p,h!=null&&h.ref&&(h.ref.current=p)},style:p=>Object.assign(Object.assign({zIndex:m?200:void 0},pe(h==null?void 0:h.style,p)),m?{border:0,borderRadius:0,bottom:0,height:"100vh",left:0,margin:0,maxHeight:"100vh",maxWidth:"100vw",padding:0,position:"fixed",right:0,top:0,width:"100vw"}:null),children:[l&&((n=pe(u,{table:o}))!==null&&n!==void 0?n:s.jsx(My,{table:o})),s.jsx(jy,{table:o}),i&&((t=pe(c,{table:o}))!==null&&t!==void 0?t:s.jsx(Cy,{table:o}))]}))},Ny=e=>e.table!==void 0,ky=e=>{let n;return Ny(e)?n=e.table:n=Id(e),s.jsx(Ry,{table:n})};function Dy(){var t;const{i18n:e}=fl();return{language:(t=e.language)!=null&&t.startsWith("am")?"am":"en"}}function Ty(e){return e.language}function Iy({columns:e,data:n,options:t={},loading:o=!1,emptyMessage:a="No records found",serverPagination:r,onRefresh:i,...l}){var D,O;const{language:d}=Dy(),c=t,u=y.useMemo(()=>e.filter(P=>{const $=Ty(P);return!$||$===d}),[e,d]),g=(r==null?void 0:r.state)??((D=l.state)==null?void 0:D.pagination)??((O=l.initialState)==null?void 0:O.pagination)??{pageSize:10,pageIndex:0},[m,h]=y.useState(),p=1e3,[f,v]=y.useState(g),x=["5","10","20","50","100","200","500","1000","2000"],{mantineTableProps:b,mantinePaperProps:w,mantineTableContainerProps:C,mantineTopToolbarProps:j,mantineBottomToolbarProps:M,mantineSearchTextInputProps:k,mantinePaginationProps:S,mantineLoadingOverlayProps:T,mantineSelectAllCheckboxProps:N,mantineSelectCheckboxProps:F,...E}=l,V=E.renderTopToolbarCustomActions,L=({table:P})=>{var W;const $=(W=E.renderToolbarInternalActions)==null?void 0:W.call(E,{table:P}),z=c.withTableRefresher?s.jsx(Fe,{gap:"xs",align:"center",children:c.withTableRefresher&&s.jsx(We,{label:"Refresh table",children:s.jsx(pt,{"aria-label":"Refresh table",variant:"light",size:"compact-xs",leftSection:s.jsx(yc,{size:14}),onClick:()=>{var de;if(i){i();return}const me=r?r.state.pageIndex:f.pageIndex??g.pageIndex,le=r?r.state.pageSize:f.pageSize??g.pageSize;r?r.onChange({pageIndex:me,pageSize:le}):P.setPageSize&&(P.setPageSize(Number(le)),(de=P.setPageIndex)==null||de.call(P,me))},children:"Refresh"})})}):null,{options:{columnFilterDisplayMode:H,enableColumnFilters:ae,enableColumnOrdering:ie,enableColumnPinning:Q,enableDensityToggle:se,enableFilters:te,enableFullScreenToggle:Z,enableGlobalFilter:I,enableHiding:Y,initialState:ce}}=P,ee=s.jsxs(s.Fragment,{children:[te&&I&&!(ce!=null&&ce.showGlobalFilter)&&s.jsx(bd,{table:P}),te&&ae&&H!=="popover"&&s.jsx(vd,{table:P}),(Y||ie||Q)&&s.jsx(pd,{table:P}),se&&s.jsx(fd,{table:P}),Z&&s.jsx(xd,{table:P})]});if(!(!$&&!z))return s.jsxs(Fe,{gap:"xs",align:"center",children:[$,ee,z]})},B=({table:P})=>{var Q,se;if(!c.allowCustomRowsPerPage)return(Q=E.renderBottomToolbarCustomActions)==null?void 0:Q.call(E,{table:P});const $=!!r,z=$?r.rowCount??0:Array.isArray(n)?n.length:0,{pageIndex:H=0,pageSize:ae=g.pageSize}=$?r.state:f,ie=Math.max(1,Math.ceil(z/(ae||g.pageSize)));return s.jsxs(Fe,{align:"center",gap:"xs",style:{display:"flex",width:"100%",justifyContent:"flex-end"},children:[s.jsx(ue,{children:`${Math.min(z,H*ae+1)}-${Math.min(z,(H+1)*ae)} of ${z}`}),s.jsxs(Fe,{gap:"xs",style:{alignItems:"center"},children:[s.jsx(ue,{id:"rpp-label",children:((se=P.options.localization)==null?void 0:se.rowsPerPage)??"Rows per page"}),(()=>{const te=x.includes(String(ae))?String(ae):"Custom";return s.jsxs(Fe,{align:"center",gap:"xs",children:[s.jsx(tn,{data:[...x,"Custom"],value:te,onChange:Z=>{if(Z)if(Z==="Custom"||Z==="custom")h($?r.state.pageSize:f.pageSize??g.pageSize);else{const I=Number(Z);v({pageIndex:0,pageSize:I}),h(void 0),r&&r.onChange({pageIndex:0,pageSize:I})}},size:"xs",comboboxProps:{withinPortal:!0},style:{width:96}}),(!x.includes(String(ae))||m!==void 0)&&s.jsx(Fr,{size:"xs",value:m??ae,onChange:Z=>h(Z===""||Z==null?void 0:Number(Z)),onBlur:()=>{const Z=m??ae??g.pageSize,I=Math.min(Math.max(1,Number(Z)),p);r?r.onChange({pageIndex:0,pageSize:I}):v({pageIndex:0,pageSize:I}),h(void 0)},onKeyDown:Z=>{if(Z.key==="Enter"){Z.preventDefault();const I=m??ae??g.pageSize,Y=Math.min(Math.max(1,Number(I)),p);r?r.onChange({pageIndex:0,pageSize:Y}):v({pageIndex:0,pageSize:Y}),h(void 0)}},min:1,max:p,styles:{input:{width:88}},"aria-labelledby":"rpp-label",placeholder:`Max ${p}`})]})})()]}),s.jsx(Ht,{total:ie,value:H+1,onChange:te=>{const Z=te-1;r?r.onChange({pageIndex:Z,pageSize:ae??g.pageSize}):v(I=>({...I,pageIndex:Z}))},size:"sm"})]})},_=Id({...E,columns:u,data:c.allowCustomRowsPerPage&&!r&&Array.isArray(n)?n.slice((f.pageIndex??0)*(f.pageSize??10),(f.pageIndex??0)*(f.pageSize??10)+(f.pageSize??10)):n,state:{...E.state,...r?{pagination:g}:c.allowCustomRowsPerPage?{pagination:f}:{},isLoading:o},layoutMode:"grid",enablePagination:c.allowCustomRowsPerPage?!1:c.pagination??!0,manualPagination:r?!0:E.manualPagination,rowCount:(r==null?void 0:r.rowCount)??(c.allowCustomRowsPerPage&&Array.isArray(n)?n.length:E.rowCount),onPaginationChange:r?P=>{const $=typeof P=="function"?P(g):P;r.onChange($)}:E.onPaginationChange,paginationDisplayMode:"pages",initialState:{density:"xs",pagination:g,showGlobalFilter:!0,...E.initialState},enableFilters:c.filters??!0,enableGlobalFilter:c.globalFilter??!0,enableColumnFilters:c.columnFilters??!0,columnFilterDisplayMode:"popover",positionGlobalFilter:"left",enableSorting:c.sorting??!0,enableMultiSort:c.multiSort??!0,enableColumnActions:c.columnActions??!0,enableColumnOrdering:c.columnOrdering??!0,enableColumnResizing:c.columnResizing??!0,columnResizeMode:"onChange",enableRowSelection:c.rowSelection??!0,enableSelectAll:c.selectAll??!0,positionToolbarAlertBanner:"bottom",enableDensityToggle:c.densityToggle??!0,enableFullScreenToggle:c.fullScreenToggle??!0,enableHiding:c.hiding??!0,enableTopToolbar:c.topToolbar??!0,enableBottomToolbar:c.bottomToolbar??!0,positionPagination:"bottom",renderEmptyRowsFallback:()=>s.jsx("div",{style:{textAlign:"center",padding:"2rem",color:"var(--mantine-color-dimmed)"},children:a}),renderTopToolbarCustomActions:V,renderToolbarInternalActions:L,renderBottomToolbarCustomActions:B,mantineTableProps:{striped:"odd",highlightOnHover:!0,withTableBorder:!1,withColumnBorders:!1,fz:"sm",...b},mantinePaperProps:{shadow:"none",withBorder:!1,radius:0,...w,style:{height:"100%",display:"flex",flexDirection:"column",...w==null?void 0:w.style}},mantineTableContainerProps:{...C,style:{flex:1,minHeight:0,...C==null?void 0:C.style}},mantineTopToolbarProps:{...j,style:{paddingInline:"1rem",...j==null?void 0:j.style}},mantineBottomToolbarProps:{...M,style:{paddingInline:"1rem",...M==null?void 0:M.style}},mantineSearchTextInputProps:{placeholder:"Search all columns...",...k,style:{minWidth:240,...k==null?void 0:k.style}},mantinePaginationProps:{showRowsPerPage:!c.allowCustomRowsPerPage,rowsPerPageOptions:x,...S},mantineLoadingOverlayProps:{loaderProps:{type:"dots"},...T},mantineSelectAllCheckboxProps:{size:"sm",...N},mantineSelectCheckboxProps:{size:"sm",...F},getRowId:E.getRowId??((P,$)=>String((P==null?void 0:P.id)??$))});return s.jsx(ky,{table:_})}const Fy="_content_1b0ut_1",Py="_modalBody_1b0ut_17",Ey="_shell_1b0ut_35",Oy="_header_1b0ut_53",Ay="_headerView_1b0ut_73",zy="_headerEdit_1b0ut_81",$y="_iconWrap_1b0ut_89",Ly="_body_1b0ut_113",Vy="_footer_1b0ut_125",By="_status_1b0ut_145",Uy="_statusDot_1b0ut_159",Hy="_statusDotEdit_1b0ut_173",Gy="_actions_1b0ut_181",qy="_bodyView_1b0ut_189",Wy="_bodyEdit_1b0ut_285",ft={content:Fy,modalBody:Py,shell:Ey,header:Oy,headerView:Ay,headerEdit:zy,iconWrap:$y,body:Ly,footer:Vy,status:By,statusDot:Uy,statusDotEdit:Hy,actions:Gy,bodyView:qy,bodyEdit:Wy};function Ky(e){return e.toLowerCase()==="edit"}function _t({opened:e,onClose:n,mode:t,headerIcon:o,title:a,referenceId:r,footerStatusLabel:i,actions:l,children:d,bodyClassName:c,footerLeftSection:u,size:g="lg",centered:m=!0,radius:h="md",padding:p=0,styles:f,classNames:v,transitionProps:x,...b}){const w=Ky(t);return s.jsx(xl,{opened:e,onClose:n,withCloseButton:!1,size:g,centered:m,radius:h,padding:p,classNames:{...v,content:[ft.content,v==null?void 0:v.content].filter(Boolean).join(" "),body:[ft.modalBody,v==null?void 0:v.body].filter(Boolean).join(" ")},styles:{content:{maxWidth:"calc(100vw - 1.5rem)"},...f},transitionProps:x??{transition:"pop",duration:250,timingFunction:"ease"},...b,children:s.jsxs(G,{className:ft.shell,children:[s.jsxs(Fe,{justify:"space-between",align:"center",gap:"md",px:"lg",py:"md",className:`${ft.header} ${w?ft.headerEdit:ft.headerView}`,children:[s.jsxs(Fe,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[s.jsx(G,{className:ft.iconWrap,children:o}),s.jsxs(fe,{gap:2,children:[s.jsx(ue,{fw:700,size:"md",style:{color:"light-dark(var(--um-modal-title, var(--mantine-color-fhcGray-9)), #f1f5f9)"},children:a}),r&&s.jsx(ue,{size:"xs",c:"dimmed",children:r})]})]}),s.jsx(Ee,{"aria-label":"Close modal",variant:"subtle",color:"gray",onClick:n,children:s.jsx(wc,{size:18})})]}),s.jsx(G,{className:[ft.body,w?ft.bodyEdit:ft.bodyView,c].filter(Boolean).join(" "),children:d}),s.jsxs(Fe,{justify:"space-between",px:"md",py:"sm",className:ft.footer,children:[s.jsxs(Fe,{gap:"xs",wrap:"nowrap",className:ft.status,children:[s.jsx(G,{className:`${ft.statusDot} ${w?ft.statusDotEdit:""}`}),s.jsx(ue,{size:"xs",fw:600,children:i}),u]}),s.jsx(Fe,{gap:"sm",justify:"flex-end",className:ft.actions,children:l?.map(({label:C,key:j,onClick:M,dismiss:k,...S},T)=>s.jsx(pt,{type:S.type??"button",onClick:N=>{M==null||M(N),!N.defaultPrevented&&k&&n()},...S,children:C},j??T))})]})]})})}function Re(e){return e?typeof e=="string"?e:e.en||e.am||"Untitled":"Untitled"}function ii(e,...n){const t=e.trim().toLowerCase();return t?n?.some(o=>o==null?void 0:o.toLowerCase().includes(t)):!0}function Lt(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function Ad(e){var n;return{id:e.id,label:Re(e.name),kind:"department",count:((n=e.subPositions)==null?void 0:n.length)??0,parentId:e.parentPositionId??void 0,raw:e,children:(e.subPositions??[])?.map(Ad)}}function zd(e){return e.reduce((n,t)=>n+1+zd(t.subPositions??[]),0)}function Yy(e){const{organizations:n,units:t,positions:o,selectedOrganizationId:a,selectedUnitId:r}=e;return n?.map(i=>({id:i.id,label:Re(i.name),kind:"organization",raw:i,count:i.id===a?t.length:void 0,children:i.id===a?t.filter(l=>l.organizationId===i.id)?.map(l=>({id:l.id,label:Re(l.name),kind:"unit",raw:l,parentId:i.id,count:l.id===r?zd(o):void 0,children:l.id===r?o?.map(Ad):[]})):[]}))}function qs({label:e,value:n}){return s.jsxs(fe,{gap:4,children:[s.jsx(ue,{size:"xs",tt:"uppercase",fw:700,c:"fhcGray.5",children:e}),s.jsx(ue,{size:"sm",fw:600,c:"fhcGray.8",children:n})]})}function Qy({employee:e,opened:n,onClose:t}){const o=Re(e==null?void 0:e.user.name);return s.jsx(_t,{opened:n,onClose:t,mode:"View",title:"Team Member Details",headerIcon:s.jsx(E0,{size:18}),referenceId:e==null?void 0:e.id,footerStatusLabel:"Synced with user management",actions:[{label:"Close",variant:"light",dismiss:!0}],children:e?s.jsxs(fe,{gap:"lg",p:"lg",children:[s.jsxs(Fe,{gap:"md",wrap:"nowrap",children:[s.jsx(mo,{radius:"xl",size:56,color:"fhcBlue",children:o.charAt(0).toUpperCase()}),s.jsxs(fe,{gap:2,children:[s.jsx(ue,{size:"lg",fw:700,c:"fhcGray.9",children:o}),s.jsxs(Fe,{gap:"xs",children:[s.jsx(nt,{color:e.isCurrent?"green":"gray",children:e.isCurrent?"Current assignment":"Not current"}),s.jsx(nt,{variant:"light",color:"fhcBlue",children:e.status||e.user.status||"Unknown"})]})]})]}),s.jsxs(bn,{cols:{base:1,sm:2},spacing:"lg",children:[s.jsx(qs,{label:"Email",value:e.user.email||"No email provided"}),s.jsx(qs,{label:"Phone",value:e.user.phoneNumber||"No phone provided"}),s.jsx(qs,{label:"Username",value:e.user.username||"No username provided"}),s.jsx(qs,{label:"User Type",value:e.user.userType||"employee"})]}),s.jsxs(Fe,{gap:"xl",c:"fhcGray.6",children:[s.jsxs(Fe,{gap:6,children:[s.jsx(a0,{size:16}),s.jsx(ue,{size:"sm",children:"Primary contact"})]}),s.jsxs(Fe,{gap:6,children:[s.jsx(u0,{size:16}),s.jsx(ue,{size:"sm",children:"Phone enabled"})]}),s.jsxs(Fe,{gap:6,children:[s.jsx(sf,{size:16}),s.jsx(ue,{size:"sm",children:"Position-linked access"})]})]})]}):null})}(()=>{const e="".trim().replace(/\/+$/,"").replace(/\/docs$/,"");return e?e.endsWith("/api")?e:`${e}/api`:null})();class Xy extends Error{constructor(t,o){super(t);mi(this,"status");this.name="UserManagementApiError",this.status=o}}function Zy(e){var l,d,c,u;const n=e,t=((l=n==null?void 0:n.response)==null?void 0:l.status)??0,o=`Request failed with status ${t||"unknown"}`,a=(d=n==null?void 0:n.response)==null?void 0:d.data,r=(u=(c=a==null?void 0:a.exception)==null?void 0:c.response)==null?void 0:u.message,i=(Array.isArray(r)?r.join(", "):r)||(Array.isArray(a==null?void 0:a.message)?a.message.join(", "):a==null?void 0:a.message)||(n==null?void 0:n.message)||o;return new Xy(i,t)}async function Jy(e,n){const t={url:e,method:(n==null?void 0:n.method)??"GET",headers:n==null?void 0:n.headers};(n==null?void 0:n.body)!==void 0&&(t.data=JSON.parse(n.body));try{return(await Na.request(t)).data}catch(o){throw Zy(o)}}async function rt(e,n){return Jy(e,n)}async function ew(){return rt("/organizations/with-admin-flag?take=3000&skip=0")}async function tw(e){return rt(`/organizations/${e}`)}async function nw(e,n){return rt(`/organizations/${e}`,{method:"PUT",body:JSON.stringify(n)})}async function sw(e){return rt(`/organizations/${e}`,{method:"DELETE"})}async function ow(e){return rt(`/units/list/${e}?take=100&skip=0`)}async function aw(e){return rt("/units",{method:"POST",body:JSON.stringify(e)})}async function rw(e,n){return rt(`/units/${e}`,{method:"PUT",body:JSON.stringify(n)})}async function iw(e){return rt(`/units/${e}`,{method:"DELETE"})}async function lw(e){return rt(`/positions/hierarchy/${e}`)}async function cw(e){return rt(`/position-types/list-with-commons/${e}?take=1000&skip=0&orderBy=createdAt:Desc`)}async function dw(e){return rt("/positions",{method:"POST",body:JSON.stringify(e)})}async function uw(e,n){return rt(`/positions/${e}`,{method:"PUT",body:JSON.stringify(n)})}async function gw(e){return rt("/positions/change-parent",{method:"PATCH",body:JSON.stringify(e)})}async function mw(e){return rt(`/positions/${e}`,{method:"DELETE"})}async function hw(e){return rt("/employee-positions/invite",{method:"POST",body:JSON.stringify(e)})}async function pw(e){return rt("/employee-positions/assign",{method:"POST",body:JSON.stringify(e)})}async function fw(e){const n=await rt(`/employees/${e}/active-with-unit?take=3000&skip=0`);return{count:n.count,items:n.items?.map(t=>{var o;return{id:t.id,name:t.name??{},email:t.email??void 0,employee:(o=t.employee)==null?void 0:o?.map(a=>({id:a.id,name:a.name??{},employeePositions:a.employeePositions??[]}))}})}}async function vw(e){const n=await rt(`/employees/${e}/by-organization?take=3000`);return{count:n.count,items:n.items?.map(t=>({id:t.id,organizationId:e,isCurrent:!0,status:"Active",user:{id:t.user.id,name:t.user.name??t.name,email:t.user.email??void 0,phoneNumber:t.user.phoneNumber??void 0},employeePositions:t.employeePositions}))}}async function xw(e){return rt(`/positions/current/${e}/employees`)}function bw(){return zt({queryKey:["user-management","organizations"],queryFn:ew,staleTime:300*1e3})}function yw(e,n){return zt({queryKey:["user-management","organization",e],queryFn:()=>tw(e),enabled:!!e&&!(n!=null&&n.skip),staleTime:60*1e3})}function ww(){const e=Tt(),n=en({mutationFn:o=>nw(o.id,o.body),onSuccess:(o,a)=>{e.invalidateQueries({queryKey:["user-management","organizations"]}),e.invalidateQueries({queryKey:["user-management","organization",a.id]})}});return[o=>({unwrap:()=>n.mutateAsync(o)}),{isLoading:n.isPending}]}function jw(){const e=Tt(),n=en({mutationFn:o=>sw(o),onSuccess:()=>{e.invalidateQueries({queryKey:["user-management","organizations"]})}});return[o=>({unwrap:()=>n.mutateAsync(o)}),{isLoading:n.isPending}]}function Cw(e){return zt({queryKey:["user-management","units",e],queryFn:()=>ow(e),enabled:!!e,staleTime:300*1e3})}function Sw(e){return zt({queryKey:["user-management","positions",e],queryFn:()=>lw(e),enabled:!!e,staleTime:60*1e3})}function li(e){return zt({queryKey:["user-management","position-types",e],queryFn:()=>cw(e),enabled:!!e,staleTime:300*1e3})}function _w(e,n=!0){return zt({queryKey:["user-management","organization-employees",e],queryFn:()=>vw(e),enabled:!!e&&n,staleTime:30*1e3})}function Mw(e){return zt({queryKey:["user-management","team-members",e],queryFn:()=>xw(e),enabled:!!e,staleTime:30*1e3})}function Rw(e,n=!0){return zt({queryKey:["user-management","assignable-users",e],queryFn:()=>fw(e),enabled:!!e&&n,staleTime:30*1e3})}function Nw(){const e=Tt();return en({mutationFn:n=>aw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","organizations"]}),e.invalidateQueries({queryKey:["user-management","units",t.organizationId]})}})}function kw(){const e=Tt();return en({mutationFn:({unitId:n,payload:t})=>rw(n,t),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","organizations"]}),e.invalidateQueries({queryKey:["user-management","units",t.payload.organizationId]})}})}function Dw(){const e=Tt();return en({mutationFn:({unitId:n,organizationId:t})=>iw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","organizations"]}),e.invalidateQueries({queryKey:["user-management","units",t.organizationId]}),e.invalidateQueries({queryKey:["user-management","positions",t.unitId]})}})}function $d(){const e=Tt();return en({mutationFn:n=>dw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","positions",t.unitId]}),e.invalidateQueries({queryKey:["user-management","units",t.organizationId]})}})}function Tw(){const e=Tt();return en({mutationFn:({positionId:n,payload:t})=>uw(n,t),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","positions",t.payload.unitId]}),e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]})}})}function Iw(){const e=Tt();return en({mutationFn:({payload:n,unitId:t,positionId:o})=>gw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","positions",t.unitId]}),e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]})}})}function Fw(){const e=Tt();return en({mutationFn:({positionId:n,unitId:t})=>mw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","positions",t.unitId]}),e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]})}})}function Pw(){const e=Tt();return en({mutationFn:({payload:n,positionId:t,organizationId:o})=>hw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]}),e.invalidateQueries({queryKey:["user-management","organization-employees",t.organizationId]})}})}function Ew(){const e=Tt();return en({mutationFn:({payload:n,unitId:t,positionId:o,organizationId:a})=>pw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","assignable-users",t.unitId]}),e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]}),e.invalidateQueries({queryKey:["user-management","organization-employees",t.organizationId]})}})}function Ow({opened:e,department:n,onClose:t}){const o=Pw(),[a,r]=y.useState(""),[i,l]=y.useState(""),[d,c]=y.useState(""),[u,g]=y.useState(""),[m,h]=y.useState("");y.useEffect(()=>{e&&(r(""),l(""),c(""),g(""),h(""))},[e]);const p=async()=>{if(n){if(!a.trim()||!i.trim()||!u.trim()||!m.trim()){Ue.show({title:"Missing fields",message:"Username, email, and both localized names are required.",color:"red"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.trim())){Ue.show({title:"Invalid email",message:"Please enter a valid email address.",color:"red"});return}try{await o.mutateAsync({positionId:n.id,organizationId:n.organizationId,payload:{positionId:n.id,username:a.trim(),email:i.trim(),phoneNumber:d.trim()||void 0,name:{am:u.trim(),en:m.trim()}}}),Ue.show({title:"User invited",message:`${m.trim()} was added to ${Re(n.name)}.`,color:"green"}),t()}catch(f){Ue.show({title:"Failed to add user",message:f instanceof Error?f.message:"Something went wrong.",color:"red"})}}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(Gr,{size:18}),title:"Add User",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Inviting department user",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:o.isPending?"Adding...":"Add User",onClick:()=>void p(),loading:o.isPending}],size:"md",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Position"}),s.jsx(qe,{value:n?Re(n.name):"",disabled:!0})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Username *"}),s.jsx(qe,{value:a,onChange:f=>r(f.currentTarget.value),autoFocus:!0})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Email *"}),s.jsx(qe,{value:i,onChange:f=>l(f.currentTarget.value),type:"email"})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Phone Number"}),s.jsx(qe,{value:d,onChange:f=>c(f.currentTarget.value),placeholder:"0912345678 or +251912345678"})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name *"}),s.jsx(qe,{value:u,onChange:f=>g(f.currentTarget.value)})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name *"}),s.jsx(qe,{value:m,onChange:f=>h(f.currentTarget.value)})]})]})})}function Aw({opened:e,onClose:n,organizationId:t,organizationLabel:o,onCreated:a}){const[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState(""),[g,m]=y.useState(!1),h=Nw(),p=y.useMemo(()=>Lt(r),[r]);y.useEffect(()=>{g||u(p)},[p,g]),y.useEffect(()=>{e||(i(""),d(""),u(""),m(!1))},[e]);const f=async()=>{if(!t){Ue.show({title:"Organization required",message:"Select an organization before adding a unit.",color:"red"});return}if(!r.trim()||!l.trim()||!c.trim()){Ue.show({title:"Missing fields",message:"English name, Amharic name, and key are all required.",color:"red"});return}try{await h.mutateAsync({name:{en:r.trim(),am:l.trim()},key:c.trim(),organizationId:t,parentUnitId:null}),Ue.show({title:"Unit created",message:`${r.trim()} was added successfully.`,color:"green"}),a==null||a(),n()}catch(v){Ue.show({title:"Failed to create unit",message:v instanceof Error?v.message:"Something went wrong.",color:"red"})}};return s.jsx(_t,{opened:e,onClose:n,mode:"Edit",headerIcon:s.jsx(af,{size:18}),title:"Add New Unit",referenceId:o,footerStatusLabel:"Creating organization unit",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:h.isPending?"Adding...":"Add Unit",onClick:()=>{f()},loading:h.isPending}],size:"md",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(qe,{placeholder:"Enter English name",value:r,onChange:v=>i(v.currentTarget.value),autoFocus:!0})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(qe,{placeholder:"Enter Amharic name",value:l,onChange:v=>d(v.currentTarget.value)})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(qe,{placeholder:"e.g. finance-unit",value:c,onChange:v=>{m(!0),u(Lt(v.currentTarget.value))}})]})]})})}function zw({opened:e,unit:n,onClose:t}){var x;const[o,a]=y.useState(null),[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState(""),[g,m]=y.useState(!1),h=li(n==null?void 0:n.id),p=$d(),f=y.useMemo(()=>Lt(r),[r]);y.useEffect(()=>{e&&(a(null),i(""),d(""),u(""),m(!1))},[e]),y.useEffect(()=>{g||u(f)},[f,g]);const v=async()=>{if(n){if(!o||!r.trim()||!l.trim()||!c.trim()){Ue.show({title:"Missing fields",message:"Position type, English name, Amharic name, and key are all required.",color:"red"});return}try{await p.mutateAsync({positionTypeId:o,unitId:n.id,organizationId:n.organizationId,name:{en:r.trim(),am:l.trim()},key:c.trim(),parentPositionId:null,projectId:null}),Ue.show({title:"Department created",message:`${r.trim()} was added successfully.`,color:"green"}),t()}catch(b){Ue.show({title:"Failed to create department",message:b instanceof Error?b.message:"Something went wrong.",color:"red"})}}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(rn,{size:18}),title:"Add Department",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Creating department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:p.isPending?"Adding...":"Add Department",onClick:()=>void v(),loading:p.isPending}],size:"md",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Position Types"}),s.jsx(tn,{placeholder:"Select a Position Type",value:o,onChange:a,searchable:!0,data:(((x=h.data)==null?void 0:x.items)??[])?.map(b=>({value:b.id,label:Re(b.name)}))})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(qe,{value:r,onChange:b=>i(b.currentTarget.value),placeholder:"Enter English name",autoFocus:!0})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(qe,{value:l,onChange:b=>d(b.currentTarget.value),placeholder:"Enter Amharic name"})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(qe,{value:c,onChange:b=>{m(!0),u(Lt(b.currentTarget.value))},placeholder:"e.g. finance-department"})]})]})})}function $w({opened:e,department:n,onClose:t}){var x;const[o,a]=y.useState(null),[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState(""),[g,m]=y.useState(!1),h=li(n==null?void 0:n.unitId),p=$d(),f=y.useMemo(()=>Lt(r),[r]);y.useEffect(()=>{e&&(a(null),i(""),d(""),u(""),m(!1))},[e]),y.useEffect(()=>{g||u(f)},[f,g]);const v=async()=>{if(n){if(!o||!r.trim()||!l.trim()||!c.trim()){Ue.show({title:"Missing fields",message:"Position type, English name, Amharic name, and key are all required.",color:"red"});return}try{await p.mutateAsync({positionTypeId:o,unitId:n.unitId,organizationId:n.organizationId,name:{en:r.trim(),am:l.trim()},key:c.trim(),parentPositionId:n.id,projectId:null}),Ue.show({title:"Sub-department created",message:`${r.trim()} was added successfully.`,color:"green"}),t()}catch(b){Ue.show({title:"Failed to create sub-department",message:b instanceof Error?b.message:"Something went wrong.",color:"red"})}}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(rn,{size:18}),title:"Add New Sub-Department",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Creating sub-department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:p.isPending?"Adding...":"Add Sub-department",onClick:()=>void v(),loading:p.isPending}],size:"md",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Parent Department"}),s.jsx(qe,{value:n?Re(n.name):"",disabled:!0})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Position Types"}),s.jsx(tn,{placeholder:"Select a Position Type",value:o,onChange:a,searchable:!0,data:(((x=h.data)==null?void 0:x.items)??[])?.map(b=>({value:b.id,label:Re(b.name)}))})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(qe,{value:r,onChange:b=>i(b.currentTarget.value),autoFocus:!0})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(qe,{value:l,onChange:b=>d(b.currentTarget.value)})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(qe,{value:c,onChange:b=>{m(!0),u(Lt(b.currentTarget.value))},placeholder:"Key"})]})]})})}function Lw({opened:e,department:n,onClose:t}){var c;const o=Ew(),a=Rw(n==null?void 0:n.unitId,e),[r,i]=y.useState(null);y.useEffect(()=>{e&&i(null)},[e]);const l=(((c=a.data)==null?void 0:c.items)??[])?.map(u=>{var h,p;const g=((p=(h=u.employee)==null?void 0:h[0])==null?void 0:p.id)??u.id,m=`${Re(u.name)}${u.email?` (${u.email})`:""}`;return{value:g,label:m}}),d=async()=>{if(!n||!r){Ue.show({title:"Missing user",message:"Please choose a user to assign.",color:"red"});return}try{await o.mutateAsync({unitId:n.unitId,positionId:n.id,organizationId:n.organizationId,payload:{positionId:n.id,employeeId:r}}),Ue.show({title:"User assigned",message:`The user was assigned to ${Re(n.name)}.`,color:"green"}),t()}catch(u){Ue.show({title:"Failed to assign user",message:u instanceof Error?u.message:"Something went wrong.",color:"red"})}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(Po,{size:18}),title:n?`Assign User to ${Re(n.name)}`:"Assign User",footerStatusLabel:"Assigning department user",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:o.isPending?"Assigning...":"Assign User",onClick:()=>void d(),loading:o.isPending}],size:"md",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Select User"}),s.jsx(tn,{value:r,onChange:i,data:l,searchable:!0,placeholder:"Select User",disabled:a.isLoading,nothingFoundMessage:"No users available"})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Positions"}),s.jsx(qe,{value:n?Re(n.name):"",disabled:!0})]})]})})}function Vw({opened:e,organization:n,onClose:t,onDeleted:o}){const[a,r]=jw(),i=async()=>{if(n)try{await a(n.id).unwrap(),Ue.show({title:"Organization deleted",message:`${Re(n.name)} was deleted successfully.`,color:"green"}),o==null||o(),t()}catch(l){Ue.show({title:"Failed to delete organization",message:l instanceof Error?l.message:"Something went wrong.",color:"red"})}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(ln,{size:18}),title:"Delete Organization",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Removing organization",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:r.isLoading?"Deleting...":"Delete Organization",color:"red",onClick:()=>void i(),loading:r.isLoading}],size:"sm",children:s.jsxs(fe,{gap:"sm",p:"lg",children:[s.jsx(ue,{fw:600,children:"Delete this organization?"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:"This action cannot be undone. Make sure the organization does not have dependent units, departments, or employee records before deleting it."})]})})}function Bw({opened:e,department:n,onClose:t,onDeleted:o}){const a=Fw(),r=async()=>{if(n)try{await a.mutateAsync({positionId:n.id,unitId:n.unitId}),Ue.show({title:"Department deleted",message:`${Re(n.name)} was deleted successfully.`,color:"green"}),o==null||o(),t()}catch(i){Ue.show({title:"Failed to delete department",message:i instanceof Error?i.message:"Something went wrong.",color:"red"})}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(ln,{size:18}),title:"Delete Department",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Removing department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:a.isPending?"Deleting...":"Delete Department",color:"red",onClick:()=>void r(),loading:a.isPending}],size:"md",children:s.jsxs(fe,{gap:"sm",p:"lg",children:[s.jsx(ue,{fw:600,children:"Delete this department?"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:"This removes the selected department from the unit tree. Make sure it is safe to remove before continuing."})]})})}function Uw({opened:e,unit:n,onClose:t,onDeleted:o}){const a=Dw(),r=async()=>{if(n)try{await a.mutateAsync({unitId:n.id,organizationId:n.organizationId}),Ue.show({title:"Unit deleted",message:`${Re(n.name)} was deleted successfully.`,color:"green"}),o==null||o(),t()}catch(i){Ue.show({title:"Failed to delete unit",message:i instanceof Error?i.message:"Something went wrong.",color:"red"})}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(ln,{size:18}),title:"Delete Unit",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Removing organization unit",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:a.isPending?"Deleting...":"Delete Unit",color:"red",onClick:()=>void r(),loading:a.isPending}],size:"sm",children:s.jsxs(fe,{gap:"sm",p:"lg",children:[s.jsx(ue,{fw:600,children:"Delete this unit?"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:"This action cannot be undone. Make sure the unit does not have dependent records before deleting it."})]})})}function Hw({opened:e,organization:n,onClose:t,onUpdated:o}){const a=(n==null?void 0:n.id)??"",r=yw(a,{skip:!e||!a}),[i,l]=ww(),[d,c]=y.useState(""),[u,g]=y.useState(""),[m,h]=y.useState(""),[p,f]=y.useState(!1);y.useEffect(()=>{var w,C;const b=r.data;!e||!n||!b||(c(((w=b.name)==null?void 0:w.en)??n.name.en??""),g(((C=b.name)==null?void 0:C.am)??n.name.am??""),h(b.key??n.key??""),f(!1))},[e,n,r.data]);const v=y.useMemo(()=>Lt(d),[d]);y.useEffect(()=>{!e||p||h(v)},[v,p,e]);const x=async()=>{const b=r.data;if(!n||!b){Ue.show({title:"Organization unavailable",message:"The selected organization could not be loaded.",color:"red"});return}if(!d.trim()||!u.trim()||!m.trim()){Ue.show({title:"Missing fields",message:"English name, Amharic name, and key are all required.",color:"red"});return}try{await i({id:n.id,body:{name:{en:d.trim(),am:u.trim()},key:m.trim(),organizationTypeId:b.organizationTypeId,isGovernmentOrganization:b.isGovernmentOrganization,parentId:b.parentId??null,isActive:b.isActive}}).unwrap(),Ue.show({title:"Organization updated",message:`${d.trim()} was updated successfully.`,color:"green"}),o==null||o(),t()}catch(w){Ue.show({title:"Failed to update organization",message:w instanceof Error?w.message:"Something went wrong.",color:"red"})}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(on,{size:18}),title:"Edit Organization",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Updating organization",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:l.isLoading?"Saving...":"Save Changes",onClick:()=>void x(),loading:l.isLoading||r.isFetching,disabled:r.isLoading}],size:"md",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(qe,{value:d,onChange:b=>c(b.currentTarget.value),placeholder:"Enter English name",autoFocus:!0,disabled:r.isLoading})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(qe,{value:u,onChange:b=>g(b.currentTarget.value),placeholder:"Enter Amharic name",disabled:r.isLoading})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(qe,{value:m,onChange:b=>{f(!0),h(Lt(b.currentTarget.value))},placeholder:"e.g. federal-housing-corporation",disabled:r.isLoading})]})]})})}function Gw({opened:e,department:n,onClose:t}){var x;const[o,a]=y.useState(null),[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState(""),[g,m]=y.useState(!1),h=li(n==null?void 0:n.unitId),p=Tw();y.useEffect(()=>{e&&n&&(a(n.positionTypeId??null),i(n.name.en??""),d(n.name.am??""),u(n.key??""),m(!1))},[e,n]);const f=y.useMemo(()=>Lt(r),[r]);y.useEffect(()=>{!g&&e&&u(f)},[f,g,e]);const v=async()=>{if(n){if(!o||!r.trim()||!l.trim()||!c.trim()){Ue.show({title:"Missing fields",message:"Position type, English name, Amharic name, and key are all required.",color:"red"});return}try{await p.mutateAsync({positionId:n.id,payload:{positionTypeId:o,unitId:n.unitId,organizationId:n.organizationId,name:{en:r.trim(),am:l.trim()},key:c.trim(),parentPositionId:n.parentPositionId??null,projectId:null}}),Ue.show({title:"Department updated",message:`${r.trim()} was updated successfully.`,color:"green"}),t()}catch(b){Ue.show({title:"Failed to update department",message:b instanceof Error?b.message:"Something went wrong.",color:"red"})}}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(on,{size:18}),title:"Edit Department",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Updating department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:p.isPending?"Saving...":"Save Changes",onClick:()=>void v(),loading:p.isPending}],size:"md",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Position Types"}),s.jsx(tn,{placeholder:"Select a Position Type",value:o,onChange:a,searchable:!0,data:(((x=h.data)==null?void 0:x.items)??[])?.map(b=>({value:b.id,label:Re(b.name)}))})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(qe,{value:r,onChange:b=>i(b.currentTarget.value),autoFocus:!0})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(qe,{value:l,onChange:b=>d(b.currentTarget.value)})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(qe,{value:c,onChange:b=>{m(!0),u(Lt(b.currentTarget.value))}})]})]})})}function qw({opened:e,unit:n,onClose:t}){const[o,a]=y.useState(""),[r,i]=y.useState(""),[l,d]=y.useState(""),[c,u]=y.useState(!1),g=kw();y.useEffect(()=>{e&&n&&(a(n.name.en??""),i(n.name.am??""),d(n.key??""),u(!1))},[e,n]);const m=y.useMemo(()=>Lt(o),[o]);y.useEffect(()=>{!c&&e&&d(m)},[m,c,e]);const h=async()=>{if(n){if(!o.trim()||!r.trim()||!l.trim()){Ue.show({title:"Missing fields",message:"English name, Amharic name, and key are all required.",color:"red"});return}try{await g.mutateAsync({unitId:n.id,payload:{name:{en:o.trim(),am:r.trim()},key:l.trim(),organizationId:n.organizationId,parentUnitId:n.parentUnitId??null}}),Ue.show({title:"Unit updated",message:`${o.trim()} was updated successfully.`,color:"green"}),t()}catch(p){Ue.show({title:"Failed to update unit",message:p instanceof Error?p.message:"Something went wrong.",color:"red"})}}};return s.jsx(_t,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(on,{size:18}),title:"Edit Unit",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Updating organization unit",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:g.isPending?"Saving...":"Save Changes",onClick:()=>void h(),loading:g.isPending}],size:"md",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(qe,{value:o,onChange:p=>a(p.currentTarget.value),placeholder:"Enter English name",autoFocus:!0})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(qe,{value:r,onChange:p=>i(p.currentTarget.value),placeholder:"Enter Amharic name"})]}),s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(qe,{value:l,onChange:p=>{u(!0),d(Lt(p.currentTarget.value))},placeholder:"e.g. finance-unit"})]})]})})}function Ld(e){const n=new Set([e.id]);for(const t of e.subPositions??[])for(const o of Ld(t))n.add(o);return n}function Vd(e,n,t=0){return e.flatMap(o=>{const a=`${" ".repeat(t)}${Re(o.name)}`;return[...n.has(o.id)?[]:[{value:o.id,label:a}],...Vd(o.subPositions??[],n,t+1)]})}function Ww({opened:e,department:n,positions:t,onClose:o}){const a=Iw(),[r,i]=y.useState(null);y.useEffect(()=>{e&&i(null)},[e]);const l=y.useMemo(()=>n?Vd(t,Ld(n)):[],[n,t]),d=async()=>{if(!n||!r){Ue.show({title:"Missing department",message:"Please select the department to move under.",color:"red"});return}try{await a.mutateAsync({unitId:n.unitId,positionId:n.id,payload:{positionId:n.id,newParentId:r}}),Ue.show({title:"Department moved",message:`${Re(n.name)} was moved successfully.`,color:"green"}),o()}catch(c){Ue.show({title:"Failed to move department",message:c instanceof Error?c.message:"Something went wrong.",color:"red"})}};return s.jsx(_t,{opened:e,onClose:o,mode:"Edit",headerIcon:s.jsx(vc,{size:18}),title:"Move Department",referenceId:n?Re(n.name):void 0,footerStatusLabel:"Moving department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:a.isPending?"Moving...":"Move Department",onClick:()=>void d(),loading:a.isPending}],size:"md",children:s.jsx(fe,{gap:"md",p:"lg",children:s.jsxs(fe,{gap:6,children:[s.jsx(ue,{fw:500,children:"Select Departments"}),s.jsx(tn,{value:r,onChange:i,data:l,searchable:!0,placeholder:"Select Departments",nothingFoundMessage:"No departments available"})]})})})}function Kw({organizationId:e,organizationLabel:n,opened:t,onClose:o,onSelectEmployee:a}){var u;const[r,i]=y.useState(""),l=_w(e,t),d=((u=l.data)==null?void 0:u.items)??[],c=y.useMemo(()=>d.filter(g=>ii(r,Re(g.user.name),g.user.email,g.user.phoneNumber,...g.employeePositions?.map(m=>{var h;return Re((h=m.position)==null?void 0:h.name)}))),[d,r]);return s.jsx(_t,{opened:t,onClose:o,mode:"View",title:"Search All Employees",headerIcon:s.jsx(Po,{size:18}),referenceId:n,footerStatusLabel:"Organization-level employee lookup",actions:[{label:"Close",variant:"light",dismiss:!0}],size:"xl",children:s.jsxs(fe,{gap:"md",p:"lg",children:[s.jsx(qe,{value:r,onChange:g=>i(g.currentTarget.value),placeholder:"Search employees in this organization...",leftSection:s.jsx(ys,{size:16}),radius:"md"}),l.isLoading?s.jsx(Fe,{justify:"center",py:"xl",children:s.jsx(Rs,{size:"sm"})}):s.jsx(io,{h:420,children:s.jsxs(fe,{gap:"sm",children:[c?.map(g=>{const m=Re(g.user.name);return s.jsx(Zt,{withBorder:!0,radius:"md",p:"md",style:{cursor:"pointer"},onClick:()=>{a(g),o()},children:s.jsxs(Fe,{justify:"space-between",align:"flex-start",wrap:"nowrap",children:[s.jsxs(Fe,{gap:"md",wrap:"nowrap",children:[s.jsx(mo,{radius:"xl",color:"fhcBlue",children:m.charAt(0).toUpperCase()}),s.jsxs(fe,{gap:3,children:[s.jsx(ue,{fw:700,children:m}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:g.user.email||"No email"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:g.user.phoneNumber||"No phone"}),s.jsx(Fe,{gap:6,mt:4,children:g.employeePositions.length>0?g.employeePositions?.map(h=>{var p;return s.jsx(nt,{variant:"light",color:"fhcGold",children:Re((p=h.position)==null?void 0:p.name)},h.id)}):s.jsx(nt,{variant:"light",color:"blue",children:"No department assignment"})})]})]}),s.jsx(nt,{variant:"light",color:"green",children:"Active"})]})},g.id)}),!l.isLoading&&c.length===0?s.jsx(Zt,{radius:"md",p:"xl",bg:"var(--mantine-color-gray-0)",children:s.jsxs(fe,{align:"center",gap:"xs",children:[s.jsx(ue,{fw:700,children:"No employees found"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:"Try another search, or check whether this user is assigned to the selected organization."})]})}):null]})})]})})}const Ws="light-dark(#d9dfe7, #343a40)",Yw="light-dark(#d7ebff, #1f3a52)",ll="light-dark(#263445, #e6edf3)",cl="light-dark(#8a97a8, #9aa7b8)",Qw={organization:[{label:"Add Unit",icon:s.jsx(rn,{size:14})},{label:"Edit Organization",icon:s.jsx(on,{size:14})},{label:"Delete Organization",icon:s.jsx(ln,{size:14}),color:"red"}],unit:[{label:"Add Department",icon:s.jsx(rn,{size:14})},{label:"Edit Unit",icon:s.jsx(on,{size:14})},{label:"Delete Unit",icon:s.jsx(ln,{size:14}),color:"red"}],department:[{label:"Add User",icon:s.jsx(Gr,{size:14})},{label:"Assign User",icon:s.jsx(Po,{size:14})},{label:"Add Sub-department",icon:s.jsx(rn,{size:14})},{label:"Edit Department",icon:s.jsx(on,{size:14})},{label:"Move Department",icon:s.jsx(vc,{size:14})},{label:"Delete Department",icon:s.jsx(ln,{size:14}),color:"red"}]};function Bd({node:e,depth:n,selectedNodeId:t,expandedIds:o,toggleExpand:a,onSelect:r,onAction:i,ancestorHasNextSiblings:l,isLast:d}){const c=t===e.id,u=e.children.length>0,g=o.has(e.id),m=c&&!!i,h=typeof e.count=="number";return s.jsxs(fe,{gap:0,children:[s.jsxs(Fe,{gap:0,align:"stretch",wrap:"nowrap",children:[l?.map((p,f)=>s.jsx(G,{style:{width:24,position:"relative",flex:"0 0 24px"},children:p?s.jsx(G,{style:{position:"absolute",left:12,top:0,bottom:0,width:1,background:Ws}}):null},`${e.id}-ancestor-${f}`)),n>0?s.jsxs(G,{style:{width:22,position:"relative",flex:"0 0 22px"},children:[d?s.jsx(G,{style:{position:"absolute",left:11,top:0,height:"50%",width:1,background:Ws}}):s.jsx(G,{style:{position:"absolute",left:11,top:0,bottom:0,width:1,background:Ws}}),s.jsx(G,{style:{position:"absolute",left:11,top:"50%",width:14,height:1,background:Ws}})]}):null,s.jsxs(Fe,{gap:0,wrap:"nowrap",style:{flex:1,minWidth:0,minHeight:34,paddingLeft:n===0?2:4,paddingRight:10,borderRadius:4,background:c?Yw:"transparent"},children:[s.jsx(Ee,{variant:"transparent",color:"gray",size:18,disabled:!u,onClick:()=>u&&a(e.id),"aria-label":g?"Collapse tree node":"Expand tree node",styles:{root:{minWidth:18,width:18,height:18,opacity:u?1:0}},children:s.jsx(G,{style:{width:0,height:0,borderTop:g?"7px solid light-dark(#1f2937, #e6edf3)":"6px solid transparent",borderBottom:g?"0 solid transparent":"6px solid transparent",borderLeft:g?"7px solid transparent":"9px solid light-dark(#1f2937, #e6edf3)",transform:g?"translateY(1px)":"translateX(1px)"}})}),s.jsx(We,{label:e.label,disabled:e.label.length<=28,withArrow:!0,children:s.jsx(G,{style:{flex:1,minWidth:0,maxWidth:"calc(100% - 48px)",cursor:"pointer",color:ll,marginLeft:6},onClick:()=>r(e),children:s.jsx(ue,{size:"md",fw:c?700:500,c:ll,truncate:"end",style:{display:"block",lineHeight:1.2},children:e.label})})}),h?s.jsx(ue,{size:"md",fw:500,c:cl,style:{marginLeft:8,flexShrink:0,minWidth:20,textAlign:"right"},children:e.count}):null,s.jsx(G,{style:{marginLeft:h?4:"auto",display:"flex",alignItems:"center"},children:m?s.jsxs(De,{shadow:"md",width:200,withinPortal:!0,children:[s.jsx(De.Target,{children:s.jsx(Ee,{variant:"transparent",color:"gray",size:18,"aria-label":"Open node actions",style:{color:cl},children:s.jsx(Ur,{size:14})})}),s.jsx(De.Dropdown,{children:Qw[e.kind]?.map(p=>s.jsx(De.Item,{color:p.color,leftSection:p.icon,onClick:()=>{if(i){i(e,p.label);return}Ue.show({title:p.label,message:`${p.label} for ${e.label} will be connected next.`,color:"fhcBlue"})},children:p.label},p.label))})]}):null})]})]}),u&&g?e.children?.map((p,f)=>s.jsx(Bd,{node:p,depth:n+1,selectedNodeId:t,expandedIds:o,toggleExpand:a,onSelect:r,onAction:i,ancestorHasNextSiblings:[...l,n>0?!d:!1],isLast:f===e.children.length-1},p.id)):null]})}function Xw({tree:e,search:n="",embedded:t=!1,selectedNodeId:o,onSelect:a,onAction:r}){const[i,l]=y.useState(new Set(e.flatMap(u=>[u.id,...u.children?.map(g=>g.id)]))),d=y.useMemo(()=>{const u=g=>g?.map(m=>{const h=u(m.children);return!ii(n,m.label)&&h.length===0?null:{...m,children:h}}).filter(m=>!!m);return u(e)},[n,e]);y.useEffect(()=>{const u=new Set;e.forEach(g=>{g.children.length>0&&u.add(g.id),g.children.forEach(m=>{m.children.length>0&&u.add(m.id)})}),l(u)},[e]);const c=u=>{l(g=>{const m=new Set(g);return m.has(u)?m.delete(u):m.add(u),m})};return s.jsx(Zt,{withBorder:!0,radius:t?0:"md",p:0,style:{height:"100%",background:"light-dark(#ffffff, #1a1b1e)",borderColor:t?"transparent":"light-dark(#d9e0e7, #2c2e33)",overflow:"hidden",boxShadow:t?"none":void 0},children:s.jsxs(fe,{gap:0,h:"100%",children:[s.jsxs(Fe,{gap:8,px:"sm",py:10,wrap:"nowrap",style:{borderBottom:"1px solid light-dark(#edf1f5, #2c2e33)"},children:[s.jsx(G,{c:"light-dark(#2f6fa3, #6ea8d8)",children:s.jsx(xc,{size:14,stroke:1.8})}),s.jsx(ue,{size:"sm",fw:700,c:"light-dark(#2f3d4a, #cbd5e1)",tt:"uppercase",children:"Department"})]}),s.jsx(G,{px:"sm",py:8,children:s.jsx(ue,{size:"sm",fw:700,c:"light-dark(#2f3d4a, #cbd5e1)",children:"All"})}),s.jsx(io,{type:"scroll",offsetScrollbars:!1,scrollbarSize:10,style:{flex:1},children:s.jsx(fe,{gap:2,px:"sm",pb:"md",children:d?.map((u,g)=>s.jsx(Bd,{node:u,depth:0,selectedNodeId:o,expandedIds:i,toggleExpand:c,onSelect:a,onAction:r,ancestorHasNextSiblings:[],isLast:g===d.length-1},u.id))})})]})})}function Zw({value:e,onChange:n,options:t}){return s.jsx(Zt,{withBorder:!0,radius:"md",p:4,style:{background:"light-dark(rgba(255,255,255,0.94), #1f2329)",borderColor:"light-dark(rgba(73, 106, 137, 0.12), rgba(255, 255, 255, 0.08))"},children:s.jsx(Fe,{gap:4,children:t?.map(o=>{const a=o.value===e;return s.jsx(We,{label:o.label,children:s.jsx(Ee,{variant:a?"filled":"subtle",color:a?"fhcBlue":"gray",size:"lg",radius:"sm","aria-label":o.label,onClick:()=>n(o.value),styles:{root:{background:a?"light-dark(var(--mantine-color-fhcBlue-1), var(--mantine-color-fhcBlue-9))":"transparent",color:a?"light-dark(var(--mantine-color-fhcBlue-7), var(--mantine-color-fhcBlue-2))":"light-dark(var(--mantine-color-gray-6), var(--mantine-color-gray-4))"}},children:o.icon})},o.value)})})})}const Jw=[{value:"cards",label:"Cards",icon:s.jsx(Xf,{size:16})},{value:"list",label:"List",icon:s.jsx(s0,{size:16})},{value:"compact",label:"Compact",icon:s.jsx(bc,{size:16})},{value:"organogram",label:"Organogram",icon:s.jsx($0,{size:16})},{value:"table",label:"Table",icon:s.jsx(k0,{size:16})}],Qn="light-dark(#ffffff, #1a1b1e)",e1="light-dark(#f7f8fa, #141517)",dl="light-dark(#f8fafc, #1f2329)",Xn="light-dark(rgba(73, 106, 137, 0.12), rgba(255, 255, 255, 0.08))",jn="light-dark(#0f172a, #f1f5f9)",Zn="light-dark(#64748b, #9ca3af)",Tn={background:"linear-gradient(180deg, rgba(61, 83, 131, 0.18) 0%, rgba(61, 83, 131, 0.62) 50%, rgba(61, 83, 131, 0.18) 100%)"},Ma={background:"linear-gradient(90deg, rgba(61, 83, 131, 0) 0%, rgba(61, 83, 131, 0.55) 18%, rgba(61, 83, 131, 0.55) 82%, rgba(61, 83, 131, 0) 100%)"},vs="#274c77";function xs({title:e,subtitle:n,accent:t="#3b82f6",meta:o,active:a=!1,icon:r,onClick:i,menuItems:l}){return s.jsxs(Zt,{withBorder:!0,radius:"lg",p:"md",onClick:i,style:{minWidth:0,cursor:i?"pointer":"default",position:"relative",overflow:"hidden",borderColor:a?"rgba(37, 99, 235, 0.34)":"rgba(45, 62, 111, 0.14)",background:"linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 100%)",boxShadow:a?"0 22px 44px rgba(37, 99, 235, 0.16)":"0 14px 32px rgba(15, 23, 42, 0.07)",transition:"transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease",transform:a?"translateY(-2px)":void 0},children:[s.jsx(G,{style:{position:"absolute",insetInline:0,top:0,height:4,background:`linear-gradient(90deg, ${t} 0%, rgba(255,255,255,0.92) 100%)`}}),s.jsxs(fe,{gap:10,align:"center",children:[s.jsxs(Fe,{justify:"space-between",align:"flex-start",wrap:"nowrap",style:{minWidth:0,width:"100%"},children:[s.jsxs(Fe,{gap:"sm",wrap:"nowrap",style:{minWidth:0,flex:1,justifyContent:"center"},children:[r?s.jsx(G,{style:{width:52,height:52,borderRadius:r&&typeof r!="string"?999:12,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:`linear-gradient(135deg, ${t}14 0%, rgba(255,255,255,0.96) 100%)`,color:t,overflow:"hidden",border:`1px solid ${t}33`,boxShadow:`inset 0 0 0 1px ${t}12`},children:r}):null,s.jsxs(fe,{gap:2,style:{minWidth:0,flex:1,alignItems:r?"flex-start":"center"},children:[s.jsx(nt,{variant:"light",radius:"xl",size:"sm",styles:{root:{background:`${t}14`,color:t,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.04em"}},children:n}),s.jsx(We,{label:e,disabled:e.length<=32,withArrow:!0,children:s.jsx(ue,{fw:800,c:jn,truncate:"end",ta:r?"left":"center",size:"lg",children:e})})]})]}),s.jsx(Fe,{gap:8,wrap:"nowrap",style:{flexShrink:0},children:l!=null&&l.length?s.jsxs(De,{shadow:"md",withinPortal:!0,position:"bottom-end",children:[s.jsx(De.Target,{children:s.jsx(Ee,{variant:"subtle",color:"gray",size:"sm",onClick:d=>d.stopPropagation(),style:{background:"rgba(148, 163, 184, 0.1)",color:Zn},children:s.jsx(Ur,{size:14})})}),s.jsx(De.Dropdown,{children:l?.map(d=>s.jsx(De.Item,{color:d.color,leftSection:d.icon,onClick:c=>{c.stopPropagation(),d.onClick()},children:d.label},d.label))})]}):null})]}),o?s.jsx(nt,{variant:"light",radius:"xl",color:"gray",w:"fit-content",styles:{root:{background:"rgba(148, 163, 184, 0.12)",color:Zn,fontWeight:700}},children:o}):null]})]})}function t1({organization:e,units:n,unit:t,selectedPosition:o,positions:a,members:r,unitExpanded:i,departmentsExpanded:l,onSelectOrganization:d,onSelectUnit:c,onSelectDepartment:u,onSelectEmployee:g,onNodeAction:m}){if(!e)return s.jsx(ao,{title:"Select an organization",description:"Choose an organization from the tree to generate the organogram view."});const h=t?a:[],p=(o==null?void 0:o.subPositions)??[],f=a.reduce((b,w)=>{var C;return b+(((C=w.subPositions)==null?void 0:C.length)??0)},0),v=[Re(e.name),t?Re(t.name):null,o?Re(o.name):null].filter(Boolean),x={id:e.id,label:Re(e.name),kind:"organization",children:[],raw:e};return s.jsxs(fe,{gap:"lg",style:{padding:"8px 12px 20px"},children:[s.jsx(Zt,{withBorder:!0,radius:"xl",p:"lg",style:{background:Qn,borderColor:Xn},children:s.jsxs(fe,{gap:"sm",children:[s.jsxs(Fe,{justify:"space-between",align:"center",wrap:"wrap",children:[s.jsxs(fe,{gap:2,children:[s.jsx(ue,{fw:800,size:"lg",c:jn,children:"Organizational Chart"}),s.jsx(ue,{size:"sm",c:Zn,children:"Click a node to expand or collapse its branch."})]}),s.jsxs(Fe,{gap:"sm",wrap:"wrap",children:[s.jsxs(nt,{size:"md",radius:"md",variant:"light",color:"gray",children:[h.length," department",h.length===1?"":"s"]}),s.jsxs(nt,{size:"md",radius:"md",variant:"light",color:"gray",children:[f," sub-department",f===1?"":"s"]}),s.jsxs(nt,{size:"md",radius:"md",variant:"light",color:"gray",children:[r.length," active employee",r.length===1?"":"s"]})]})]}),s.jsx(Fe,{gap:8,wrap:"wrap",children:v?.map((b,w)=>s.jsxs(Fe,{gap:8,wrap:"nowrap",children:[s.jsx(ue,{size:"sm",fw:w===v.length-1?700:600,c:w===v.length-1?jn:Zn,children:b}),w<v.length-1?s.jsx(Br,{size:14,color:"#94a3b8"}):null]},`${b}-${w}`))})]})}),s.jsxs(Zt,{withBorder:!0,radius:"xl",p:{base:"md",md:"xl"},style:{background:Qn,borderColor:Xn,position:"relative",overflow:"hidden"},children:[s.jsx(G,{style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px)",backgroundSize:"28px 28px",pointerEvents:"none"}}),s.jsxs(fe,{gap:"xl",align:"center",style:{position:"relative"},children:[s.jsxs(fe,{gap:"sm",align:"center",style:{width:"100%"},children:[s.jsx(G,{style:{width:"100%",maxWidth:360},children:s.jsx(xs,{title:Re(e.name),subtitle:"Organization",meta:`${i?n.length:0} visible unit${n.length===1?"":"s"}`,accent:vs,icon:s.jsx(xc,{size:22}),active:i,onClick:()=>d(e),menuItems:[{label:"Add Unit",icon:s.jsx(rn,{size:14}),onClick:()=>m(x,"Add Unit")},{label:"Edit Organization",icon:s.jsx(on,{size:14}),onClick:()=>m(x,"Edit Organization")},{label:"Delete Organization",icon:s.jsx(ln,{size:14}),color:"red",onClick:()=>m(x,"Delete Organization")}]})}),i&&n.length>0?s.jsx(G,{style:{width:2,height:42,...Tn}}):s.jsx(ue,{size:"sm",c:"dimmed",children:"Select a unit to expand the organization structure."})]}),i&&n.length>0?s.jsx(G,{style:{width:"100%"},children:s.jsx(G,{style:{maxWidth:1040,margin:"0 auto",paddingInline:16},children:s.jsx(bn,{cols:{base:1,md:Math.min(n.length,3)||1},spacing:"xl",children:n?.map(b=>{const w={id:b.id,label:Re(b.name),kind:"unit",children:[],parentId:e.id,raw:b},C=(t==null?void 0:t.id)===b.id;return s.jsxs(fe,{gap:0,align:"center",style:{width:"100%"},children:[s.jsx(G,{style:{width:"100%",maxWidth:320},children:s.jsx(xs,{title:Re(b.name),subtitle:"Unit",meta:C?`${h.length} department${h.length===1?"":"s"}`:"Click to expand",accent:vs,icon:s.jsx(Hf,{size:20}),active:C&&l,onClick:()=>c(b),menuItems:[{label:"Add Department",icon:s.jsx(rn,{size:14}),onClick:()=>m(w,"Add Department")},{label:"Edit Unit",icon:s.jsx(on,{size:14}),onClick:()=>m(w,"Edit Unit")},{label:"Delete Unit",icon:s.jsx(ln,{size:14}),color:"red",onClick:()=>m(w,"Delete Unit")}]})}),C&&l?s.jsx(s.Fragment,{children:s.jsx(G,{style:{width:2,height:34,marginTop:18,...Tn}})}):null]},b.id)})})})}):null,i&&t&&l&&h.length>0?s.jsx(G,{style:{width:"100%"},children:s.jsxs(G,{style:{maxWidth:1040,margin:"0 auto",paddingInline:16},children:[s.jsx(G,{style:{height:2,margin:"0 auto",...Ma}}),s.jsx(bn,{cols:{base:1,md:Math.min(h.length,3)||1},spacing:"xl",mt:"xl",children:h?.map(b=>{const w={id:b.id,label:Re(b.name),kind:"department",children:[],parentId:b.parentPositionId??void 0,raw:b},C=(o==null?void 0:o.id)===b.id?r:[];return s.jsxs(fe,{gap:0,align:"center",style:{minWidth:0},children:[s.jsx(G,{style:{width:2,height:28,...Tn}}),s.jsx(G,{style:{width:"100%",maxWidth:280},children:s.jsx(xs,{title:Re(b.name),subtitle:"Department",meta:`${C.length} employee${C.length===1?"":"s"}`,accent:vs,active:(o==null?void 0:o.id)===b.id,onClick:()=>u(b),menuItems:[{label:"Add User",icon:s.jsx(Gr,{size:14}),onClick:()=>m(w,"Add User")},{label:"Assign User",icon:s.jsx(Po,{size:14}),onClick:()=>m(w,"Assign User")},{label:"Add Sub-department",icon:s.jsx(rn,{size:14}),onClick:()=>m(w,"Add Sub-department")},{label:"Edit Department",icon:s.jsx(on,{size:14}),onClick:()=>m(w,"Edit Department")},{label:"Delete Department",icon:s.jsx(ln,{size:14}),color:"red",onClick:()=>m(w,"Delete Department")}]})}),(o==null?void 0:o.id)===b.id&&p.length>0?s.jsxs(s.Fragment,{children:[s.jsx(G,{style:{width:2,height:24,marginTop:18,...Tn}}),s.jsxs(G,{style:{width:"100%",maxWidth:560,marginTop:0},children:[s.jsx(G,{style:{height:2,...Ma}}),s.jsx(bn,{cols:{base:1,sm:Math.min(p.length,2)||1},spacing:"lg",mt:"lg",children:p?.map(j=>s.jsxs(fe,{gap:0,align:"center",children:[s.jsx(G,{style:{width:2,height:22,...Tn}}),s.jsx(G,{style:{width:"100%",maxWidth:240},children:s.jsx(xs,{title:Re(j.name),subtitle:"Sub-department",accent:vs,onClick:()=>u(j)})})]},j.id))})]})]}):null,(o==null?void 0:o.id)===b.id?s.jsxs(s.Fragment,{children:[s.jsx(G,{style:{width:2,height:28,marginTop:18,...Tn}}),C.length>0?s.jsxs(G,{style:{width:"100%",maxWidth:820},children:[C.length>1?s.jsx(G,{style:{height:2,marginInline:30,...Ma}}):null,s.jsx(bn,{cols:{base:1,md:Math.min(C.length,3)||1},spacing:"xl",mt:"xl",children:C?.map(j=>s.jsxs(fe,{gap:0,align:"center",children:[C.length>1?s.jsx(G,{style:{width:2,height:24,...Tn}}):null,s.jsx(G,{style:{width:"100%",maxWidth:240},children:s.jsx(xs,{title:Re(j.user.name),subtitle:j.user.userType||j.user.username||"Employee",meta:j.user.email||"No email",accent:vs,icon:s.jsx(mo,{size:44,radius:"xl",color:"fhcBlue",children:Re(j.user.name).charAt(0).toUpperCase()}),onClick:()=>g(j),menuItems:[{label:"View Details",icon:s.jsx(Hr,{size:14}),onClick:()=>g(j)}]})})]},j.id))})]}):s.jsx(ue,{mt:"md",size:"sm",c:Zn,children:"No employees assigned to this department yet."})]}):null]},b.id)})})]})}):i&&t&&l?s.jsx(ao,{title:"No departments to map",description:"This unit does not have department nodes available for the organogram yet."}):null]})]})]})}function ao({title:e="No team members found",description:n="Add team members to this department"}){return s.jsx(Zt,{radius:"lg",p:"xl",style:{background:e1,minHeight:220,display:"flex",alignItems:"center",justifyContent:"center"},children:s.jsxs(fe,{align:"center",gap:"xs",children:[s.jsx(Vr,{size:68,radius:"xl",variant:"light",color:"gray",children:s.jsx(I0,{size:34})}),s.jsx(ue,{fw:700,c:jn,children:e}),s.jsx(ue,{size:"sm",c:"dimmed",children:n})]})})}function Ra({member:e,compact:n=!1,onOpen:t}){const o=Re(e.user.name);return s.jsx(Zt,{withBorder:!0,radius:"md",p:n?"sm":"md",style:{cursor:"pointer",borderColor:Xn,background:Qn},onClick:()=>t(e),children:s.jsxs(Fe,{align:"flex-start",justify:"space-between",wrap:"nowrap",style:{minWidth:0},children:[s.jsxs(Fe,{align:"flex-start",gap:"md",wrap:"nowrap",style:{minWidth:0,flex:1},children:[s.jsx(mo,{size:n?54:78,radius:"md",color:"gray",style:{flexShrink:0},styles:{placeholder:{fontSize:n?18:28}},children:o.charAt(0).toUpperCase()}),s.jsxs(fe,{gap:n?2:5,style:{minWidth:0,flex:1},children:[s.jsx(ue,{fw:800,c:jn,truncate:"end",children:o}),s.jsx(ue,{size:"sm",c:"dimmed",truncate:"end",children:e.user.username||"Employee"}),s.jsx(ue,{size:"sm",c:"dimmed",truncate:"end",children:e.user.email||"No email"}),s.jsx(ue,{size:"sm",c:"dimmed",truncate:"end",children:e.user.phoneNumber||"No phone"}),s.jsxs(Fe,{gap:6,mt:n?4:8,wrap:"wrap",children:[s.jsx(nt,{color:"pink",variant:"light",children:e.status||e.user.status||"Pending"}),e.user.userType?s.jsx(nt,{color:"yellow",variant:"light",children:e.user.userType}):null]})]})]}),s.jsx(Ee,{variant:"light",color:"fhcGold",radius:"sm",onClick:a=>{a.stopPropagation(),t(e)},"aria-label":"Open employee",children:s.jsx(Hr,{size:15})})]})})}function n1(){var Ae,$e;const[e,n]=y.useState(""),[t,o]=y.useState(""),[a,r]=y.useState(""),[i,l]=y.useState(!1),[d,c]=y.useState(""),[u,g]=y.useState(""),[m,h]=y.useState(""),[p,f]=y.useState(""),[v,x]=y.useState(!1),[b,w]=y.useState(!0),[C,j]=y.useState(!0),[M,k]=y.useState(null),[S,T]=y.useState(!1),[N,F]=y.useState(null),[E,V]=y.useState(null),[L,B]=y.useState(null),[_,D]=y.useState(null),[O,P]=y.useState(null),[$,z]=y.useState(null),[H,ae]=y.useState(null),[ie,Q]=y.useState(null),[se,te]=y.useState(null),[Z,I]=y.useState(null),[Y,ce]=y.useState(null),[ee,W]=y.useState(null),[me,le]=y.useState("cards"),de=bw(),K=((Ae=de.data)==null?void 0:Ae.items)??[],A=Cw(d),ne=(($e=A.data)==null?void 0:$e.items)??[],be=Sw(u),ve=be.data??[],Se=Mw(m),we=Se.data??[],U=K.find(re=>re.id===d),q=ne.find(re=>re.id===u),oe=y.useMemo(()=>{const re=Ke=>{for(const Le of Ke){if(Le.id===m)return Le;const lt=re(Le.subPositions??[]);if(lt)return lt}};return re(ve)},[ve,m]),Ie=y.useMemo(()=>Yy({organizations:K,units:ne,positions:ve,selectedOrganizationId:d,selectedUnitId:u}),[K,ve,d,u,ne]),he=y.useMemo(()=>we.filter(re=>ii(e,Re(re.user.name),re.user.email,re.user.phoneNumber,re.user.username)),[we,e]),X=y.useMemo(()=>he?.map(re=>({id:re.id,name:Re(re.user.name),username:re.user.username||"Employee",email:re.user.email||"No email",phoneNumber:re.user.phoneNumber||"No phone",status:re.status||re.user.status||"Pending",userType:re.user.userType||"-",raw:re})),[he]),_e=y.useMemo(()=>[{accessorKey:"name",header:"Employee",size:240,Cell:({row:re})=>s.jsxs(fe,{gap:2,py:4,children:[s.jsx(ue,{fw:700,c:jn,children:re.original.name}),s.jsx(ue,{size:"sm",c:"dimmed",children:re.original.email})]})},{accessorKey:"username",header:"Username",size:160},{accessorKey:"phoneNumber",header:"Phone",size:170},{accessorKey:"userType",header:"Role",size:140,Cell:({row:re})=>s.jsx(nt,{color:"yellow",variant:"light",radius:"xl",children:re.original.userType})},{accessorKey:"status",header:"Status",size:130,Cell:({row:re})=>s.jsx(nt,{variant:"light",radius:"xl",color:re.original.status.toLowerCase()==="active"?"green":"pink",children:re.original.status})}],[]);["UserManagement",U?Re(U.name):null,q?Re(q.name):null,oe?Re(oe.name):null].filter(Boolean);const Oe=de.error||A.error||be.error||Se.error,Xe=re=>{if(f(re.id),k(null),re.kind==="organization"){const Ke=re.raw;c(Ke.id),g(""),h(""),w(!0),j(!0);return}if(re.kind==="unit"){const Ke=re.raw;g(Ke.id),h(""),w(!0),j(!0);return}w(!0),j(!0),h(re.id)},ot=(re,Ke)=>{const Le=Ke.trim().toLowerCase(),lt=re.raw,It=re.kind==="organization"||"activeEmployeeCount"in lt||"isSuperAdmin"in lt,at=re.kind==="unit"||"organizationId"in lt&&"parentUnitId"in lt,kn=re.kind==="department"||"unitId"in lt&&"subPositions"in lt;if(It){const it=re.raw;if(Le==="add unit"){F({organizationId:re.id,organizationLabel:re.label});return}if(Le==="edit organization"){V(it);return}if(Le==="delete organization"){B(it);return}}if(at){const it=re.raw;if(Le==="add department"){z(it);return}if(Le==="edit unit"){D(it);return}if(Le==="delete unit"){P(it);return}}if(kn){const it=re.raw;if(Le==="add user"){ae(it);return}if(Le==="assign user"){Q(it);return}if(Le==="add sub-department"){te(it);return}if(Le==="edit department"){I(it);return}if(Le==="move department"){ce(it);return}if(Le==="delete department"){W(it);return}}Ue.show({title:Ke,message:`${Ke} for ${re.label} will be connected next.`,color:"fhcBlue"})},et=he.length,J=et>0?`1-${et} / ${et}`:"0-0 / 0";return s.jsxs(s.Fragment,{children:[s.jsxs(fe,{gap:"lg",children:[Oe?s.jsx(wo,{color:"red",variant:"light",icon:s.jsx(Yf,{size:16}),radius:"lg",children:Oe.message||"We could not load user-management data from the backend."}):null,s.jsx(Zt,{withBorder:!0,radius:"xl",p:0,style:{minHeight:"calc(100vh - 230px)",background:Qn,borderColor:Xn,overflow:"hidden"},children:s.jsxs(Fe,{align:"stretch",gap:0,wrap:"nowrap",style:{minHeight:"calc(100vh - 230px)"},children:[s.jsx(G,{style:{width:v?56:360,minWidth:v?56:360,transition:"width 180ms ease, min-width 180ms ease",overflow:"hidden",background:Qn},children:v?s.jsxs(fe,{h:"100%",align:"center",justify:"flex-start",gap:"sm",py:"md",children:[s.jsx(Ee,{variant:"light",color:"gray",radius:"xl",onClick:()=>x(!1),"aria-label":"Expand department panel",children:s.jsx(t0,{size:16})}),s.jsx(ue,{size:"xs",fw:700,c:"dimmed",tt:"uppercase",style:{writingMode:"vertical-rl",transform:"rotate(180deg)",letterSpacing:"0.08em"},children:"Department"})]}):s.jsx(G,{h:"100%",style:{minHeight:"calc(100vh - 230px)"},children:s.jsx(Xw,{tree:Ie,search:a,embedded:!0,selectedNodeId:p,onSelect:Xe,onAction:ot})})}),s.jsx(G,{style:{width:1,minWidth:1,background:Xn}}),s.jsx(G,{style:{flex:1,minWidth:0,minHeight:"calc(100vh - 230px)"},children:s.jsxs(fe,{gap:"md",h:"100%",p:"md",children:[s.jsxs(Fe,{justify:"space-between",align:"center",wrap:"nowrap",gap:"md",children:[s.jsxs(Fe,{gap:"sm",wrap:"nowrap",style:{minWidth:0,flex:1},children:[v?null:s.jsx(Ee,{variant:"light",color:"gray",radius:"xl",onClick:()=>x(!0),"aria-label":"Collapse department panel",children:s.jsx(Jf,{size:16})}),s.jsx(pt,{leftSection:s.jsx(rn,{size:16}),radius:"md",disabled:!m,onClick:()=>oe?ae(oe):null,children:"New"}),s.jsx(ue,{size:"xl",fw:600,c:jn,children:"Employees"}),s.jsx(Ee,{variant:"subtle",color:"gray",children:s.jsx(C0,{size:16})}),me!=="organogram"?s.jsxs(Fe,{gap:8,wrap:"nowrap",style:{minWidth:0,overflow:"hidden"},children:[s.jsx(nt,{color:"fhcBlue",variant:"light",radius:"xl",children:oe?Re(oe.name):"No department selected"}),q?s.jsx(nt,{color:"fhcGold",variant:"light",radius:"xl",children:Re(q.name)}):null,U?s.jsx(nt,{color:"gray",variant:"light",radius:"xl",children:Re(U.name)}):null]}):null]}),s.jsxs(Fe,{gap:"sm",wrap:"nowrap",justify:"flex-end",style:{flexShrink:0},children:[i?s.jsx(qe,{value:t,onChange:re=>o(re.currentTarget.value),onKeyDown:re=>{re.key==="Enter"&&r(t.trim())},placeholder:"Search tree...",leftSection:s.jsx(ys,{size:14}),radius:"xl",size:"sm",autoFocus:!0,w:200,styles:{input:{height:38,borderColor:"rgba(73, 106, 137, 0.14)",background:dl,color:"var(--mantine-color-fhcGray-8)"}}}):null,s.jsx(We,{label:"Search department tree",children:s.jsx(Ee,{variant:i?"filled":"light",color:"fhcBlue",radius:"xl",size:"lg",onClick:()=>{if(i){t.trim().length===0?(r(""),l(!1)):r(t.trim());return}l(!0)},children:s.jsx(cf,{size:16})})}),s.jsx(pt,{variant:"light",leftSection:s.jsx(ys,{size:16}),color:"fhcBlue",size:"sm",radius:"xl",disabled:!d,onClick:()=>T(!0),children:"Search Employees"}),s.jsx(We,{label:"Export endpoint is not yet available in the live Swagger contract.",children:s.jsx(pt,{variant:"subtle",leftSection:s.jsx(Ff,{size:15}),disabled:!0,color:"gray",size:"sm",radius:"xl",children:"Export"})}),s.jsx(Ee,{variant:"light",color:"fhcBlue",size:"lg",radius:"xl",onClick:()=>{de.refetch(),A.refetch(),be.refetch(),Se.refetch()},children:s.jsx(yc,{size:18})}),s.jsx(qe,{value:e,onChange:re=>n(re.currentTarget.value),placeholder:"Search...",leftSection:s.jsx(ys,{size:16}),radius:"md",w:260,disabled:!m}),s.jsx(ue,{size:"sm",c:"dimmed",children:J}),s.jsx(Zw,{value:me,onChange:le,options:Jw})]})]}),me==="organogram"?s.jsx(Fe,{gap:8,wrap:"wrap",children:[U?Re(U.name):null,q?Re(q.name):null,oe?Re(oe.name):null].filter(Boolean)?.map((re,Ke,Le)=>s.jsxs(Fe,{gap:8,wrap:"nowrap",children:[s.jsx(ue,{size:"sm",fw:Ke===Le.length-1?700:600,c:Ke===Le.length-1?jn:Zn,children:re}),Ke<Le.length-1?s.jsx(Br,{size:14,color:"#94a3b8"}):null]},`${re}-${Ke}`))}):null,s.jsx(yr,{}),me!=="organogram"&&Se.isLoading&&m?s.jsx(Fe,{justify:"center",py:"xl",children:s.jsx(Rs,{size:"sm"})}):me!=="organogram"&&!m?s.jsx(ao,{title:"Select a department",description:d?"Choose a department from the tree to load its related team members. For users like Super Admin without a department assignment, click Search All Employees.":"Choose an organization first, then a unit, then a department."}):me!=="organogram"&&he.length===0?s.jsx(ao,{title:"No team members found",description:"Add team members to this department."}):s.jsx(G,{style:{flex:1,minHeight:0,overflowY:"auto",overflowX:"hidden"},children:me==="organogram"?s.jsx(t1,{organization:U,units:ne,unit:q,selectedPosition:oe,positions:ve,members:he,unitExpanded:b,departmentsExpanded:C,onSelectOrganization:re=>{d!==re.id?(f(re.id),c(re.id),g(""),h(""),w(!0),j(!0)):(w(Ke=>{const Le=!Ke;return Le||j(!1),Le}),b||j(!0)),k(null)},onSelectUnit:re=>{u!==re.id?(f(re.id),g(re.id),h(""),w(!0),j(!0)):j(Ke=>!Ke),k(null)},onSelectDepartment:re=>{f(re.id),w(!0),j(!0),h(Ke=>Ke===re.id?"":re.id),k(null)},onSelectEmployee:k,onNodeAction:ot}):me==="table"?s.jsx(Iy,{columns:_e,data:X,loading:Se.isLoading,emptyMessage:"No employees found",enableRowActions:!0,positionActionsColumn:"last",renderRowActions:({row:re})=>s.jsx(Ee,{variant:"light",color:"fhcGold",radius:"sm",onClick:()=>k(re.original.raw),"aria-label":"Open employee",children:s.jsx(Hr,{size:15})}),mantineTableBodyRowProps:({row:re})=>({onClick:()=>k(re.original.raw),style:{cursor:"pointer"}}),options:{rowSelection:!1,topToolbar:!1,bottomToolbar:!1,filters:!1,globalFilter:!1,columnFilters:!1,densityToggle:!1,fullScreenToggle:!1,columnActions:!1,columnOrdering:!1,columnResizing:!1,sorting:!1,hiding:!1,pagination:!1},mantinePaperProps:{radius:"lg",withBorder:!0,style:{borderColor:Xn,overflow:"hidden",background:Qn}},mantineTableContainerProps:{style:{overflowX:"hidden"}},mantineTableProps:{striped:"odd",highlightOnHover:!0,withTableBorder:!1,withColumnBorders:!1,fz:"sm",style:{tableLayout:"fixed",width:"100%"}},mantineTableHeadCellProps:{style:{background:dl,color:"#1f2937",fontWeight:700,borderBottom:"1px solid rgba(73, 106, 137, 0.12)"}},mantineTableBodyCellProps:{style:{borderTop:"1px solid rgba(73, 106, 137, 0.08)",verticalAlign:"middle"}}}):s.jsx(s.Fragment,{children:me==="cards"?s.jsx(bn,{cols:{base:1,xl:2},spacing:"md",children:he?.map(re=>s.jsx(Ra,{member:re,onOpen:k},re.id))}):s.jsx(fe,{gap:"md",children:he?.map(re=>me==="compact"?s.jsxs(Fe,{wrap:"nowrap",gap:"sm",px:"xs",children:[s.jsx(bc,{size:16,color:"#94a3b8"}),s.jsx(G,{style:{flex:1,minWidth:0},children:s.jsx(Ra,{member:re,compact:!0,onOpen:k})})]},re.id):s.jsx(Ra,{member:re,compact:!0,onOpen:k},re.id))})})})]})})]})})]}),s.jsx(Qy,{employee:M,opened:!!M,onClose:()=>k(null)}),s.jsx(Kw,{organizationId:d,organizationLabel:U?Re(U.name):void 0,opened:S,onClose:()=>T(!1),onSelectEmployee:k}),s.jsx(Aw,{opened:!!N,organizationId:N==null?void 0:N.organizationId,organizationLabel:N==null?void 0:N.organizationLabel,onClose:()=>F(null),onCreated:()=>{de.refetch(),N!=null&&N.organizationId&&A.refetch()}}),s.jsx(Hw,{opened:!!E,organization:E,onClose:()=>V(null),onUpdated:()=>{de.refetch()}}),s.jsx(Vw,{opened:!!L,organization:L,onClose:()=>B(null),onDeleted:()=>{const re=L==null?void 0:L.id;de.refetch(),re&&d===re&&(c(""),g(""),h(""),f(""),k(null))}}),s.jsx(zw,{opened:!!$,unit:$,onClose:()=>z(null)}),s.jsx(Ow,{opened:!!H,department:H,onClose:()=>ae(null)}),s.jsx(Lw,{opened:!!ie,department:ie,onClose:()=>Q(null)}),s.jsx($w,{opened:!!se,department:se,onClose:()=>te(null)}),s.jsx(Gw,{opened:!!Z,department:Z,onClose:()=>I(null)}),s.jsx(Ww,{opened:!!Y,department:Y,positions:ve,onClose:()=>ce(null)}),s.jsx(Bw,{opened:!!ee,department:ee,onClose:()=>W(null),onDeleted:()=>{ee&&m===ee.id&&(h(""),f(u))}}),s.jsx(qw,{opened:!!_,unit:_,onClose:()=>D(null)}),s.jsx(Uw,{opened:!!O,unit:O,onClose:()=>P(null),onDeleted:()=>{O&&u===O.id&&(g(""),h(""),f(O.organizationId))}})]})}function Q1(){return yu()==="classic"?s.jsx(n1,{}):s.jsx("div",{className:"p-6",children:s.jsx(Vp,{})})}export{Q1 as default};