obeyaka-ui 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var nt=Object.create;var Xe=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty;var at=(n,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of ot(r))!st.call(n,a)&&a!==o&&Xe(n,a,{get:()=>r[a],enumerable:!(s=tt(r,a))||s.enumerable});return n};var $e=(n,r,o)=>(o=n!=null?nt(rt(n)):{},at(r||!n||!n.__esModule?Xe(o,"default",{value:n,enumerable:!0}):o,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),t=require("@mantine/core"),C=require("@tabler/icons-react"),Ce=require("@emoji-mart/data"),nn=require("emoji-mart"),ge=require("@mantine/hooks"),it=require("@mantine/notifications"),ct=require("@mantine/modals"),lt=require("@mantine/dates"),K=u.memo(({onClick:n,icon:r,changeIconOnHover:o=!1,iconHovered:s,iconColor:a="var(--mantine-color-gray-7)",size:i="md",variant:c="transparent",bg:d,disabled:l=!1,loading:f=!1,tooltip:h,"aria-label":g,className:x,style:y,onMouseEnter:p,onMouseLeave:m,...I})=>{const[b,v]=u.useState(!1),S=u.useCallback(()=>{l||f||(n==null||n(),console.log("Clicked"))},[l,f,n]),w=u.useMemo(()=>({xs:14,sm:16,md:20,lg:24,xl:28})[i]||20,[i]),B=u.useMemo(()=>({xs:2,sm:2,md:2,lg:2,xl:2.5})[i]||2,[i]),M=u.useCallback(E=>{v(!0),p==null||p(E)},[p]),k=u.useCallback(E=>{v(!1),m==null||m(E)},[m]),j=u.useMemo(()=>{if(d)return d;if(c==="transparent")return b?"var(--mantine-color-gray-2)":"transparent"},[d,c,b]),R=u.useMemo(()=>o&&s&&b?s:r,[o,s,b,r]),D=u.useMemo(()=>e.jsx(R,{size:w,strokeWidth:B,color:a}),[R,w,B,a]),O=e.jsx(t.ActionIcon,{onClick:S,bg:j,color:a,radius:"md",variant:c==="transparent"?"transparent":c,size:i,disabled:l||f,loading:f,onMouseEnter:M,onMouseLeave:k,"aria-label":g||h,className:x,style:y,...I,children:D});return h&&!l&&!f?e.jsx(t.Tooltip,{label:h,position:"top",withArrow:!0,children:O}):O});K.displayName="ActionButton";const dt=n=>{const r={xs:{width:28,height:28,fontSize:16},sm:{width:32,height:32,fontSize:24},md:{width:36,height:36,fontSize:32},lg:{width:40,height:40,fontSize:40},xl:{width:44,height:44,fontSize:44},xxl:{width:48,height:48,fontSize:48}};return typeof n=="number"?{width:n,height:n,fontSize:n-8}:r[n]},tn=({emoji:n,size:r="lg",editable:o=!1,onClick:s,className:a,style:i})=>{const c=dt(r),d=o&&s;return e.jsx(t.Box,{className:a,style:{...c,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:d?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:d?s:void 0,onMouseEnter:l=>{d&&(l.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:l=>{d&&(l.currentTarget.style.backgroundColor="transparent")},children:e.jsx(t.Box,{style:{fontSize:c.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:n})})},he=n=>{if(typeof n=="number")return n;switch(n){case"xs":return 24;case"sm":return 32;case"md":return 48;case"lg":return 64;case"xl":return 80;default:return 64}},le=new Map,ut=["IconUser","IconHeart","IconStar","IconSmile","IconSun","IconMoon","IconCamera","IconMusic","IconCode","IconBriefcase","IconHome","IconSearch","IconSettings","IconMail","IconPhone","IconBell","IconBookmark","IconCalendar","IconClock","IconDownload","IconEdit","IconEye","IconFile","IconFolder","IconImage","IconLink","IconLock","IconMessage","IconPlus","IconShare","IconThumbUp","IconTrash"],ft=async()=>{try{const n=await import("@tabler/icons-react");ut.forEach(r=>{if(!le.has(r)){const o=n[r];o&&le.set(r,o)}})}catch(n){console.warn("Error preloading common icons:",n)}};ft();const ht=async n=>{if(le.has(n))return le.get(n);try{const s=(await import("@tabler/icons-react"))[n]||C.IconQuestionMark;return le.set(n,s),s}catch{return le.set(n,C.IconQuestionMark),C.IconQuestionMark}},pt=n=>n.replace(/^Icon/,"").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase()),on=u.memo(({iconName:n,onClick:r,size:o=20})=>{const[s,a]=u.useState(null),[i,c]=u.useState(!0),d=u.useRef(null),l=u.useRef(!0);u.useEffect(()=>(l.current=!0,(async()=>{try{const x=(await import("@tabler/icons-react"))[n];l.current&&(a(x?()=>x:C.IconQuestionMark),c(!1))}catch{l.current&&(a(()=>C.IconQuestionMark),c(!1))}})(),()=>{l.current=!1}),[n]);const f=()=>{i||r()};return i?e.jsx(t.Box,{ref:d,style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"var(--mantine-radius-sm)"},children:e.jsx(t.Skeleton,{width:o,height:o})}):e.jsx(t.Tooltip,{label:pt(n),position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{ref:d,onClick:f,style:{width:"40px",height:"40px",fontSize:`${o}px`,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",transition:"all 0.2s ease",cursor:i?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},onMouseEnter:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",h.currentTarget.style.transform="scale(1.05)")},onMouseLeave:h=>{i||(h.currentTarget.style.backgroundColor="transparent",h.currentTarget.style.transform="scale(1)")},onMouseDown:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)",h.currentTarget.style.transform="scale(0.95)")},onMouseUp:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",h.currentTarget.style.transform="scale(1.05)")},children:s&&e.jsx(s,{size:o,color:"var(--mantine-color-gray-7)"})})})});on.displayName="IconButton";const rn=u.memo(({iconName:n,size:r="lg",style:o,withBorder:s=!1,radius:a="md",onClick:i,onMouseEnter:c,onMouseLeave:d})=>{const[l,f]=u.useState(!1),[h,g]=u.useState(()=>le.get(n)||null),x=he(r),y=Math.round(x*.9);u.useEffect(()=>{if(le.has(n)){g(()=>le.get(n));return}let m=!0;return ht(n).then(I=>{m&&g(()=>I)}),()=>{m=!1}},[n]);const p=()=>typeof a=="number"?a:`var(--mantine-radius-${a})`;return h?e.jsx(t.Box,{style:{width:`${x}px !important`,height:`${x}px !important`,minWidth:`${x}px`,minHeight:`${x}px`,maxWidth:`${x}px`,maxHeight:`${x}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:p(),cursor:i?"pointer":"default",border:s?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:l?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...o},onClick:i,onMouseEnter:m=>{f(!0),c==null||c(m)},onMouseLeave:m=>{f(!1),d==null||d(m)},children:e.jsx(h,{size:y,color:"var(--mantine-color-gray-8)"})}):e.jsx(t.Box,{style:{width:`${x}px !important`,height:`${x}px !important`,minWidth:`${x}px`,minHeight:`${x}px`,maxWidth:`${x}px`,maxHeight:`${x}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:p(),cursor:i?"pointer":"default",border:s?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:l?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...o},onClick:i,onMouseEnter:m=>{f(!0),c==null||c(m)},onMouseLeave:m=>{f(!1),d==null||d(m)}})});rn.displayName="IconAvatar";const xt=n=>{const r={xs:{width:28,height:28},sm:{width:32,height:32},md:{width:36,height:36},lg:{width:40,height:40},xl:{width:44,height:44},xxl:{width:48,height:48}};return typeof n=="number"?{width:n,height:n}:r[n]},sn=({iconName:n,size:r="lg",editable:o=!1,onClick:s,className:a,style:i})=>{const c=xt(r),d=o&&s;return e.jsx(t.Box,{className:a,style:{...c,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:d?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:d?s:void 0,onMouseEnter:l=>{d&&(l.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:l=>{d&&(l.currentTarget.style.backgroundColor="transparent")},children:e.jsx(t.Box,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:e.jsx(rn,{iconName:n,size:c.width,onClick:void 0})})})},mt=n=>{const r={xs:{width:28,height:28},sm:{width:32,height:32},md:{width:36,height:36},lg:{width:40,height:40},xl:{width:44,height:44},xxl:{width:48,height:48}};return typeof n=="number"?{width:n,height:n}:r[n]},an=({src:n,size:r="lg",editable:o=!1,onClick:s,className:a,style:i,loading:c=!1,alt:d="Avatar"})=>{const[l,f]=u.useState(!1),h=mt(r),g=o&&s,x=()=>{f(!0)},y=()=>{f(!1)};return e.jsx(t.Box,{className:a,style:{...h,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:g?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:g?s:void 0,onMouseEnter:p=>{g&&(p.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:p=>{g&&(p.currentTarget.style.backgroundColor="transparent")},children:c?e.jsx(t.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):!l&&e.jsx("img",{src:n,alt:d,style:{width:"100%",height:"100%",objectFit:"cover"},onError:x,onLoad:y})})},gt=n=>{const r={xs:{width:28,height:28,fontSize:14},sm:{width:32,height:32,fontSize:16},md:{width:36,height:36,fontSize:20},lg:{width:40,height:40,fontSize:24},xl:{width:44,height:44,fontSize:32},xxl:{width:48,height:48,fontSize:36}};return typeof n=="number"?{width:n,height:n,fontSize:n*.5}:r[n]},Me=({text:n="?",size:r="lg",editable:o=!1,onClick:s,className:a,style:i,loading:c=!1})=>{const d=gt(r),l=o&&s;return e.jsx(t.Box,{className:a,style:{...d,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:l?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"var(--mantine-color-gray-1)",...i},onClick:l?s:void 0,onMouseEnter:f=>{l&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-3)")},onMouseLeave:f=>{l&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)")},children:c?e.jsx(t.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):e.jsx(t.Box,{style:{fontSize:d.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:650,color:"var(--mantine-color-gray-7)"},children:n})})},cn=n=>{if(!n)return"";const r=["de","del","la","las","los","y","el","en","con"],s=n.trim().split(/\s+/).filter(a=>!r.includes(a.toLowerCase())).map(a=>{var i;return((i=a[0])==null?void 0:i.toUpperCase())||""}).filter(Boolean).slice(0,2).join("");return s.length===1?s+s:s.length===0?n.slice(0,2).toUpperCase():s},se=({avatar:n,size:r="lg",loading:o=!1,onClick:s,className:a,style:i,showPlaceholder:c=!0,placeholder:d,editable:l=!1})=>{const f=()=>{if(n)switch(n.type){case"emoji":return e.jsx(tn,{emoji:n.value,size:r,editable:l,onClick:s});case"icon":return e.jsx(sn,{iconName:n.value,size:r,editable:l,onClick:s});case"image":return e.jsx(an,{src:n.value,size:r,editable:l,onClick:s})}if(c){const g=d?cn(d):"?";return e.jsx(Me,{text:g,size:r,editable:l,onClick:s})}return null};if(o)return e.jsx(Me,{size:r,loading:!0,className:a,style:i});const h=f();return h?e.jsx("div",{className:a,style:i,children:h}):null},Te=({label:n,onClick:r,isActive:o=!1})=>{const[s,a]=u.useState(!1);return e.jsx(t.Box,{onClick:r,bg:s||o?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),h:28,style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",padding:"0px 10px",cursor:"pointer"},children:e.jsx(t.Text,{fw:500,fz:"sm",truncate:"end",c:"var(--mantine-color-gray-9)",children:n})})},It=new URL("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTUiIGhlaWdodD0iNTYiIHZpZXdCb3g9IjAgMCA1NSA1NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMC43NUg1NVY1NS43NUgwVjAuNzVaIiBmaWxsPSIjRjZGNUY0Ii8+CjxwYXRoIGQ9Ik04LjgwMDI5IDM0LjYzQzguODAwMjkgMzQuMTQ0IDkuMTk0MjggMzMuNzUgOS42ODAyOSAzMy43NUgxOC45MjAzQzE5LjQwNjMgMzMuNzUgMTkuODAwMyAzNC4xNDQgMTkuODAwMyAzNC42M1Y0My44N0MxOS44MDAzIDQ0LjM1NiAxOS40MDYzIDQ0Ljc1IDE4LjkyMDMgNDQuNzVIOS42ODAyOUM5LjE5NDI4IDQ0Ljc1IDguODAwMjkgNDQuMzU2IDguODAwMjkgNDMuODdWMzQuNjNaIiBmaWxsPSIjRkZDQTAwIi8+CjxwYXRoIGQ9Ik0yMi4wMDAyIDIzLjYzQzIyLjAwMDIgMjMuMTQ0IDIyLjM5NDIgMjIuNzUgMjIuODgwMiAyMi43NUgzMi4xMjAyQzMyLjYwNjMgMjIuNzUgMzMuMDAwMiAyMy4xNDQgMzMuMDAwMiAyMy42M1Y0My44N0MzMy4wMDAyIDQ0LjM1NiAzMi42MDYzIDQ0Ljc1IDMyLjEyMDIgNDQuNzVIMjIuODgwMkMyMi4zOTQyIDQ0Ljc1IDIyLjAwMDIgNDQuMzU2IDIyLjAwMDIgNDMuODdWMjMuNjNaIiBmaWxsPSIjMzdDRTkxIi8+CjxwYXRoIGQ9Ik0zNS4yMDAyIDEyLjYzQzM1LjIwMDIgMTIuMTQ0IDM1LjU5NDIgMTEuNzUgMzYuMDgwMiAxMS43NUg0NS4zMjAyQzQ1LjgwNjIgMTEuNzUgNDYuMjAwMiAxMi4xNDQgNDYuMjAwMiAxMi42M1Y0My44N0M0Ni4yMDAyIDQ0LjM1NiA0NS44MDYyIDQ0Ljc1IDQ1LjMyMDIgNDQuNzVIMzYuMDgwMkMzNS41OTQyIDQ0Ljc1IDM1LjIwMDIgNDQuMzU2IDM1LjIwMDIgNDMuODdWMTIuNjNaIiBmaWxsPSIjRkIzNzU3Ii8+CjxwYXRoIGQ9Ik04LjgwMDA1IDE3LjI1QzguODAwMDUgMTQuMjEyNCAxMS4yNjI1IDExLjc1IDE0LjMgMTEuNzVDMTcuMzM3NiAxMS43NSAxOS44IDE0LjIxMjQgMTkuOCAxNy4yNUMxOS44IDIwLjI4NzYgMTcuMzM3NiAyMi43NSAxNC4zIDIyLjc1QzExLjI2MjUgMjIuNzUgOC44MDAwNSAyMC4yODc2IDguODAwMDUgMTcuMjVaIiBmaWxsPSIjMDA3MkZGIi8+Cjwvc3ZnPgo=",self.location).href,ln=({appName:n="Obeyaka",size:r="md",showText:o=!0,color:s="var(--mantine-color-dark-6)",radius:a})=>{const i=()=>{switch(r){case"xs":return{icon:24,text:"xs"};case"sm":return{icon:24,text:"md"};case"md":return{icon:28,text:"lg"};case"lg":return{icon:32,text:"xl"};default:return{icon:36,text:"lg"}}},c=()=>{switch(a){case"full":return"9999px";case"xs":return"var(--mantine-radius-xs)";case"sm":return"var(--mantine-radius-sm)";case"md":return"var(--mantine-radius-md)";case"lg":return"var(--mantine-radius-lg)";case"xl":return"var(--mantine-radius-xl)";default:return 0}},{icon:d,text:l}=i(),f=()=>{const h=d*56/55;return e.jsx("img",{src:It,alt:`${n} Logo`,width:d,height:h,style:{display:"block",flexShrink:0,borderRadius:c()}})};return e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[f(),o&&e.jsx(t.Text,{size:l,fw:700,c:s==="white"?"white":s,style:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, sans-serif"},children:n})]})},Be=({value:n,label:r,onChange:o,placeholder:s="Click to edit...",disabled:a=!1,bgColor:i="gray",size:c="md",radius:d="sm",className:l="",style:f,showEditBorder:h=!0,editBorderColor:g="#228be6",selectOnFocus:x=!1,pageTitle:y=!1,onHover:p=I=>{},...m})=>{const[I,b]=u.useState(!1),[v,S]=u.useState(n),[w,B]=u.useState(!1);u.useEffect(()=>{p(w)},[w,p]);const M=u.useRef(null),k={fontSize:"40px",fontWeight:700,color:"var(--mantine-color-gray-9)",border:"none",outline:"none",backgroundColor:"transparent",padding:"0",minHeight:"5rem"};u.useEffect(()=>{S(n)},[n]);const j=()=>{a||(b(!0),x&&M.current&&M.current.select())},R=()=>{b(!1),v!==n&&o(v)},D=P=>{S(P.target.value)},O=P=>{var L,V;P.key==="Enter"?(b(!1),o(v),(L=M.current)==null||L.blur()):P.key==="Escape"&&(S(n),b(!1),(V=M.current)==null||V.blur())},E={cursor:a?"not-allowed":"text"},N={backgroundColor:i==="gray"?"var(--mantine-color-gray-0)":i==="white"?"var(--mantine-color-white)":void 0,borderColor:I&&h?g:void 0,borderWidth:I&&h?"2px":void 0,transition:"border-color 0.2s ease-in-out, border-width 0.2s ease-in-out",color:"var(--mantine-color-gray-9)"},$=()=>y?{...N,...k}:N;return e.jsx(t.InputWrapper,{label:r,size:c,children:e.jsx(t.Input,{ref:M,value:v,onChange:D,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),onFocus:j,onBlur:R,onKeyDown:O,placeholder:s,disabled:a,size:c,fw:500,radius:d,className:l,style:{...E,...f},styles:{input:{...$()}},...m})})},dn=({value:n,label:r,onChange:o,placeholder:s="Click to edit...",disabled:a=!1,bgColor:i="gray",size:c="md",radius:d="md",className:l="",style:f,showEditBorder:h=!0,editBorderColor:g="#228be6",selectOnFocus:x=!1,minRows:y=1,maxRows:p,autosize:m=!0,onHover:I=S=>{},pageTitle:b=!1,...v})=>{const[S,w]=u.useState(!1),[B,M]=u.useState(n),[k,j]=u.useState(!1);u.useEffect(()=>{I(k)},[k,I]);const R=u.useRef(null);u.useEffect(()=>{M(n)},[n]);const D=()=>{const G=R.current;G&&(G.style.height="0px",G.style.minHeight="0px",G.style.overflowY="hidden",G.style.height=`${G.scrollHeight}px`)};u.useEffect(()=>{m&&D()},[m]),u.useEffect(()=>{m&&D()},[B,m]);const O=()=>{a||(w(!0),m&&requestAnimationFrame(()=>D()),x&&R.current&&R.current.select())},E=()=>{w(!1),B!==n&&o(B)},N=G=>{M(G.target.value)},$=G=>{var H;G.key==="Escape"&&(M(n),w(!1),(H=R.current)==null||H.blur())},P={cursor:a?"not-allowed":"text"},L={borderRadius:"var(--mantine-radius-md)",backgroundColor:i==="gray"?"var(--mantine-color-gray-0)":i==="white"?"transparent":void 0,borderColor:S&&h?g:void 0,borderWidth:S&&h?"1px":void 0,color:"var(--mantine-color-gray-9)",width:"100%",fontWeight:450},V={fontSize:"40px",fontWeight:700,color:"var(--mantine-color-gray-9)",border:"none",outline:"none",backgroundColor:"transparent",padding:"0",lineHeight:"3rem"},U=()=>b?{...L,...V}:L;return e.jsx(t.InputWrapper,{label:r,c:"var(--mantine-color-gray-9)",size:c,children:e.jsx(t.Textarea,{w:"100%",radius:"var(--mantine-radius-md)",ref:R,value:B,onChange:N,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),onFocus:O,onBlur:E,onKeyDown:$,placeholder:s,disabled:a,size:c,fw:450,className:l,style:{...P,...f},styles:{input:{...U(),overflowY:m?"hidden":void 0,resize:m?"none":void 0}},autosize:m,minRows:y,maxRows:p,...v})})},un=({expandDirection:n="right",placeholder:r="Type to search",value:o="",onChange:s,onSearch:a,onClear:i,size:c="md",disabled:d=!1,className:l})=>{const[f,h]=u.useState(!1),[g,x]=u.useState(!1),[y,p]=u.useState(o),m=u.useRef(null),I=u.useRef(null);u.useEffect(()=>{p(o)},[o]),u.useEffect(()=>{f&&m.current&&m.current.focus()},[f]),u.useEffect(()=>{const j=R=>{I.current&&!I.current.contains(R.target)&&b()};if(f)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[f]);const b=()=>{x(!0),setTimeout(()=>{h(!1),x(!1)},200)},v=()=>{d||h(!0)},S=j=>{const R=j.target.value;p(R),s==null||s(R)},w=j=>{j.key==="Enter"&&(a==null||a(y)),j.key==="Escape"&&b()},B=()=>{p(""),s==null||s(""),i==null||i(),b()},k=(()=>{switch(c){case"sm":return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-sm)"};case"lg":return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-md)"};default:return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-sm)"}}})();return e.jsxs(t.Box,{ref:I,className:l,style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[e.jsxs(t.Group,{gap:0,style:{position:"relative",transition:"all 0.2s ease",borderRadius:"var(--mantine-radius-md)"},children:[e.jsx(t.Box,{onClick:v,style:{display:"flex",alignItems:"center",justifyContent:"center",width:k.inputHeight,height:k.inputHeight,cursor:d?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",opacity:d?.5:1},onMouseEnter:j=>{d||(j.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(C.IconSearch,{size:k.iconSize,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),f&&e.jsx(t.TextInput,{ref:m,value:y,onChange:S,onKeyDown:w,placeholder:r,disabled:d,height:k.inputHeight,fw:500,styles:{root:{position:"relative",animation:g?`shrink${n==="right"?"Right":"Left"} 0.2s ease forwards`:`expand${n==="right"?"Right":"Left"} 0.2s ease forwards`},input:{border:"none",outline:"none",backgroundColor:"transparent",padding:"0 8px",height:k.inputHeight,minHeight:k.inputHeight,fontSize:k.fontSize,color:"var(--mantine-color-gray-8)",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",display:"flex",alignItems:"center","&:hover":{backgroundColor:"var(--mantine-color-gray-1)"},"&:focus":{backgroundColor:"var(--mantine-color-gray-1)"},"&::placeholder":{color:"var(--mantine-color-gray-5)"}}},rightSection:y&&e.jsx(t.Box,{onClick:B,style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"4px",borderRadius:"var(--mantine-radius-xl)",transition:"background-color 0.2s ease"},onMouseEnter:j=>{j.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)"},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(C.IconX,{size:14,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),rightSectionWidth:y?24:0})]}),e.jsx("style",{children:`
1
+ "use strict";var tt=Object.create;var Ke=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var st=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var it=(n,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of rt(r))!at.call(n,a)&&a!==o&&Ke(n,a,{get:()=>r[a],enumerable:!(s=ot(r,a))||s.enumerable});return n};var He=(n,r,o)=>(o=n!=null?tt(st(n)):{},it(r||!n||!n.__esModule?Ke(o,"default",{value:n,enumerable:!0}):o,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),t=require("@mantine/core"),k=require("@tabler/icons-react"),Me=require("@emoji-mart/data"),tn=require("emoji-mart"),Ie=require("@mantine/hooks"),ct=require("@mantine/notifications"),lt=require("@mantine/modals"),dt=require("@mantine/dates"),ee=u.memo(({onClick:n,icon:r,changeIconOnHover:o=!1,iconHovered:s,iconColor:a="var(--mantine-color-gray-7)",size:i="md",variant:c="transparent",bg:d,disabled:l=!1,loading:f=!1,tooltip:h,"aria-label":g,className:p,style:y,onMouseEnter:x,onMouseLeave:m,...I})=>{const[b,v]=u.useState(!1),S=u.useCallback(()=>{l||f||(n==null||n(),console.log("Clicked"))},[l,f,n]),w=u.useMemo(()=>({xs:14,sm:16,md:20,lg:24,xl:28})[i]||20,[i]),B=u.useMemo(()=>({xs:2,sm:2,md:2,lg:2,xl:2.5})[i]||2,[i]),M=u.useCallback(E=>{v(!0),x==null||x(E)},[x]),C=u.useCallback(E=>{v(!1),m==null||m(E)},[m]),j=u.useMemo(()=>{if(d)return d;if(c==="transparent")return b?"var(--mantine-color-gray-2)":"transparent"},[d,c,b]),R=u.useMemo(()=>o&&s&&b?s:r,[o,s,b,r]),D=u.useMemo(()=>e.jsx(R,{size:w,strokeWidth:B,color:a}),[R,w,B,a]),O=e.jsx(t.ActionIcon,{onClick:S,bg:j,color:a,radius:"md",variant:c==="transparent"?"transparent":c,size:i,disabled:l||f,loading:f,onMouseEnter:M,onMouseLeave:C,"aria-label":g||h,className:p,style:y,...I,children:D});return h&&!l&&!f?e.jsx(t.Tooltip,{label:h,position:"top",withArrow:!0,children:O}):O});ee.displayName="ActionButton";const ut=n=>{const r={xs:{width:28,height:28,fontSize:16},sm:{width:32,height:32,fontSize:24},md:{width:36,height:36,fontSize:32},lg:{width:40,height:40,fontSize:40},xl:{width:44,height:44,fontSize:44},xxl:{width:48,height:48,fontSize:48}};return typeof n=="number"?{width:n,height:n,fontSize:n-8}:r[n]},on=({emoji:n,size:r="lg",editable:o=!1,onClick:s,className:a,style:i})=>{const c=ut(r),d=o&&s;return e.jsx(t.Box,{className:a,style:{...c,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:d?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:d?s:void 0,onMouseEnter:l=>{d&&(l.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:l=>{d&&(l.currentTarget.style.backgroundColor="transparent")},children:e.jsx(t.Box,{style:{fontSize:c.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:n})})},he=n=>{if(typeof n=="number")return n;switch(n){case"xs":return 24;case"sm":return 32;case"md":return 48;case"lg":return 64;case"xl":return 80;default:return 64}},le=new Map,ft=["IconUser","IconHeart","IconStar","IconSmile","IconSun","IconMoon","IconCamera","IconMusic","IconCode","IconBriefcase","IconHome","IconSearch","IconSettings","IconMail","IconPhone","IconBell","IconBookmark","IconCalendar","IconClock","IconDownload","IconEdit","IconEye","IconFile","IconFolder","IconImage","IconLink","IconLock","IconMessage","IconPlus","IconShare","IconThumbUp","IconTrash"],ht=async()=>{try{const n=await import("@tabler/icons-react");ft.forEach(r=>{if(!le.has(r)){const o=n[r];o&&le.set(r,o)}})}catch(n){console.warn("Error preloading common icons:",n)}};ht();const pt=async n=>{if(le.has(n))return le.get(n);try{const s=(await import("@tabler/icons-react"))[n]||k.IconQuestionMark;return le.set(n,s),s}catch{return le.set(n,k.IconQuestionMark),k.IconQuestionMark}},xt=n=>n.replace(/^Icon/,"").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase()),rn=u.memo(({iconName:n,onClick:r,size:o=20})=>{const[s,a]=u.useState(null),[i,c]=u.useState(!0),d=u.useRef(null),l=u.useRef(!0);u.useEffect(()=>(l.current=!0,(async()=>{try{const p=(await import("@tabler/icons-react"))[n];l.current&&(a(p?()=>p:k.IconQuestionMark),c(!1))}catch{l.current&&(a(()=>k.IconQuestionMark),c(!1))}})(),()=>{l.current=!1}),[n]);const f=()=>{i||r()};return i?e.jsx(t.Box,{ref:d,style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"var(--mantine-radius-sm)"},children:e.jsx(t.Skeleton,{width:o,height:o})}):e.jsx(t.Tooltip,{label:xt(n),position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{ref:d,onClick:f,style:{width:"40px",height:"40px",fontSize:`${o}px`,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",transition:"all 0.2s ease",cursor:i?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},onMouseEnter:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",h.currentTarget.style.transform="scale(1.05)")},onMouseLeave:h=>{i||(h.currentTarget.style.backgroundColor="transparent",h.currentTarget.style.transform="scale(1)")},onMouseDown:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)",h.currentTarget.style.transform="scale(0.95)")},onMouseUp:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",h.currentTarget.style.transform="scale(1.05)")},children:s&&e.jsx(s,{size:o,color:"var(--mantine-color-gray-7)"})})})});rn.displayName="IconButton";const sn=u.memo(({iconName:n,size:r="lg",style:o,withBorder:s=!1,radius:a="md",onClick:i,onMouseEnter:c,onMouseLeave:d})=>{const[l,f]=u.useState(!1),[h,g]=u.useState(()=>le.get(n)||null),p=he(r),y=Math.round(p*.9);u.useEffect(()=>{if(le.has(n)){g(()=>le.get(n));return}let m=!0;return pt(n).then(I=>{m&&g(()=>I)}),()=>{m=!1}},[n]);const x=()=>typeof a=="number"?a:`var(--mantine-radius-${a})`;return h?e.jsx(t.Box,{style:{width:`${p}px !important`,height:`${p}px !important`,minWidth:`${p}px`,minHeight:`${p}px`,maxWidth:`${p}px`,maxHeight:`${p}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:x(),cursor:i?"pointer":"default",border:s?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:l?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...o},onClick:i,onMouseEnter:m=>{f(!0),c==null||c(m)},onMouseLeave:m=>{f(!1),d==null||d(m)},children:e.jsx(h,{size:y,color:"var(--mantine-color-gray-8)"})}):e.jsx(t.Box,{style:{width:`${p}px !important`,height:`${p}px !important`,minWidth:`${p}px`,minHeight:`${p}px`,maxWidth:`${p}px`,maxHeight:`${p}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:x(),cursor:i?"pointer":"default",border:s?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:l?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...o},onClick:i,onMouseEnter:m=>{f(!0),c==null||c(m)},onMouseLeave:m=>{f(!1),d==null||d(m)}})});sn.displayName="IconAvatar";const mt=n=>{const r={xs:{width:28,height:28},sm:{width:32,height:32},md:{width:36,height:36},lg:{width:40,height:40},xl:{width:44,height:44},xxl:{width:48,height:48}};return typeof n=="number"?{width:n,height:n}:r[n]},an=({iconName:n,size:r="lg",editable:o=!1,onClick:s,className:a,style:i})=>{const c=mt(r),d=o&&s;return e.jsx(t.Box,{className:a,style:{...c,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:d?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:d?s:void 0,onMouseEnter:l=>{d&&(l.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:l=>{d&&(l.currentTarget.style.backgroundColor="transparent")},children:e.jsx(t.Box,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:e.jsx(sn,{iconName:n,size:c.width,onClick:void 0})})})},gt=n=>{const r={xs:{width:28,height:28},sm:{width:32,height:32},md:{width:36,height:36},lg:{width:40,height:40},xl:{width:44,height:44},xxl:{width:48,height:48}};return typeof n=="number"?{width:n,height:n}:r[n]},cn=({src:n,size:r="lg",editable:o=!1,onClick:s,className:a,style:i,loading:c=!1,alt:d="Avatar"})=>{const[l,f]=u.useState(!1),h=gt(r),g=o&&s,p=()=>{f(!0)},y=()=>{f(!1)};return e.jsx(t.Box,{className:a,style:{...h,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:g?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:g?s:void 0,onMouseEnter:x=>{g&&(x.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:x=>{g&&(x.currentTarget.style.backgroundColor="transparent")},children:c?e.jsx(t.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):!l&&e.jsx("img",{src:n,alt:d,style:{width:"100%",height:"100%",objectFit:"cover"},onError:p,onLoad:y})})},It=n=>{const r={xs:{width:28,height:28,fontSize:14},sm:{width:32,height:32,fontSize:16},md:{width:36,height:36,fontSize:20},lg:{width:40,height:40,fontSize:24},xl:{width:44,height:44,fontSize:32},xxl:{width:48,height:48,fontSize:36}};return typeof n=="number"?{width:n,height:n,fontSize:n*.5}:r[n]},Te=({text:n="?",size:r="lg",editable:o=!1,onClick:s,className:a,style:i,loading:c=!1})=>{const d=It(r),l=o&&s;return e.jsx(t.Box,{className:a,style:{...d,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:l?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"var(--mantine-color-gray-1)",...i},onClick:l?s:void 0,onMouseEnter:f=>{l&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-3)")},onMouseLeave:f=>{l&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)")},children:c?e.jsx(t.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):e.jsx(t.Box,{style:{fontSize:d.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:650,color:"var(--mantine-color-gray-7)"},children:n})})},ln=n=>{if(!n)return"";const r=["de","del","la","las","los","y","el","en","con"],s=n.trim().split(/\s+/).filter(a=>!r.includes(a.toLowerCase())).map(a=>{var i;return((i=a[0])==null?void 0:i.toUpperCase())||""}).filter(Boolean).slice(0,2).join("");return s.length===1?s+s:s.length===0?n.slice(0,2).toUpperCase():s},se=({avatar:n,size:r="lg",loading:o=!1,onClick:s,className:a,style:i,showPlaceholder:c=!0,placeholder:d,editable:l=!1})=>{const f=()=>{if(n)switch(n.type){case"emoji":return e.jsx(on,{emoji:n.value,size:r,editable:l,onClick:s});case"icon":return e.jsx(an,{iconName:n.value,size:r,editable:l,onClick:s});case"image":return e.jsx(cn,{src:n.value,size:r,editable:l,onClick:s})}if(c){const g=d?ln(d):"?";return e.jsx(Te,{text:g,size:r,editable:l,onClick:s})}return null};if(o)return e.jsx(Te,{size:r,loading:!0,className:a,style:i});const h=f();return h?e.jsx("div",{className:a,style:i,children:h}):null},Be=({label:n,onClick:r,isActive:o=!1})=>{const[s,a]=u.useState(!1);return e.jsx(t.Box,{onClick:r,bg:s||o?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),h:28,style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",padding:"0px 10px",cursor:"pointer"},children:e.jsx(t.Text,{fw:500,fz:"sm",truncate:"end",c:"var(--mantine-color-gray-9)",children:n})})},yt=new URL("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTUiIGhlaWdodD0iNTYiIHZpZXdCb3g9IjAgMCA1NSA1NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMC43NUg1NVY1NS43NUgwVjAuNzVaIiBmaWxsPSIjRjZGNUY0Ii8+CjxwYXRoIGQ9Ik04LjgwMDI5IDM0LjYzQzguODAwMjkgMzQuMTQ0IDkuMTk0MjggMzMuNzUgOS42ODAyOSAzMy43NUgxOC45MjAzQzE5LjQwNjMgMzMuNzUgMTkuODAwMyAzNC4xNDQgMTkuODAwMyAzNC42M1Y0My44N0MxOS44MDAzIDQ0LjM1NiAxOS40MDYzIDQ0Ljc1IDE4LjkyMDMgNDQuNzVIOS42ODAyOUM5LjE5NDI4IDQ0Ljc1IDguODAwMjkgNDQuMzU2IDguODAwMjkgNDMuODdWMzQuNjNaIiBmaWxsPSIjRkZDQTAwIi8+CjxwYXRoIGQ9Ik0yMi4wMDAyIDIzLjYzQzIyLjAwMDIgMjMuMTQ0IDIyLjM5NDIgMjIuNzUgMjIuODgwMiAyMi43NUgzMi4xMjAyQzMyLjYwNjMgMjIuNzUgMzMuMDAwMiAyMy4xNDQgMzMuMDAwMiAyMy42M1Y0My44N0MzMy4wMDAyIDQ0LjM1NiAzMi42MDYzIDQ0Ljc1IDMyLjEyMDIgNDQuNzVIMjIuODgwMkMyMi4zOTQyIDQ0Ljc1IDIyLjAwMDIgNDQuMzU2IDIyLjAwMDIgNDMuODdWMjMuNjNaIiBmaWxsPSIjMzdDRTkxIi8+CjxwYXRoIGQ9Ik0zNS4yMDAyIDEyLjYzQzM1LjIwMDIgMTIuMTQ0IDM1LjU5NDIgMTEuNzUgMzYuMDgwMiAxMS43NUg0NS4zMjAyQzQ1LjgwNjIgMTEuNzUgNDYuMjAwMiAxMi4xNDQgNDYuMjAwMiAxMi42M1Y0My44N0M0Ni4yMDAyIDQ0LjM1NiA0NS44MDYyIDQ0Ljc1IDQ1LjMyMDIgNDQuNzVIMzYuMDgwMkMzNS41OTQyIDQ0Ljc1IDM1LjIwMDIgNDQuMzU2IDM1LjIwMDIgNDMuODdWMTIuNjNaIiBmaWxsPSIjRkIzNzU3Ii8+CjxwYXRoIGQ9Ik04LjgwMDA1IDE3LjI1QzguODAwMDUgMTQuMjEyNCAxMS4yNjI1IDExLjc1IDE0LjMgMTEuNzVDMTcuMzM3NiAxMS43NSAxOS44IDE0LjIxMjQgMTkuOCAxNy4yNUMxOS44IDIwLjI4NzYgMTcuMzM3NiAyMi43NSAxNC4zIDIyLjc1QzExLjI2MjUgMjIuNzUgOC44MDAwNSAyMC4yODc2IDguODAwMDUgMTcuMjVaIiBmaWxsPSIjMDA3MkZGIi8+Cjwvc3ZnPgo=",self.location).href,dn=({appName:n="Obeyaka",size:r="md",showText:o=!0,color:s="var(--mantine-color-dark-6)",radius:a})=>{const i=()=>{switch(r){case"xs":return{icon:24,text:"xs"};case"sm":return{icon:24,text:"md"};case"md":return{icon:28,text:"lg"};case"lg":return{icon:32,text:"xl"};default:return{icon:36,text:"lg"}}},c=()=>{switch(a){case"full":return"9999px";case"xs":return"var(--mantine-radius-xs)";case"sm":return"var(--mantine-radius-sm)";case"md":return"var(--mantine-radius-md)";case"lg":return"var(--mantine-radius-lg)";case"xl":return"var(--mantine-radius-xl)";default:return 0}},{icon:d,text:l}=i(),f=()=>{const h=d*56/55;return e.jsx("img",{src:yt,alt:`${n} Logo`,width:d,height:h,style:{display:"block",flexShrink:0,borderRadius:c()}})};return e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[f(),o&&e.jsx(t.Text,{size:l,fw:700,c:s==="white"?"white":s,style:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, sans-serif"},children:n})]})},Oe=({value:n,label:r,onChange:o,placeholder:s="Click to edit...",disabled:a=!1,bgColor:i="gray",size:c="md",radius:d="sm",className:l="",style:f,showEditBorder:h=!0,editBorderColor:g="#228be6",selectOnFocus:p=!1,pageTitle:y=!1,onHover:x=I=>{},...m})=>{const[I,b]=u.useState(!1),[v,S]=u.useState(n),[w,B]=u.useState(!1);u.useEffect(()=>{x(w)},[w,x]);const M=u.useRef(null),C={fontSize:"40px",fontWeight:700,color:"var(--mantine-color-gray-9)",border:"none",outline:"none",backgroundColor:"transparent",padding:"0",minHeight:"5rem"};u.useEffect(()=>{S(n)},[n]);const j=()=>{a||(b(!0),p&&M.current&&M.current.select())},R=()=>{b(!1),v!==n&&o(v)},D=U=>{S(U.target.value)},O=U=>{var L,F;U.key==="Enter"?(b(!1),o(v),(L=M.current)==null||L.blur()):U.key==="Escape"&&(S(n),b(!1),(F=M.current)==null||F.blur())},E={cursor:a?"not-allowed":"text"},N={backgroundColor:i==="gray"?"var(--mantine-color-gray-0)":i==="white"?"var(--mantine-color-white)":void 0,borderColor:I&&h?g:void 0,borderWidth:I&&h?"2px":void 0,transition:"border-color 0.2s ease-in-out, border-width 0.2s ease-in-out",color:"var(--mantine-color-gray-9)"},H=()=>y?{...N,...C}:N;return e.jsx(t.InputWrapper,{label:r,size:c,children:e.jsx(t.Input,{ref:M,value:v,onChange:D,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),onFocus:j,onBlur:R,onKeyDown:O,placeholder:s,disabled:a,size:c,fw:500,radius:d,className:l,style:{...E,...f},styles:{input:{...H()}},...m})})},un=({value:n,label:r,onChange:o,placeholder:s="Click to edit...",disabled:a=!1,bgColor:i="gray",size:c="md",radius:d="md",className:l="",style:f,showEditBorder:h=!0,editBorderColor:g="#228be6",selectOnFocus:p=!1,minRows:y=1,maxRows:x,autosize:m=!0,onHover:I=S=>{},pageTitle:b=!1,...v})=>{const[S,w]=u.useState(!1),[B,M]=u.useState(n),[C,j]=u.useState(!1);u.useEffect(()=>{I(C)},[C,I]);const R=u.useRef(null);u.useEffect(()=>{M(n)},[n]);const D=()=>{const G=R.current;G&&(G.style.height="0px",G.style.minHeight="0px",G.style.overflowY="hidden",G.style.height=`${G.scrollHeight}px`)};u.useEffect(()=>{m&&D()},[m]),u.useEffect(()=>{m&&D()},[B,m]);const O=()=>{a||(w(!0),m&&requestAnimationFrame(()=>D()),p&&R.current&&R.current.select())},E=()=>{w(!1),B!==n&&o(B)},N=G=>{M(G.target.value)},H=G=>{var X;G.key==="Escape"&&(M(n),w(!1),(X=R.current)==null||X.blur())},U={cursor:a?"not-allowed":"text"},L={borderRadius:"var(--mantine-radius-md)",backgroundColor:i==="gray"?"var(--mantine-color-gray-0)":i==="white"?"transparent":void 0,borderColor:S&&h?g:void 0,borderWidth:S&&h?"1px":void 0,color:"var(--mantine-color-gray-9)",width:"100%",fontWeight:450},F={fontSize:"40px",fontWeight:700,color:"var(--mantine-color-gray-9)",border:"none",outline:"none",backgroundColor:"transparent",padding:"0",lineHeight:"3rem"},W=()=>b?{...L,...F}:L;return e.jsx(t.InputWrapper,{label:r,c:"var(--mantine-color-gray-9)",size:c,children:e.jsx(t.Textarea,{w:"100%",radius:"var(--mantine-radius-md)",ref:R,value:B,onChange:N,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),onFocus:O,onBlur:E,onKeyDown:H,placeholder:s,disabled:a,size:c,fw:450,className:l,style:{...U,...f},styles:{input:{...W(),overflowY:m?"hidden":void 0,resize:m?"none":void 0}},autosize:m,minRows:y,maxRows:x,...v})})},me=u.memo(({icon:n,iconOnHover:r,size:o="md",color:s="var(--mantine-color-gray-9)",grayScaleBaseColor:a,disabled:i=!1,tooltip:c,...d})=>{const l=()=>a||a===0?`var(--mantine-color-gray-${a})`:"transparent",f=()=>a||a===0?`var(--mantine-color-gray-${a+1})`:"var(--mantine-color-gray-0)",h=x=>x==="md"?{height:28,iconSize:20}:x==="sm"?{height:24,iconSize:16}:{height:28,iconSize:20},[g,p]=u.useState(!1),y=g&&r&&!i?e.jsx(r,{size:h(o).iconSize,strokeWidth:2,color:s}):e.jsx(n,{size:h(o).iconSize,strokeWidth:2,color:s,opacity:i?.5:1});return e.jsxs(t.ActionIcon,{size:h(o).height,radius:"md",onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),bg:g&&!i?f():l(),disabled:i,...d,children:[c&&!i&&e.jsx(t.Tooltip,{label:c,position:"top",withArrow:!0,openDelay:300,children:y}),!c&&y]})}),fn=({expandDirection:n="right",placeholder:r="Type to search",value:o="",onChange:s,onSearch:a,onClear:i,size:c="md",disabled:d=!1,className:l})=>{const[f,h]=u.useState(!1),[g,p]=u.useState(!1),[y,x]=u.useState(o),m=u.useRef(null),I=u.useRef(null);u.useEffect(()=>{x(o)},[o]),u.useEffect(()=>{f&&m.current&&m.current.focus()},[f]),u.useEffect(()=>{const j=R=>{I.current&&!I.current.contains(R.target)&&b()};if(f)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[f]);const b=()=>{p(!0),setTimeout(()=>{h(!1),p(!1)},200)},v=()=>{d||h(!0)},S=j=>{const R=j.target.value;x(R),s==null||s(R)},w=j=>{j.key==="Enter"&&(a==null||a(y)),j.key==="Escape"&&b()},B=()=>{x(""),s==null||s(""),i==null||i(),b()},C=(()=>{switch(c){case"sm":return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-sm)"};case"lg":return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-md)"};default:return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-sm)"}}})();return e.jsxs(t.Box,{ref:I,className:l,style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[e.jsxs(t.Group,{gap:0,style:{position:"relative",transition:"all 0.2s ease",borderRadius:"var(--mantine-radius-md)"},children:[e.jsx(t.Box,{onClick:v,style:{display:"flex",alignItems:"center",justifyContent:"center",width:C.inputHeight,height:C.inputHeight,cursor:d?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",opacity:d?.5:1},onMouseEnter:j=>{d||(j.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(k.IconSearch,{size:C.iconSize,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),f&&e.jsx(t.TextInput,{ref:m,value:y,onChange:S,onKeyDown:w,placeholder:r,disabled:d,height:C.inputHeight,fw:500,styles:{root:{position:"relative",animation:g?`shrink${n==="right"?"Right":"Left"} 0.2s ease forwards`:`expand${n==="right"?"Right":"Left"} 0.2s ease forwards`},input:{border:"none",outline:"none",backgroundColor:"transparent",padding:"0 8px",height:C.inputHeight,minHeight:C.inputHeight,fontSize:C.fontSize,color:"var(--mantine-color-gray-8)",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",display:"flex",alignItems:"center","&:hover":{backgroundColor:"var(--mantine-color-gray-1)"},"&:focus":{backgroundColor:"var(--mantine-color-gray-1)"},"&::placeholder":{color:"var(--mantine-color-gray-5)"}}},rightSection:y&&e.jsx(t.Box,{onClick:B,style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"4px",borderRadius:"var(--mantine-radius-xl)",transition:"background-color 0.2s ease"},onMouseEnter:j=>{j.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)"},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(k.IconX,{size:14,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),rightSectionWidth:y?24:0})]}),e.jsx("style",{children:`
2
2
  @keyframes expandRight {
3
3
  from { width: 0; opacity: 0; }
4
4
  to { width: 200px; opacity: 1; }
@@ -15,4 +15,4 @@
15
15
  from { width: 200px; opacity: 1; }
16
16
  to { width: 0; opacity: 0; }
17
17
  }
18
- `})]})},Oe=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="md",filterButtonDropdownPosition:a="bottom-end"})=>{const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),[c,d]=u.useState(!1),l=n.length>0,f=m=>{if(m==="remove-filters")r([]);else{const I=o==null?void 0:o.find(b=>b.value===m);if(I){const b={id:`${I.value}-${Date.now()}`,filterOption:I};r([...n,b])}}i.closeDropdown()},h=(o||[]).filter(m=>!n.some(I=>I.filterOption.value===m.value)),g={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},y=(()=>{switch(s){case"sm":return{height:"32px",width:"32px",iconSize:20};case"md":return{height:"32px",width:"32px",iconSize:20};default:return{height:"32px",width:"32px",iconSize:20}}})(),p=e.jsx(t.Box,{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:l||c?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",transition:"all 0.2s ease",...y},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:()=>i.toggleDropdown(),children:e.jsx(C.IconFilter,{size:20,stroke:2.3})});return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,children:[e.jsx(t.Combobox.Target,{children:l?e.jsx(t.Indicator,{offset:2,position:"top-end",color:"var(--mantine-color-yellow-7)",children:p}):p}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",width:"auto",minWidth:"160px"}},children:e.jsxs(t.Combobox.Options,{children:[h.map(m=>e.jsx(t.Combobox.Option,{value:m.value,style:{...g},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.icon,m.label]})},m.value)),l&&e.jsx(t.Combobox.Option,{value:"remove-filters",style:{borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",fontWeight:"500",color:"var(--mantine-color-red-6)"},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(C.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},yt=({filterTag:n,onUpdate:r,onRemove:o,options:s=[],filterTagDropdownPosition:a="bottom-start"})=>{var x;const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),c=!!n.selectedOption,d=c?`${n.filterOption.label}: ${(x=n.selectedOption)==null?void 0:x.label}`:n.filterOption.label,l=s&&s.length>0?s:[{value:"option-a",label:"TagFilterOptionA"},{value:"option-b",label:"TagFilterOptionB"},{value:"option-c",label:"TagFilterOptionC"}],f=y=>{if(y==="remove")o();else{const p=l.find(m=>m.value===y);p&&r({...n,selectedOption:p})}i.closeDropdown()},h={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},g={display:"inline-flex",alignItems:"center",gap:"4px",backgroundColor:c?"var(--mantine-color-blue-0)":"var(--mantine-color-gray-0)",color:c?"var(--mantine-color-blue-7)":"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-xl)",cursor:"pointer",transition:"all 0.2s ease",height:"32px",fontSize:"var(--mantine-font-size-sm)",padding:"0 12px"};return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,middlewares:{flip:!1,shift:!0},children:[e.jsx(t.Combobox.Target,{children:e.jsxs(t.Box,{style:{...g},onClick:()=>i.toggleDropdown(),fw:500,pl:"sm",children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px"},children:[n.filterOption.icon,d]}),e.jsx(C.IconChevronDown,{size:16,strokeWidth:2,color:"var(--mantine-color-gray-5)"})]})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",minWidth:"150px"}},children:e.jsxs(t.Combobox.Options,{children:[l.map(y=>{var p;return e.jsx(t.Combobox.Option,{value:y.value,active:((p=n.selectedOption)==null?void 0:p.value)===y.value,style:{...h},children:y.label},y.value)}),e.jsx(t.Combobox.Option,{value:"remove",style:{borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",fontWeight:"500",color:"var(--mantine-color-red-6)"},children:"Or remove filter"})]})})]})},vt=({activeFilters:n,onFiltersChange:r,availableFilters:o,addFilterButtonDropdownPosition:s="bottom-start"})=>{const a=t.useCombobox({onDropdownClose:()=>a.resetSelectedOption(),onDropdownOpen:()=>a.updateSelectedOptionIndex("active")}),[i,c]=u.useState(!1),d=x=>{const y=o==null?void 0:o.find(p=>p.value===x);if(y){const p={id:`${y.value}-${Date.now()}`,filterOption:y};r([...n,p])}a.closeDropdown()},l=(o||[]).filter(x=>!n.some(y=>y.filterOption.value===x.value)),f={display:"inline-flex",alignItems:"center",backgroundColor:i?"var(--mantine-color-gray-0)":"transparent",borderRadius:"var(--mantine-radius-xl)",cursor:"pointer",transition:"all 0.2s ease",border:"1px solid transparent",height:"32px",fontSize:"var(--mantine-font-size-sm)",padding:"0 12px"},h={dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",width:"auto",minWidth:"120px"}},g={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"};return e.jsxs(t.Combobox,{store:a,onOptionSubmit:d,withinPortal:!1,offset:4,position:s,children:[e.jsx(t.Combobox.Target,{children:e.jsx(t.Box,{style:{...f},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:()=>a.toggleDropdown(),children:e.jsx(t.Box,{style:{fontWeight:"500",color:"var(--mantine-color-blue-6)"},children:"Add filter"})})}),e.jsx(t.Combobox.Dropdown,{styles:{...h},children:e.jsx(t.Combobox.Options,{children:l.map(x=>e.jsx(t.Combobox.Option,{value:x.value,style:{...g},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[x.icon,x.label]})},x.value))})})]})},ze=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="sm",getFilterOptions:a,filterTagDropdownPosition:i="bottom-start"})=>{const c=f=>{const h=(n||[]).map(g=>g.id===f.id?f:g);r(h)},d=f=>{const h=(n||[]).filter(g=>g.id!==f);r(h)},l=(o||[]).filter(f=>!n.some(h=>h.filterOption.value===f.value));return!n||n.length===0?null:e.jsx("div",{style:{width:"100%"},children:e.jsxs(t.Group,{gap:"sm",align:"center",wrap:"wrap",children:[(n||[]).map(f=>{const h=a?a(f.filterOption.value)||[]:[];return e.jsx(yt,{filterTag:f,onUpdate:c,onRemove:()=>d(f.id),size:s,options:h,filterTagDropdownPosition:i},f.id)}),l.length>0&&e.jsx(vt,{activeFilters:n,onFiltersChange:r,availableFilters:l,size:s})]})})},jt=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="md",getFilterOptions:a,filterTagDropdownPosition:i="bottom-start"})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsx(Oe,{activeFilters:n,onFiltersChange:r,availableFilters:o,size:s}),e.jsx(ze,{activeFilters:n,onFiltersChange:r,availableFilters:o,size:"sm",getFilterOptions:a,filterTagDropdownPosition:i})]}),bt=Object.assign(jt,{Button:Oe,Filters:ze}),wt=({children:n,danger:r,active:o,...s})=>e.jsx(t.MenuItem,{...s,style:{borderRadius:"8px",color:o?"var(--mantine-color-blue-7)":r?"var(--mantine-color-red-9)":"var(--mantine-color-gray-9)",backgroundColor:o?"var(--mantine-color-blue-0)":"transparent",...s.style},children:n}),Ie=({trigger:n,menuItems:r,children:o,...s})=>{const a=u.useRef(null),[i,c]=u.useState(0);return u.useEffect(()=>{a.current&&c(a.current.offsetWidth)},[n]),e.jsxs(t.Menu,{...s,children:[e.jsx(t.Menu.Target,{children:e.jsx("div",{ref:a,onClick:d=>d.stopPropagation(),style:{cursor:"pointer",outline:"none",boxShadow:"none",display:"flex",alignItems:"center"},children:n})}),e.jsxs(t.Menu.Dropdown,{styles:{dropdown:{cursor:"pointer",borderRadius:"8px",minWidth:`${i}px`}},children:[o,r==null?void 0:r.map((d,l)=>e.jsx(wt,{...d},l))]})]})},_e=({label:n,icon:r,onClick:o,color:s="gray",disabled:a=!1,"aria-label":i,indicator:c,fullWidth:d,isActive:l=!1,...f})=>{const[h,g]=u.useState(!1),x=()=>{a||o==null||o()};return e.jsx(t.Box,{style:{cursor:a?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},variant:"transparent",justify:"flex-start",display:"flex",color:s,radius:"md",w:d?"100%":"auto",px:6,h:40,onMouseEnter:()=>!a&&g(!0),onMouseLeave:()=>g(!1),onClick:x,bg:h||l?"gray.1":"transparent","aria-label":i||`${n} navigation button`,...f,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,justify:"left",align:"center",children:[r,e.jsx(t.Text,{ta:"left",size:"sm",fw:600,c:"var(--mantine-color-gray-8)",truncate:!0,style:{flex:1,opacity:a?.5:1},children:n}),c&&e.jsx(t.Box,{style:{cursor:"pointer",backgroundColor:"var(--mantine-color-red-7)",color:"var(--mantine-color-white)",borderRadius:"var(--mantine-radius-lg)",padding:"0px 4px",fontSize:"12px",fontWeight:600,height:"20px",minWidth:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:c})]})})},Ge=({label:n,rightLabel:r,children:o,onAddChild:s,onMenuAction:a,menuItems:i,color:c="gray",defaultText:d="No items",level:l=0,disabled:f=!1,noChild:h=!1,isActive:g=!1,showAvatar:x=!1,avatar:y,placeholder:p,onClick:m,"aria-label":I,...b})=>{const[v,S]=u.useState(!1),[w,B]=u.useState(!1),[M,k]=u.useState(!1),j=u.Children.count(o)>0,R=M?C.IconChevronDown:C.IconChevronRight,D=!h&&j&&(x?w:!0),O=u.useCallback(()=>{f||m==null||m()},[m,f]),E=u.useCallback(H=>{H.stopPropagation(),!f&&(s==null||s())},[s,f]),N=u.useCallback(()=>{f||(j&&!h&&S(!v),m==null||m())},[f,j,h,v,m]),$=u.useCallback(()=>{f||s==null||s()},[s,f]),P=u.useCallback(H=>{f||a==null||a(H)},[a,f,n]),L=u.useCallback(()=>j?u.Children.map(o,H=>u.isValidElement(H)?u.cloneElement(H,{...H.props,level:l+1}):H):null,[o,j,l]),V=(i==null?void 0:i.map(H=>({children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[H.icon&&e.jsx(H.icon,{size:16}),e.jsx(t.Text,{size:"sm",children:H.label})]}),onClick:()=>P(H.action)})))||[],U=[{children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(C.IconPlus,{size:16}),e.jsx(t.Text,{size:"sm",children:"Add child"})]}),onClick:E}],G=V.length>0?V:U;return e.jsxs(t.Stack,{gap:0,children:[e.jsx(t.Box,{style:{cursor:f?"not-allowed":"pointer",borderRadius:"8px"},variant:"transparent",justify:"space-between",display:"flex",color:c,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!f&&B(!0),onMouseLeave:()=>B(!1),onClick:O,bg:g||w?"var(--mantine-color-gray-1)":"transparent","aria-expanded":v,"aria-label":I||`${n} navigation link`,...b,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,onClick:O,style:{paddingLeft:h&&!D?`${(l+1)*16}px`:l>0?`${l*16}px`:"0px"},children:[D?e.jsx(K,{icon:R,size:"md",color:c,onClick:N,disabled:f,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),"aria-label":j?`${v?"Collapse":"Expand"} ${n}`:void 0}):x?e.jsx(se,{size:"xs",avatar:y,showPlaceholder:!0,placeholder:p}):null,e.jsx(t.Text,{size:"sm",fw:500,c:g?"black":w?"gray.9":"gray.8",truncate:!0,w:"100%",style:{opacity:f?.5:1},children:n}),e.jsxs(t.Group,{gap:"xs",align:"center",children:[r&&e.jsx(t.Text,{size:"xs",c:"dimmed",children:r}),w&&!f&&e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[s&&e.jsx(K,{icon:C.IconPlus,onClick:$,"aria-label":`Add child to ${n}`}),(i&&i.length>0||s)&&e.jsx("div",{onClick:H=>H.stopPropagation(),children:e.jsx(Ie,{menuItems:G,trigger:e.jsx(K,{icon:C.IconDots,"aria-label":`More options for ${n}`,size:"md"}),position:"bottom-end",shadow:"md"})})]})]})]})}),v&&!h&&e.jsx(t.Stack,{gap:0,style:{width:"100%"},children:j?L():e.jsx(t.Box,{style:{marginLeft:l>0?`${l*16}px`:"0px"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"left",p:"sm",fw:500,children:d})})})]})},St="userChip-module__pill___DgFME",kt={pill:St},ke=({avatar:n,name:r,withRemoveButton:o=!1,onRemove:s})=>e.jsx(t.Pill,{withRemoveButton:o,onRemove:s,radius:"md",p:"0px",size:"md",className:kt.pill,bg:"transparent",children:e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{alignItems:"center"},children:[e.jsx(se,{avatar:n,size:24,placeholder:r,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:450,c:"var(--mantine-color-gray-9)",children:r})]})}),Ct="200px",Mt="4px 8px",Tt=40,Bt="var(--mantine-radius-md)",Ot=16,fn=({item:n,withAvatars:r,disabled:o=!1,onClick:s,selected:a=!1})=>{const[i,c]=u.useState(!1);return e.jsx(t.Box,{onMouseEnter:()=>!o&&c(!0),onMouseLeave:()=>!o&&c(!1),onClick:d=>{d.preventDefault(),d.stopPropagation(),o||s==null||s(n.value)},onMouseDown:d=>{d.stopPropagation()},style:{minWidth:Ct,backgroundColor:o?"transparent":i?"var(--mantine-color-gray-1)":"transparent",cursor:o?"default":"pointer",borderRadius:Bt,padding:Mt,transition:"background-color 0.2s ease",opacity:o?.5:1},children:e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",align:"flex-start",style:{alignItems:"center"},h:Tt,children:[r&&n.avatar&&e.jsx("img",{src:n.avatar,alt:n.label,style:{width:"24px",height:"24px",borderRadius:"var(--mantine-radius-sm)",objectFit:"cover"}}),e.jsxs(t.Stack,{gap:0,style:{flex:1},children:[e.jsx(t.Text,{size:"sm",fw:500,lh:-1,c:o?"var(--mantine-color-gray-5)":"var(--mantine-color-gray-9)",children:n.label}),e.jsx(t.Text,{size:"xs",c:o?"var(--mantine-color-gray-4)":"dimmed",children:n.description})]}),a&&e.jsx(C.IconCheck,{size:Ot,color:"var(--mantine-color-gray-9)"})]})})},zt="bottom-end",Rt=1e4,Dt="24px",Et="0 8px",At="6px",Ke="var(--mantine-radius-md)",Lt="46px",Re=({value:n,onChange:r,data:o,withRemove:s=!1,withAvatars:a=!1,onRemove:i,disabledOptions:c=[],disabled:d=!1,defaultOption:l,popoverStyles:f,dropdownStyles:h,triggerStyles:g,textStyles:x})=>{const[y,p]=u.useState(!1),m=(o||[]).find(j=>j.value===n)||l,[I,b]=u.useState(!1),[v,S]=u.useState(!1),[w,B]=u.useState(!1),M=s?e.jsx(t.Group,{p:"sm",onClick:j=>{j.stopPropagation(),i==null||i(n)},style:{cursor:"pointer",height:Lt,display:"flex",alignItems:"center",borderRadius:Ke,backgroundColor:v?"var(--mantine-color-red-0)":"transparent",transition:"background-color 0.2s ease"},onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-red-6)",fw:500,children:"Remove user"})}):null,k=e.jsxs(t.Box,{onMouseEnter:()=>!d&&b(!0),onMouseLeave:()=>!d&&b(!1),onClick:()=>{d||(p(!0),B(!0))},style:{height:Dt,cursor:d?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:Ke,backgroundColor:d?"transparent":I||w?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:Et,gap:At,width:"auto",opacity:d?.6:1,...g},children:[e.jsx(t.Text,{size:"sm",fw:x!=null&&x.fontWeight?void 0:500,c:d?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",style:{color:d?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",lineHeight:"24px",whiteSpace:"nowrap",...x},children:(m==null?void 0:m.label)||"Select option"}),e.jsx(C.IconChevronDown,{size:16,style:{color:d?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(t.Popover,{opened:y,onChange:j=>{p(j),j||B(!1)},position:zt,shadow:"md",withinPortal:!0,zIndex:Rt,styles:f,children:[e.jsx(t.Popover.Target,{children:k}),e.jsx(t.Popover.Dropdown,{onClick:j=>j.stopPropagation(),onMouseDown:j=>j.stopPropagation(),styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",padding:"4px",...h}},children:e.jsxs(t.Stack,{gap:0,onClick:j=>j.stopPropagation(),onMouseDown:j=>j.stopPropagation(),children:[(o||[]).map(j=>{const R=c.includes(j.value),D=j.value===n;return e.jsx(fn,{item:j,withAvatars:a,disabled:R,selected:D,onClick:O=>{r==null||r(O),p(!1),B(!1)}},j.value)}),M]})})]})},Ft=(n,r,o,s)=>{const a=u.useRef(null),i=u.useRef(null),c=u.useCallback(l=>{l[0].isIntersecting&&o&&!s&&r&&r()},[o,s,r]),d=u.useCallback(()=>{if(!(!a.current||!n||!r)){i.current&&(i.current.disconnect(),i.current=null);try{const l=new IntersectionObserver(c,{threshold:.1,rootMargin:"50px"});l.observe(a.current),i.current=l}catch(l){console.error("Failed to setup intersection observer:",l)}}},[n,r,c]);return u.useEffect(()=>(d(),()=>{i.current&&(i.current.disconnect(),i.current=null)}),[d]),u.useEffect(()=>()=>{i.current&&(i.current.disconnect(),i.current=null)},[]),{loadMoreRef:a}},hn=({tableName:n,data:r,columns:o,onAddItem:s,addItemComponent:a,addItemLabel:i="Add item",loading:c=!1,emptyMessage:d="No data found",searchPlaceholder:l="Search...",enableAutoFilters:f=!0,customFilters:h=[],onCustomFilter:g,onSort:x,sortColumn:y,sortDirection:p,onSearch:m,onRowClick:I,size:b="md",striped:v=!1,highlightOnHover:S=!0,enableInfiniteScroll:w=!1,isLoadingMore:B=!1,hasMore:M=!1,onLoadMore:k})=>{const[j,R]=u.useState(""),[D,O]=u.useState([]),{loadMoreRef:E}=Ft(w,k||(()=>{}),M,B),N=u.useMemo(()=>[...f?o.filter(z=>z.type==="select"&&z.options).map(z=>({value:z.key,label:z.label})):[],...h],[o,f,h]),$=u.useMemo(()=>{let T=r||[];if(j){const z=j.toLowerCase();T=T.filter(A=>o.some(F=>{if(!F.searchable)return!1;const _=A[F.key];return _==null?!1:String(_).toLowerCase().includes(z)}))}return D.forEach(z=>{if(z.filterTag.selectedOption){const A=o.find(F=>F.key===z.filterTag.filterOption.value);A&&(T=T.filter(F=>{var ne;const _=F[A.key];return String(_)===((ne=z.filterTag.selectedOption)==null?void 0:ne.value)}))}}),T},[r,j,D,o]),P=T=>{R(T),m==null||m(T)},L=T=>{const z=o.find(F=>F.key===T);if(!(z!=null&&z.sortable))return;const A=y===T&&p==="asc"?"desc":"asc";x==null||x(T,A)},V=T=>{const z=o.find(A=>A.key===T);return(z==null?void 0:z.type)==="select"&&z.options?z.options.map(A=>({value:A.value,label:A.label})):(z==null?void 0:z.type)==="badge"?[...new Set(r.map(F=>F[z.key]).filter(Boolean))].map(F=>({value:String(F),label:String(F).charAt(0).toUpperCase()+String(F).slice(1)})):z?[...new Set(r.map(F=>F[z.key]).filter(Boolean))].map(F=>({value:String(F),label:String(F).charAt(0).toUpperCase()+String(F).slice(1)})):[]},U=(T,z)=>{var F,_,ne,W,oe;const A=z[T.key];switch(T.type){case"text":return e.jsx(t.Text,{size:"sm",c:A?void 0:"dimmed",children:A||"—"});case"date":if(!A)return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});const X=new Date(A),de=T.format?X.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):X.toLocaleDateString();return e.jsx(t.Text,{size:"sm",c:"dimmed",children:de});case"select":return T.options?e.jsx(Re,{value:A,data:T.options,placeholder:T.label,onChange:re=>{var xe;return(xe=T.onSelectChange)==null?void 0:xe.call(T,re,z)},disabled:(F=T.disabled)==null?void 0:F.call(T,z)}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const De=((_=T.badgeColors)==null?void 0:_[A])||"gray";return e.jsx(t.Badge,{color:De,variant:"light",size:"sm",radius:"md",fw:600,children:A||"Unknown"});case"avatar":const Ee=((ne=T.fallbackText)==null?void 0:ne.call(T,z))||String(A).charAt(0).toUpperCase();return e.jsx(se,{avatar:A,size:"xs",placeholder:Ee,showPlaceholder:!0});case"custom":return((W=T.render)==null?void 0:W.call(T,A,z))||e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(oe=T.actions)!=null&&oe.length?e.jsxs(t.Menu,{shadow:"md",width:200,position:"bottom-end",styles:{dropdown:{borderRadius:"var(--mantine-radius-md)"}},children:[e.jsx(t.Menu.Target,{children:e.jsx(t.ActionIcon,{variant:"subtle",size:"md",color:"gray",radius:"md",children:e.jsx(C.IconDots,{size:16})})}),e.jsx(t.Menu.Dropdown,{children:T.actions.map((re,xe)=>{var ve;return e.jsx(t.Menu.Item,{color:re.color,leftSection:re.icon,disabled:(ve=re.disabled)==null?void 0:ve.call(re,z),onClick:()=>re.onClick(z),styles:{item:{borderRadius:"var(--mantine-radius-md)"}},children:re.label},xe)})})]}):null;default:return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"})}},G=T=>{var z;return(z=o.find(A=>A.key===T))!=null&&z.sortable?y===T?p==="asc"?e.jsx(C.IconChevronUp,{size:14}):e.jsx(C.IconChevronDown,{size:14}):e.jsx(C.IconChevronUp,{size:14,style:{opacity:.3}}):null},Q=(()=>{switch(b){case"sm":return{buttonSize:"xs",textSize:"sm"};case"lg":return{buttonSize:"md",textSize:"md"};default:return{buttonSize:"sm",textSize:"sm"}}})();return e.jsxs(t.Box,{pos:"relative",children:[e.jsx(t.LoadingOverlay,{visible:c}),e.jsxs(t.Stack,{gap:"sm",w:"100%",children:[e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",justify:"space-between",children:[e.jsx(t.Text,{fw:600,c:"var(--mantine-color-gray-8)",children:n}),e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[e.jsx(un,{placeholder:l,value:j,onChange:P,onSearch:P,expandDirection:"right",size:Q.buttonSize}),N.length>0&&e.jsx(Oe,{activeFilters:D.map(T=>T.filterTag),onFiltersChange:T=>{O(T.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),g==null||g(T)},availableFilters:N,size:Q.buttonSize})]}),s&&e.jsx(t.Button,{size:"compact-md",h:32,style:{fontSize:`var(--mantine-font-size-${Q.textSize})`,border:"none"},radius:"md",onClick:s,children:i})]})]}),N.length>0&&e.jsx(ze,{activeFilters:D.map(T=>T.filterTag),onFiltersChange:T=>{O(T.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),g==null||g(T)},availableFilters:N,size:"md",getFilterOptions:V})]}),a,e.jsxs(t.Table,{striped:v,highlightOnHover:S,highlightOnHoverColor:"var(--mantine-color-gray-0)",mt:"xs",children:[e.jsx(t.Table.Thead,{children:e.jsx(t.Table.Tr,{children:o.map(T=>e.jsx(t.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:T.width,textAlign:T.align||"left",cursor:T.sortable?"pointer":"default"},onClick:()=>T.sortable&&L(T.key),children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[T.icon&&e.jsx(t.Box,{style:{display:"flex",alignItems:"center"},children:T.icon}),e.jsx(t.Text,{size:Q.textSize,fw:500,children:T.label}),G(T.key)]})},String(T.key)))})}),e.jsx(t.Table.Tbody,{children:$.length===0?e.jsx(t.Table.Tr,{children:e.jsx(t.Table.Td,{colSpan:o.length,ta:"center",py:"xl",children:e.jsx(t.Text,{c:"dimmed",children:d})})}):$.map((T,z)=>e.jsx(t.Table.Tr,{style:{cursor:I?"pointer":"default"},onClick:()=>I==null?void 0:I(T),children:o.map(A=>e.jsx(t.Table.Td,{style:{textAlign:A.align||"left"},children:U(A,T)},String(A.key)))},T.id||z))})]}),w&&e.jsx(t.Box,{ref:E,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:B&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more..."})]})})]})};Object.assign(hn,{});const Pt=({onAvatarSelect:n,onEmojiSelect:r,onImageSelect:o,onIconSelect:s}={})=>{const[a,i]=u.useState("emoji"),[c,d]=u.useState(null),[l,f]=u.useState(null),[h,g]=u.useState(null),[x,y]=u.useState(null),[p,m]=u.useState(null),I=u.useCallback(j=>{i(j)},[]),b=u.useCallback(j=>{d(j)},[]),v=u.useCallback(j=>{m(j);const R=new FileReader;R.onload=D=>{var E;const O=(E=D.target)==null?void 0:E.result;f(O)},R.readAsDataURL(j)},[]),S=u.useCallback(j=>{g(j),f(null),m(null),y(null),n==null||n({type:"emoji",value:j}),r==null||r(j)},[n,r]),w=u.useCallback(j=>{y(j),f(null),m(null),g(null),n==null||n({type:"icon",value:j}),s==null||s(j)},[n,s]),B=u.useCallback(()=>{if(p&&l){const j=URL.createObjectURL(p);n==null||n({type:"image",value:j}),o==null||o(p)}},[p,l,n,o]),M=u.useCallback(()=>{f(null),m(null),g(null),y(null)},[]),k=u.useCallback(()=>{f(null),g(null),y(null),m(null),i("emoji"),d(null)},[]);return{selectedTab:a,tabHovered:c,previewImage:l,selectedEmoji:h,selectedIcon:x,selectedFile:p,handleTabChange:I,handleTabHover:b,handleImagePreview:v,handleImageAccept:B,handleEmojiSelect:S,handleIconSelect:w,clearImagePreview:M,resetState:k}},Ut=({opened:n,onClose:r,popoverRef:o})=>{const s=u.useCallback(i=>{n&&o.current&&!o.current.contains(i.target)&&(console.log("Click outside detected, closing popover"),r())},[n,r,o]),a=u.useCallback(i=>{i.key==="Escape"&&n&&(console.log("Escape key pressed, closing popover"),r())},[n,r]);return u.useEffect(()=>{if(n)return document.addEventListener("mousedown",s),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",a)}},[n,s,a]),{handleClickOutside:s,handleEscape:a}},Nt=({selectedTab:n,tabHovered:r,onTabChange:o,onTabHover:s,onRemove:a,hasAvatar:i=!1,children:c})=>{const[d,l]=u.useState(!1);return e.jsxs(t.Tabs,{color:"black",value:n,styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(t.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",w:"100%",children:[e.jsx(t.Tabs.Tab,{value:"emoji",p:0,pb:"xs",onClick:()=>o("emoji"),onMouseEnter:()=>s("emoji"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:r==="emoji"?"var(--mantine-color-gray-1)":"transparent",color:n==="emoji"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Emoji"})})}),e.jsx(t.Tabs.Tab,{value:"icons",p:0,pb:"xs",onClick:()=>o("icons"),onMouseEnter:()=>s("icons"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:r==="icons"?"var(--mantine-color-gray-1)":"transparent",color:n==="icons"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Icons"})})}),e.jsx(t.Tabs.Tab,{value:"image",p:0,pb:"xs",onClick:()=>o("image"),onMouseEnter:()=>s("image"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:r==="image"?"var(--mantine-color-gray-1)":"transparent",color:n==="image"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Image"})})}),a&&i&&e.jsx(t.Group,{justify:"flex-end",display:"flex",flex:1,pb:"xs",children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:d?"var(--mantine-color-red-0)":"transparent",color:d?"var(--mantine-color-red-6)":"var(--mantine-color-gray-6)",cursor:"pointer",transition:"all 0.1s ease"},fw:500,fz:"var(--mantine-font-size-sm)",onClick:a,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:"Remove"})})]}),e.jsx(t.Tabs.Panel,{value:"emoji",children:n==="emoji"?c:null}),e.jsx(t.Tabs.Panel,{value:"icons",children:n==="icons"?c:null}),e.jsx(t.Tabs.Panel,{value:"image",children:n==="image"?c:null})]})};let Je=!1;Je||(nn.init({data:Ce}),Je=!0);const Wt=()=>{const n=[{id:"frequent",name:"Frequently Used",icon:e.jsx(C.IconClock,{size:20,strokeWidth:2.5})}];return Ce.categories.forEach(r=>{if(r.emojis&&r.emojis.length>0){let o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),s=r.name;switch(r.id){case"people":o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),s="Smileys & People";break;case"nature":o=e.jsx(C.IconTrees,{size:20,strokeWidth:2}),s="Animals & Nature";break;case"foods":o=e.jsx(C.IconApple,{size:20,strokeWidth:2}),s="Food & Drink";break;case"activity":o=e.jsx(C.IconBallBasketball,{size:20,strokeWidth:2}),s="Activities";break;case"travel":o=e.jsx(C.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"places":o=e.jsx(C.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"objects":o=e.jsx(C.IconBulb,{size:20,strokeWidth:2}),s="Objects";break;case"symbols":o=e.jsx(C.IconHeart,{size:20,strokeWidth:2}),s="Symbols";break;case"flags":o=e.jsx(C.IconFlag,{size:20,strokeWidth:2}),s="Flags";break;case"frequent":return;default:o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),s=`Category: ${r.id}`;break}n.push({id:r.id,name:s,icon:o})}}),n},$t=({onEmojiSelect:n,height:r=200})=>{const[o,s]=u.useState(""),[a,i]=u.useState("people"),[c,d]=u.useState(()=>{if(typeof window<"u"){const I=localStorage.getItem("emoji-frequent");return I?JSON.parse(I):[]}return[]}),[l,f]=u.useState([]),[h,g]=u.useState(!1),x=Wt();u.useEffect(()=>{o.trim()?(g(!0),nn.SearchIndex.search(o).then(I=>{f(I.map(b=>({id:b.id,native:b.skins[0].native,name:b.name,keywords:b.keywords}))),g(!1)})):f([])},[o]);const y=u.useMemo(()=>{if(o.trim())return l;if(a==="frequent")return c.map(b=>({id:b,native:b,name:"",keywords:[]}));const I=Ce.categories.find(b=>b.id===a);return I?I.emojis.map(b=>{const v=Ce.emojis[b];return{id:v.id,native:v.skins[0].native,name:v.name,keywords:v.keywords}}):[]},[o,a,c,l]),p=I=>{n(I),d(b=>{const v=b.filter(w=>w!==I),S=[I,...v].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(S)),S})},m=I=>{if(o.trim())return"Results";const b=x.find(v=>v.id===I);return b?b.name:I.charAt(0).toUpperCase()+I.slice(1)};return e.jsxs(t.Stack,{gap:0,style:{height:r,width:"100%"},children:[e.jsx(t.Box,{p:"sm",pb:"xs",children:e.jsxs(t.Stack,{gap:"xs",children:[e.jsx(t.TextInput,{placeholder:"Search emojis...",value:o,onChange:I=>s(I.target.value),leftSection:e.jsx(C.IconSearch,{size:16,strokeWidth:2.5}),fw:500,size:"sm",radius:"md",styles:{input:{backgroundColor:"var(--mantine-color-gray-0)",color:"var(--mantine-color-gray-9)"}}}),e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:m(a)})]})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.ScrollArea,{h:"100%",type:"hover",offsetScrollbars:!1,children:e.jsx(t.Box,{style:{display:"grid",gridTemplateColumns:"repeat(9, 1fr)",gap:"0px",padding:"0px 12px 12px 12px"},children:h?e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"Searching..."}):y.length>0?y.map(I=>e.jsx(t.Tooltip,{label:I.name||I.id,position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Button,{variant:"subtle",size:"sm",p:0,onClick:()=>p(I.native),style:{width:"40px",height:"40px",fontSize:"22px",border:"none",backgroundColor:"transparent",borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent"},children:I.native})},I.id)):e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"No emojis found"})})})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:x.map(I=>e.jsx(t.Tooltip,{label:I.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>{i(I.id),s("")},style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer","&:hover":{backgroundColor:"var(--mantine-color-gray-0)"},backgroundColor:a===I.id?"var(--mantine-color-gray-0)":"transparent",color:a===I.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.1s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent"},children:I.icon})},I.id))})})]})},pn=["IconUser","IconUserCircle","IconUserCheck","IconUserX","IconUserPlus","IconUserMinus","IconUserEdit","IconUserCog","IconUserShield","IconUserStar","IconUserSearch","IconUserQuestion","IconUserOff","IconUsers","IconUserBolt","IconUserCode","IconUserDollar","IconUserExclamation","IconUserFilled","IconUserHexagon","IconUserKey","IconUserPause","IconUserPin","IconUserPlay","IconUserScan","IconUserShare","IconUserSquare","IconUserUp","IconUserVoice","IconUserWrench"],xn=["IconBriefcase","IconBuilding","IconBuildingStore","IconBuildingBank","IconBuildingWarehouse","IconBuildingSkyscraper","IconBuildingBridge","IconBuildingCar","IconBuildingFactory","IconBuildingHospital","IconBuildingMonument","IconBuildingPavilon","IconBuildingTunnel","IconBuildingWindmill","IconChartBar","IconChartLine","IconChartPie","IconChartDots","IconChartArea","IconChartArcs","IconChartCandle","IconChartDonut","IconChartRadar","IconTrendingUp","IconTrendingDown","IconTarget","IconFlag","IconTrophy","IconAward","IconMedal","IconCertificate","IconBadge","IconCrown","IconStar","IconStarFilled","IconStarHalf","IconStarOff","IconFileText","IconFile","IconFileAlert","IconFileAnalytics","IconFileBarcode","IconFileBroken","IconFileCertificate","IconFileChart","IconFileCheck","IconFileCode","IconFileDatabase","IconFileDollar","IconFileDownload","IconFileEuro","IconFileExport","IconFileFunction","IconFileImport","IconFileInfo","IconFileInvoice","IconFileLambda","IconFileLike","IconFileMinus","IconFileMusic","IconFileOff","IconFilePencil","IconFilePhone","IconFilePlus","IconFileReport","IconFileRss","IconFileScissors","IconFileSearch","IconFileSettings","IconFileShredder","IconFileSignal","IconFileSpreadsheet","IconFileStar","IconFileSymlink","IconFileTime","IconFileType","IconFileTypography","IconFileUnknown","IconFileUpload","IconFileVector","IconFileX","IconFileZip","IconFolder","IconFolderOpen","IconFolderPlus","IconFolderMinus","IconFolderX","IconFolderCheck","IconFolderCog","IconFolderDown","IconFolderHeart","IconFolderOff","IconFolderPause","IconFolderPin","IconFolderQuestion","IconFolderSearch","IconFolderShare","IconFolderStar","IconFolderUp","IconFolderWrench","IconArchive","IconArchiveOff","IconBox","IconBoxMultiple","IconBoxOff","IconBoxPadding","IconBoxSeam","IconBriefcaseOff","IconClipboard","IconClipboardCheck","IconClipboardCopy","IconClipboardData","IconClipboardHeart","IconClipboardList","IconClipboardOff","IconClipboardPaste","IconClipboardText","IconClipboardTypography","IconClipboardX","IconCopy","IconCut","IconPaste","IconDuplicate","IconEdit","IconEditCircle","IconEditCircleOff"],mn=["IconDeviceDesktop","IconDeviceLaptop","IconDeviceMobile","IconDeviceTablet","IconDeviceWatch","IconDeviceTv","IconDeviceGamepad","IconDeviceAirpods","IconDeviceImac","IconDeviceIpad","IconDeviceIphone","IconDeviceMacbook","IconDeviceNintendo","IconDevicePlaystation","IconDeviceXbox","IconCode","IconTerminal","IconDatabase","IconServer","IconWifi","IconBluetooth","IconCpu","IconKeyboard","IconMouse","IconCamera","IconVideo","IconMicrophone","IconSpeaker","IconHeadphones","IconPrinter","IconScanner","IconRouter","IconModem","IconAntenna","IconSatellite","IconRadar","IconRadar2","IconBroadcast","IconBroadcastOff","IconRadio","IconRadioactive","IconRadioactiveOff","IconSignal","IconSignal4G","IconSignal5G","IconSignalOff","IconBattery","IconBattery1","IconBattery2","IconBattery3","IconBattery4","IconBatteryOff","IconBatteryCharging","IconBatteryAutomotive","IconBatteryEco","IconBatteryFilled","IconPlug","IconPlugConnected","IconPlugConnectedX","IconPlugOff","IconPlugX","IconPower","IconPowerOff","IconOutlet","IconCable","IconCableOff","IconCircuitAmmeter","IconCircuitBattery","IconCircuitBulb","IconCircuitCapacitor","IconCircuitCell","IconCircuitCellPlus","IconCircuitChangeover","IconCircuitDiode","IconCircuitDiodeZener","IconCircuitGround","IconCircuitGroundDigital","IconCircuitInductor","IconCircuitMotor","IconCircuitPushbutton","IconCircuitResistor","IconCircuitSwitchClosed","IconCircuitSwitchOpen","IconCircuitVoltmeter","IconCpu2","IconCpuOff","IconMemory","IconMemoryCard","IconMemoryStick","IconHardDrive","IconHardDrive2","IconDisk","IconDiskOff","IconCd","IconCdOff","IconDvd","IconDvdOff","IconFloppyDisk","IconFloppyDiskOff","IconUsb","IconUsbOff","IconSdCard","IconSdCardOff","IconCloud","IconCloudComputing","IconCloudDataConnection","IconCloudDownload","IconCloudLock","IconCloudOff","IconCloudRain","IconCloudSnow","IconCloudStorm","IconCloudUpload","IconCloudCheck","IconCloudCode","IconCloudCog","IconCloudDollar","IconCloudDown","IconCloudExclamation","IconCloudHeart","IconCloudMinus","IconCloudPause","IconCloudPin","IconCloudPlus","IconCloudQuestion","IconCloudSearch","IconCloudShare","IconCloudStar","IconCloudUp","IconCloudX"],gn=["IconMoodSmile","IconMoodHappy","IconMoodWink","IconMoodSad","IconMoodConfused","IconMoodAnnoyed","IconMoodAngry","IconMoodCry","IconMoodTongue","IconMoodKiss","IconMoodHeart","IconMoodLove","IconMoodEmpty","IconMoodNervous","IconMoodSuprised","IconMoodSilence","IconMoodSick","IconMoodTongueWink","IconMoodTongueWink2","IconMoodWink2","IconHeart","IconHeartFilled","IconHeartBroken","IconHeartHandshake","IconHeartMinus","IconHeartOff","IconHeartPlus","IconHeartRateMonitor","IconThumbUp","IconThumbDown","IconSmile","IconFrown","IconMeh","IconLaugh","IconWink","IconKiss","IconTongue","IconGrin","IconSmirk"],In=["IconTrees","IconLeaf","IconFlower","IconPlant","IconSun","IconMoon","IconStar","IconCloud","IconCloudRain","IconCloudSnow","IconSnowflake","IconDroplet","IconFlame","IconMountain","IconTree","IconPineTree","IconBug","IconButterfly","IconFish","IconBird","IconCat","IconDog","IconRabbit","IconPaw","IconPawprint","IconFeather","IconSeeding","IconSeedingOff","IconPlant2","IconPlantOff","IconLeafOff","IconFlower2","IconFlowerOff","IconTreesOff","IconTreeOff","IconPineTreeOff","IconPalmTree","IconPalmTreeOff","IconSunOff","IconSunHigh","IconSunLow","IconMoonOff","IconMoonStars","IconMoon2","IconMoonFilled","IconStars","IconStarsOff","IconStarFilled","IconStarHalf","IconStarOff","IconCloudOff","IconCloudStorm","IconCloudFog","IconCloudWind","IconSnowflakeOff","IconDropletOff","IconDropletFilled","IconDropletHalf","IconDropletHalf2","IconDropletHalfFilled","IconFlameOff","IconFire","IconFireExtinguisher","IconMountainOff","IconMountain2","IconHills","IconHillsOff","IconValley","IconValleyOff","IconBugOff","IconButterflyOff","IconBee","IconBeeOff","IconSpider","IconSpiderOff","IconAnt","IconAntOff","IconLadybug","IconLadybugOff","IconGrasshopper","IconGrasshopperOff","IconCricket","IconCricketOff","IconFishOff","IconFishBone","IconFishBoneOff","IconShark","IconSharkOff","IconWhale","IconWhaleOff","IconDolphin","IconDolphinOff","IconOctopus","IconOctopusOff","IconSeahorse","IconSeahorseOff","IconBirdOff","IconEagle","IconEagleOff","IconOwl","IconOwlOff","IconParrot","IconParrotOff","IconPeacock","IconPeacockOff","IconPenguin","IconPenguinOff","IconSwan","IconSwanOff","IconCatOff","IconDogOff","IconRabbitOff","IconFeatherOff","IconWing","IconWingOff","IconEgg","IconEggOff","IconEggCracked","IconEggCrackedOff","IconEggFilled","IconEggFilledOff","IconEggFried","IconEggFriedOff","IconNest","IconNestOff","IconNestEggs","IconNestEggsOff"],yn=["IconCircle","IconSquare","IconTriangle","IconDiamond","IconHexagon","IconPentagon","IconOctagon","IconCross","IconPlus","IconMinus","IconCheck","IconX","IconArrowUp","IconArrowDown","IconArrowLeft","IconArrowRight","IconArrowUpLeft","IconArrowUpRight","IconArrowDownLeft","IconArrowDownRight","IconArrowLeftUp","IconArrowLeftDown","IconArrowRightUp","IconArrowRightDown","IconPlay","IconPause","IconStop","IconRecord","IconSkipBack","IconSkipForward","IconRewind","IconFastForward","IconCircleDot","IconCircleFilled","IconCircleHalf","IconCircleHalf2","IconCircleHalfFilled","IconCircleOff","IconCircleX","IconSquareDot","IconSquareFilled","IconSquareHalf","IconSquareHalfFilled","IconSquareOff","IconSquareRounded","IconSquareRoundedDot","IconSquareRoundedFilled","IconSquareRoundedHalf","IconSquareRoundedHalfFilled","IconSquareRoundedOff","IconSquareRoundedX","IconSquareX","IconTriangleFilled","IconTriangleInverted","IconTriangleInvertedFilled","IconTriangleOff","IconTriangleSquare","IconTriangleSquareCircle","IconDiamondFilled","IconDiamondOff","IconHexagonFilled","IconHexagonOff","IconPentagonFilled","IconPentagonOff","IconOctagonFilled","IconOctagonOff","IconCrossOff","IconPlusMinus","IconMinusMinus","IconCheckbox","IconCheckboxOff","IconChecks","IconXbox","IconXboxOff","IconYinYang","IconYinYangOff","IconYoga","IconYogaOff","IconZodiac","IconZodiacOff","IconZoom","IconZoomCancel","IconZoomCode","IconZoomExclamation","IconZoomFilled","IconZoomIn","IconZoomInArea","IconZoomInAreaFilled","IconZoomInFilled","IconZoomMoney","IconZoomPan","IconZoomQuestion","IconZoomReplace","IconZoomReset","IconZoomScan","IconZoomScanFilled","IconZoomX"],vn=["IconEdit","IconDelete","IconSave","IconOpen","IconClose","IconAdd","IconRemove","IconSearch","IconFilter","IconSort","IconRefresh","IconReload","IconUndo","IconRedo","IconCut","IconCopy","IconPaste","IconDuplicate","IconMove","IconRotate","IconFlip","IconResize","IconScale","IconCrop","IconTransform","IconWrench","IconHammer","IconScrewdriver","IconTool","IconTools","IconSaw","IconDrill","IconDrillOff","IconAxe","IconAxeOff","IconPickaxe","IconPickaxeOff","IconShovel","IconShovelOff","IconRake","IconRakeOff","IconHoe","IconHoeOff","IconScythe","IconScytheOff","IconPitchfork","IconPitchforkOff","IconFork","IconForkOff","IconKnife","IconKnifeOff","IconSword","IconSwordOff","IconDagger","IconDaggerOff","IconSpear","IconSpearOff","IconBow","IconBowOff","IconArrow","IconArrowOff","IconCrossbow","IconCrossbowOff","IconGun","IconGunOff","IconPistol","IconPistolOff","IconRifle","IconRifleOff","IconShotgun","IconShotgunOff","IconBomb","IconBombOff","IconGrenade","IconGrenadeOff","IconDynamite","IconDynamiteOff","IconMine","IconMineOff","IconTorpedo","IconTorpedoOff","IconMissile","IconMissileOff","IconRocket","IconRocketOff","IconBazooka","IconBazookaOff","IconCannon","IconCannonOff","IconTank","IconTankOff","IconHelicopter","IconHelicopterOff","IconPlane","IconPlaneOff","IconJet","IconJetOff","IconSatellite","IconSatelliteOff","IconSpace","IconSpaceOff","IconGalaxy","IconGalaxyOff","IconPlanet","IconPlanetOff","IconEarth","IconEarthOff","IconMoon","IconMoonOff","IconSun","IconSunOff","IconStar","IconStarOff","IconAsteroid","IconAsteroidOff","IconComet","IconCometOff","IconMeteor","IconMeteorOff","IconUfo","IconUfoOff","IconAlien","IconAlienOff","IconRobot","IconRobotOff","IconAndroid","IconAndroidOff","IconIos","IconIosOff","IconWindows","IconWindowsOff","IconLinux","IconLinuxOff","IconMac","IconMacOff","IconUbuntu","IconUbuntuOff","IconDebian","IconDebianOff","IconRedhat","IconRedhatOff","IconCentos","IconCentosOff","IconFedora","IconFedoraOff","IconSuse","IconSuseOff","IconArch","IconArchOff","IconGentoo","IconGentooOff","IconSlackware","IconSlackwareOff","IconMint","IconMintOff","IconKali","IconKaliOff","IconParrot","IconParrotOff","IconBacktrack","IconBacktrackOff","IconBlackarch","IconBlackarchOff","IconPentoo","IconPentooOff","IconMatriux","IconMatriuxOff","IconNodezero","IconNodezeroOff","IconBugtraq","IconBugtraqOff","IconCyborg","IconCyborgOff","IconDefensive","IconDefensiveOff","IconDracos","IconDracosOff","IconFembuntu","IconFembuntuOff","IconGnacktrack","IconGnacktrackOff","IconHackintosh","IconHackintoshOff","IconHak5","IconHak5Off","IconHavij","IconHavijOff","IconJackal","IconJackalOff","IconKnoppix","IconKnoppixOff","IconKodachi","IconKodachiOff","IconLion","IconLionOff","IconMandriva","IconMandrivaOff","IconMobily","IconMobilyOff","IconMuslim","IconMuslimOff","IconNetrunner","IconNetrunnerOff","IconPardus","IconPardusOff","IconQubes","IconQubesOff","IconSabayon","IconSabayonOff","IconScientific","IconScientificOff","IconSemplice","IconSempliceOff","IconSiduction","IconSiductionOff","IconSlax","IconSlaxOff","IconSli","IconSliOff","IconTails","IconTailsOff","IconVector","IconVectorOff","IconVoid","IconVoidOff","IconWhonix","IconWhonixOff","IconZorin","IconZorinOff","IconAlpine","IconAlpineOff","IconElementary","IconElementaryOff","IconManjaro","IconManjaroOff","IconOpenbsd","IconOpenbsdOff","IconOpenSuse","IconOpenSuseOff","IconPop","IconPopOff","IconSolus","IconSolusOff"],jn=["IconMessage","IconMessageCircle","IconMessageDots","IconMessagePlus","IconMessageReport","IconMessageShare","IconMessageText","IconMessages","IconMessagesOff","IconMail","IconMailOpened","IconMailFast","IconMailOff","IconMailPause","IconMailPin","IconMailPlus","IconMailQuestion","IconMailSearch","IconMailShare","IconMailStar","IconMailUp","IconMailX","IconPhone","IconPhoneCall","IconPhoneIncoming","IconPhoneOff","IconPhoneOutgoing","IconPhonePause","IconPhonePlus","IconPhoneX","IconVideo","IconVideoOff","IconVideoPlus","IconCamera","IconCameraOff","IconCameraPlus","IconMicrophone","IconMicrophoneOff","IconMicrophone2","IconMicrophone2Off","IconHeadphones","IconHeadphonesOff","IconSpeaker","IconSpeakerOff","IconBroadcast","IconBroadcastOff","IconRadio","IconRadioactive","IconRadioactiveOff","IconAntenna","IconAntennaBars1","IconAntennaBars2","IconAntennaBars3","IconAntennaBars4","IconAntennaBars5","IconAntennaOff","IconSatellite","IconSatelliteOff","IconWifi","IconWifi0","IconWifi1","IconWifi2","IconWifiOff","IconBluetooth","IconBluetoothConnected","IconBluetoothOff","IconBluetoothX","IconShare","IconShareOff","IconShare2","IconShare3","IconAt","IconHash","IconLink","IconLinkOff","IconExternalLink","IconExternalLinkOff","IconSend","IconSendOff","IconSend2","IconReceipt","IconReceiptOff","IconReceipt2","IconReceiptRefund","IconReceiptTax","IconReceiptEuro","IconReceiptDollar","IconReceiptPound","IconReceiptYen","IconReceiptYuan","IconReceiptWon","IconReceiptRupee","IconReceiptBaht","IconReceiptLira","IconReceiptRuble","IconReceiptShekel","IconReceiptTaka","IconReceiptHryvnia","IconReceiptKrone","IconReceiptKrona","IconReceiptZloty","IconReceiptForint","IconReceiptLeu","IconReceiptLev","IconReceiptKuna","IconReceiptDinar","IconReceiptDirham","IconReceiptRial","IconReceiptRiyal","IconReceiptAfghani","IconReceiptAriary","IconReceiptCedi","IconReceiptDalasi","IconReceiptFranc","IconReceiptGourde","IconReceiptKina","IconReceiptKip","IconReceiptKwacha","IconReceiptKwanza","IconReceiptLari","IconReceiptLek","IconReceiptLilangeni","IconReceiptLoti","IconReceiptManat","IconReceiptMetical","IconReceiptNaira","IconReceiptPeso","IconReceiptPula","IconReceiptRand","IconReceiptRupiah","IconReceiptShilling","IconReceiptSom","IconReceiptSomoni","IconReceiptTenge","IconReceiptVatu","IconReceiptWon","IconReceiptXof","IconReceiptYuan","IconReceiptZloty"];[...pn,...xn,...mn,...gn,...In,...yn,...vn,...jn];const me=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:pn},{id:"business",name:"Business & Work",icons:xn},{id:"tech",name:"Technology",icons:mn},{id:"expressions",name:"Expressions",icons:gn},{id:"nature",name:"Nature & Animals",icons:In},{id:"shapes",name:"Shapes & Symbols",icons:yn},{id:"actions",name:"Actions & Tools",icons:vn},{id:"communication",name:"Communication",icons:jn}],Ht={recent:e.jsx(C.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(C.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(C.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(C.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(C.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(C.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(C.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(C.IconMessage,{size:20,strokeWidth:2.5})},Gt=({selectedCategory:n,onCategoryChange:r})=>e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:me.map(o=>{const s=Ht[o.id];return e.jsx(t.Tooltip,{label:o.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>r(o.id),style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",backgroundColor:n===o.id?"var(--mantine-color-gray-0)":"transparent",color:n===o.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.2s ease"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:a=>{a.currentTarget.style.backgroundColor=n===o.id?"var(--mantine-color-gray-0)":"transparent"},children:s})},o.id)})}),bn=u.memo(({onIconSelect:n,height:r=358})=>{var I,b;const[o,s]=u.useState(""),[a,i]=u.useState("recent"),[c,d]=u.useState(!1),[l,f]=u.useState([]);u.useLayoutEffect(()=>{if(typeof window<"u"){const v=localStorage.getItem("avatar-icon-recent");if(v)try{f(JSON.parse(v))}catch(S){console.warn("Error parsing recent icons from localStorage:",S)}}},[]);const h=u.useMemo(()=>me.filter(v=>v.id!=="recent"&&!("isDynamic"in v)).flatMap(v=>v.icons),[]),g=u.useMemo(()=>{if(a==="recent"){const S=new Set(h);return l.filter(w=>S.has(w))}const v=me.find(S=>S.id===a);return(v==null?void 0:v.icons)||[]},[a,l,h]),x=u.useCallback((v,S)=>{if(!v.trim())return S;const w=v.toLowerCase().trim(),B=w.split(/\s+/);return S.filter(M=>{const j=M.replace(/^Icon/,"").split(/(?=[A-Z])/).map(R=>R.toLowerCase().trim()).filter(R=>R.length>0);return!!(j.some(R=>B.some(D=>R===D))||w.length>2&&j.some(R=>B.some(D=>R.startsWith(D)))||w.length<=2&&j.some(R=>B.some(D=>R.includes(D)))||B.length>1&&B.every(R=>j.some(D=>D===R||D.startsWith(R))))})},[]),y=u.useMemo(()=>o.trim()?x(o,h):g,[o,g,h,x]),p=u.useCallback(v=>{h.includes(v)&&f(w=>{const B=[v,...w.filter(M=>M!==v)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(B)),B}),n(v)},[n,h]),m=u.useCallback(v=>{a!==v&&(s(""),i(v),requestAnimationFrame(()=>{d(!0),setTimeout(()=>d(!1),100)}))},[a]);return e.jsxs(t.Stack,{gap:0,style:{height:r,width:"100%"},children:[e.jsx(t.Box,{p:"sm",pb:"xs",children:e.jsxs(t.Stack,{gap:"xs",children:[e.jsx(t.TextInput,{placeholder:o.trim()?"Search all icons...":`Search in ${(I=me.find(v=>v.id===a))==null?void 0:I.name}...`,value:o,onChange:v=>s(v.target.value),leftSection:e.jsx(C.IconSearch,{size:16}),fw:500,size:"sm",radius:"md",styles:{input:{backgroundColor:"var(--mantine-color-gray-0)",color:"var(--mantine-color-gray-9)"}}}),e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:o.trim()?"Results":(b=me.find(v=>v.id===a))==null?void 0:b.name})]})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.ScrollArea,{h:"100%",type:"hover",children:e.jsx(t.Box,{style:{display:"grid",gridTemplateColumns:"repeat(8, 1fr)",gap:"4px",padding:"0 12px 12px 12px",opacity:c?.7:1,transition:"opacity 0.05s ease"},children:y.map(v=>e.jsx(on,{iconName:v,onClick:()=>p(v),size:20},o.trim()?`search-${v}`:`${a}-${v}`))},`${a}-${o}`)})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(Gt,{selectedCategory:a,onCategoryChange:m})})]})});bn.displayName="IconGrid";const Vt=({previewImage:n,fileInputRef:r,selectedEmoji:o,size:s,loading:a,onFileInputClick:i,onImageChange:c,onImageAccept:d,onClearImagePreview:l})=>e.jsx(t.Box,{p:"sm",style:{width:"384px"},children:e.jsxs(t.Stack,{gap:"md",align:"center",children:[n||o?e.jsxs(t.Box,{children:[e.jsx(t.Text,{size:"sm",fw:500,mb:"xs",children:"Preview"}),e.jsx(t.Avatar,{src:n,radius:"md",style:{width:`${he(s)}px !important`,height:`${he(s)}px !important`,minWidth:`${he(s)}px`,minHeight:`${he(s)}px`,maxWidth:`${he(s)}px`,maxHeight:`${he(s)}px`,border:"1px solid var(--mantine-color-gray-4)",objectFit:"cover",boxSizing:"border-box"},children:o})]}):e.jsx(t.Button,{variant:"subtle",bg:"gray.0",styles:{root:{height:"64px"}},leftSection:e.jsx(C.IconPhoto,{size:20}),onClick:i,loading:a,disabled:a,fullWidth:!0,children:"Choose Image"}),n||o?e.jsx(t.Button,{variant:"outline",leftSection:e.jsx(C.IconPhoto,{size:16}),onClick:i,loading:a,disabled:a,fullWidth:!0,children:n||o?"Change Image":"Choose Image"}):null,e.jsx("input",{ref:r,type:"file",accept:"image/jpeg,image/jpg,image/png,image/gif,image/webp",onChange:f=>{var h;return c(((h=f.target.files)==null?void 0:h[0])||null)},style:{display:"none"},disabled:a}),(n||o)&&e.jsxs(t.Group,{gap:"sm",w:"100%",children:[e.jsx(t.Button,{variant:"outline",color:"gray",onClick:l,fullWidth:!0,children:"Back"}),e.jsx(t.Button,{color:"blue",onClick:d,loading:a,disabled:a,fullWidth:!0,children:"Accept"})]}),e.jsx(t.Text,{size:"xs",c:"var(--mantine-color-gray-6)",ta:"center",children:"Supported formats: JPG, PNG, GIF, WebP"})]})}),_t=({onEmojiSelect:n})=>e.jsx($t,{onEmojiSelect:n,height:358}),Qt=({onIconSelect:n})=>e.jsx(bn,{onIconSelect:n,height:358}),Yt=({previewImage:n,selectedEmoji:r,size:o,loading:s,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:d,fileInputRef:l})=>e.jsx(Vt,{previewImage:n,fileInputRef:l,selectedEmoji:r,size:o,loading:s,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:d}),qt=()=>e.jsx(t.Box,{style:{width:400,height:358,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs(t.Stack,{align:"center",gap:"sm",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"gray.6",children:"Loading avatar options..."})]})}),Qe=({editable:n=!0,opened:r,onOpen:o,onClose:s,avatar:a,onAvatarSelect:i,onRemove:c,size:d="lg",loading:l=!1,placeholder:f,showPlaceholder:h=!0,position:g="bottom-start",withinPortal:x=!0,zIndex:y=1e3})=>{const p=u.useRef(null),m=u.useRef(null),I=u.useRef(null),{selectedTab:b,tabHovered:v,previewImage:S,selectedEmoji:w,selectedIcon:B,selectedFile:M,handleTabChange:k,handleTabHover:j,handleImagePreview:R,handleImageAccept:D,handleEmojiSelect:O,handleIconSelect:E,clearImagePreview:N,resetState:$}=Pt({onAvatarSelect:i});Ut({opened:r,onClose:s,popoverRef:m}),u.useEffect(()=>{r||$()},[r,$]);const P=X=>{console.log("Emoji clicked:",X),O(X),s()},L=X=>{console.log("Icon clicked:",X),E(X),s()},V=X=>{X&&R(X)},U=()=>{M?(D(),s()):(w||B)&&s()},G=()=>{p.current&&p.current.click()},H=()=>{N()},Q=()=>{console.log("Avatar removed"),c==null||c(),s()},T=()=>!!a,z=()=>l?e.jsx(Me,{size:d,loading:!0}):e.jsx(se,{avatar:a,size:d,placeholder:f,showPlaceholder:h,editable:!0,onClick:()=>{!l&&!r&&o()}}),A=e.jsx(_t,{onEmojiSelect:P}),F=e.jsx(Qt,{onIconSelect:L}),_=e.jsx(Yt,{previewImage:S,selectedEmoji:w,size:d,loading:l,onFileInputClick:G,onImageChange:V,onImageAccept:U,onClearImagePreview:H,fileInputRef:p}),ne=e.jsx(t.Box,{children:e.jsx(Nt,{selectedTab:b,tabHovered:v,onTabChange:k,onTabHover:j,onRemove:Q,hasAvatar:T(),children:b==="emoji"?A:b==="icons"?F:_})}),W=e.jsx("div",{style:{position:"relative",display:"inline-block"},children:e.jsxs(t.Popover,{opened:r,onClose:()=>{console.log("Popover onClose called"),s()},position:g,withinPortal:x,withArrow:!0,shadow:"md",radius:"md",closeOnClickOutside:!1,closeOnEscape:!1,offset:8,children:[e.jsx(t.Popover.Target,{children:e.jsx("div",{ref:I,style:{position:"relative"},children:z()})}),e.jsx(t.Popover.Dropdown,{ref:m,p:0,style:{width:"auto",overflow:"hidden",zIndex:y},children:e.jsx(u.Suspense,{fallback:e.jsx(qt,{}),children:ne})})]})}),oe=e.jsx(se,{avatar:a,size:d,placeholder:f,showPlaceholder:h});return e.jsx(e.Fragment,{children:n?W:oe})},Zt=n=>{if(!n||typeof n!="string")return!1;const r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return n.length<5||n.length>254?!1:r.test(n.trim())},Xt=n=>{const r=[];return n.forEach(o=>{Zt(o)||r.push({email:o,error:"Please enter a valid email address"})}),{isValid:r.length===0,errors:r}},Kt=n=>{const r=[],o=new Set;return n.forEach(s=>{const a=s.toLowerCase().trim();o.has(a)?r.push({email:s,error:"This email has already been added"}):o.add(a)}),r},Jt=n=>{const r=Xt(n),o=Kt(n),s=[...r.errors,...o];return{isValid:s.length===0,errors:s}},eo=({value:n,onChange:r,onInputChange:o,suggestedUsers:s=[],tagDisplayMap:a={}})=>{const[i,c]=u.useState(""),[d,l]=u.useState([]),f=u.useRef(null),h=n.map(m=>{if(a[m])return a[m];const I=s.find(b=>b.email===m);return I&&I.name?I.name:m});u.useEffect(()=>{o&&o(i)},[i,o]),u.useEffect(()=>{if(n.length>0){const m=Jt(n);l(m.errors)}else l([])},[n]),u.useEffect(()=>{const m=f.current;if(!m)return;let I;const b=v=>{const w=v.target.value||"";clearTimeout(I),I=setTimeout(()=>{c(w)},150)};return m.addEventListener("input",b),()=>{m.removeEventListener("input",b),clearTimeout(I)}},[]);const g=u.useCallback(m=>{const I=s.map(v=>({name:v.name||v.email,email:v.email})),b=m.map(v=>{const S=I.find(w=>w.name.toLowerCase()===v.toLowerCase());return S?S.email:v}).filter(v=>v.includes("@")?!0:!I.some(w=>{const B=w.name.toLowerCase(),M=v.toLowerCase();return B.startsWith(M)&&M!==B}));r(b),c("")},[r,s]),x=u.useCallback(()=>{f.current&&(f.current.value="",c(""))},[]),y=d.length===0&&n.length>0,p=u.useCallback((m,I,b)=>{m&&n.length>0&&I&&(m(n,I,b),c(""))},[n]);return{inputText:i,tagsInputRef:f,displayValue:h,validationErrors:d,isValid:y,handleEmailChange:g,clearInput:x,handleInvite:p}},wn=({onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s=[],suggestedUsers:a=[],roleOptions:i=[]})=>{const[c,d]=u.useState([]),[l,f]=u.useState([]),[h,g]=u.useState(""),[x,y]=u.useState({}),p=i.length>0?i[0].value:void 0,[m,I]=u.useState(p);u.useEffect(()=>{i.length>0&&!m&&I(i[0].value)},[i.length,m]),u.useEffect(()=>{const O=a.filter(E=>c.includes(E.email)).map(E=>E.id);f(E=>E.filter(N=>O.includes(N)))},[c,a.length]);const[b,v]=u.useState("invite"),[S,w]=u.useState(null),B=(O,E,N)=>{n&&n(O,E,N),d([]),g("")},M=(O,E)=>{r&&r(O,E)},k=O=>{o&&o(O)},j=O=>{f(E=>E.includes(O)?E.filter(N=>N!==O):[...E,O])},R=O=>{c.includes(O.email)||(d([...c,O.email]),y(E=>({...E,[O.email]:O.name||O.email})),l.includes(O.id)||f([...l,O.id]),g(""))},D=h.trim()?a.filter(O=>{var N;const E=h.toLowerCase();return O.email.toLowerCase().includes(E)||((N=O.name)==null?void 0:N.toLowerCase().includes(E))}):[];return{emails:c,setEmails:d,selectedUsers:l,setSelectedUsers:f,inputText:h,setInputText:g,tagDisplayMap:x,setTagDisplayMap:y,selectedRole:m,setSelectedRole:I,selectedTab:b,setSelectedTab:v,tabHovered:S,setTabHovered:w,filteredUsers:D,handleInvite:B,handleUpdateRole:M,handleRemoveUser:k,handleToggleUser:j,handleAddSuggestedUser:R}},Sn=u.forwardRef(({value:n,onChange:r,placeholder:o="Add one or more emails",onInvite:s,roleOptions:a=[],selectedRole:i,onRoleChange:c,onInputChange:d,suggestedUsers:l=[],tagDisplayMap:f={}},h)=>{const[g,x]=u.useState("Hello, I would like to invite you to join my workspace"),{tagsInputRef:y,displayValue:p,validationErrors:m,isValid:I,handleEmailChange:b,clearInput:v,handleInvite:S}=eo({value:n,onChange:r,onInputChange:d,suggestedUsers:l,tagDisplayMap:f}),w=()=>{S(s,i,g),x("")};u.useImperativeHandle(h,()=>({clearInput:v}),[v]);const B=p.length>0,M=c&&a.length>0,k=m.length>0;return e.jsxs(t.Stack,{gap:"md",children:[e.jsxs(t.Box,{children:[e.jsx(t.Box,{style:{maxHeight:"120px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.TagsInput,{ref:y,value:p,onChange:b,placeholder:B?"":o,radius:"md",rightSection:M?e.jsx(t.Box,{style:{position:"absolute",right:"8px",top:"17px",transform:"translateY(-50%)",height:"24px",display:"flex",alignItems:"center"},children:e.jsx(Re,{value:i||"",onChange:j=>c(j),data:a,placeholder:"Select role",defaultOption:a[a.length-1],disabledOptions:["owner"]})}):null,rightSectionProps:{style:{width:M?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:M?"130px":"12px",minHeight:"36px",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",borderRadius:"var(--mantine-radius-md)",border:k?"2px solid var(--mantine-color-red-6)":"2px solid var(--mantine-color-blue-7)",backgroundColor:"var(--mantine-color-gray-0)"},pillsList:{height:"24px !important",borderRadius:"var(--mantine-radius-md) !important"},pill:{height:"24px !important",borderRadius:"var(--mantine-radius-md) !important",backgroundColor:k?"var(--mantine-color-red-1) !important":"var(--mantine-color-orange-1) !important",color:k?"var(--mantine-color-red-7) !important":"var(--mantine-color-gray-7) !important",fontSize:"var(--mantine-font-size-sm)"}}})}),k&&e.jsx(t.Stack,{gap:"xs",mt:"xs",children:m.map((j,R)=>e.jsxs(t.Text,{size:"xs",c:"red",children:[j.email,": ",j.error]},R))})]}),B&&e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(t.Textarea,{size:"sm",value:g,onChange:j=>x(j.currentTarget.value),minRows:2,maxRows:4,radius:"md"}),e.jsx(t.Button,{variant:"filled",color:"blue",onClick:w,fullWidth:!0,radius:"md",disabled:!I,children:"Send invitations"})]})]})}),no=n=>{switch(n){case"member":return"green";case"invited":return"orange";case"declined":return"red";case"revoked":return"red";case"expired":return"red";default:return"gray"}},to=n=>{switch(n){case"member":return"Member";case"invited":return"Invited";case"declined":return"Declined";case"revoked":return"Revoked";case"expired":return"Expired";default:return"Unknown"}},oo=n=>{if(n){if(typeof n=="object"&&"type"in n)return n;if(typeof n=="string")return{type:"image",value:n}}},ye=({user:n,isSelected:r=!1,onToggle:o,onUpdateRole:s,onRemoveUser:a,roleOptions:i=[],variant:c="invited",onClick:d})=>{var I;const l=((I=n.name)==null?void 0:I.trim())||n.email,f=()=>{o&&o(n.id)},h=b=>{if(s){const v=b;s(n.id,v)}},g=c==="suggested"||c==="read-only",x=c==="invited"&&i.length>0,[y,p]=u.useState(!1),m=()=>{d==null||d()};return e.jsxs(t.Group,{justify:"space-between",align:"center",wrap:"nowrap",w:"100%",style:{cursor:"pointer",borderRadius:"var(--mantine-radius-md)",padding:"6px"},onClick:m,bg:y?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[e.jsxs(t.Group,{gap:"sm",w:"100%",align:"flex-start",wrap:"nowrap",children:[e.jsx(se,{avatar:oo(n.avatar),size:"md",placeholder:l,showPlaceholder:!0}),e.jsxs(t.Stack,{gap:0,w:"100%",justify:"flex-start",align:"flex-start",children:[e.jsxs(t.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsxs(t.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsx(t.Text,{size:"sm",fw:500,lineClamp:1,mb:-2,children:l}),n.isCurrentUser&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"gray",radius:"sm",children:"Owner"})]}),n.status!=="member"&&e.jsx(t.Badge,{size:"xs",variant:"light",color:no(n.status),radius:"sm",children:to(n.status)})]}),e.jsx(t.Text,{size:"xs",c:"dimmed",lineClamp:1,children:n.email})]})]}),e.jsxs(t.Group,{gap:"sm",align:"center",children:[g&&c!=="read-only"&&e.jsx(t.Radio,{checked:r,onChange:f,size:"sm",onClick:b=>b.stopPropagation(),pr:4}),x&&!n.isCurrentUser&&e.jsx(Re,{value:n.role,onChange:h,data:i,placeholder:"Select role",defaultOption:i.find(b=>b.value===n.role),withRemove:!0,onRemove:()=>a==null?void 0:a(n.id)})]})]})},kn=({opened:n,onClose:r,onInvite:o,onUpdateRole:s,onRemoveUser:a,invitedUsers:i=[],children:c,roleOptions:d=[],suggestedUsers:l=[]})=>{const f=u.useRef(null),{emails:h,setEmails:g,selectedUsers:x,inputText:y,setInputText:p,tagDisplayMap:m,selectedRole:I,setSelectedRole:b,selectedTab:v,setSelectedTab:S,tabHovered:w,setTabHovered:B,filteredUsers:M,handleInvite:k,handleUpdateRole:j,handleRemoveUser:R,handleToggleUser:D,handleAddSuggestedUser:O}=wn({onInvite:o,onUpdateRole:s,onRemoveUser:a,invitedUsers:i,suggestedUsers:l,roleOptions:d}),E=L=>{O(L),f.current&&f.current.clearInput()},N=e.jsxs(e.Fragment,{children:[e.jsx(Sn,{ref:f,value:h,onChange:g,onInvite:k,roleOptions:d,selectedRole:I,onRoleChange:b,onInputChange:p,suggestedUsers:l,tagDisplayMap:m}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.ScrollArea,{mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:i.map(L=>e.jsx(ye,{user:L,isSelected:x.includes(L.id),onToggle:D,onUpdateRole:j,onRemoveUser:R,roleOptions:d,variant:"invited"},L.id))})]})})}),M.length>0&&e.jsx(t.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:M.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",y.trim()&&`(filtered by "${y}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:M.map(L=>e.jsx(ye,{user:L,isSelected:x.includes(L.id),onToggle:D,onUpdateRole:j,onRemoveUser:R,roleOptions:d,variant:"suggested",onClick:()=>E(L)},L.id))})]}):null})})]}),$=e.jsx(e.Fragment,{children:e.jsxs(t.Stack,{gap:"md",p:"sm",children:[e.jsxs(t.Stack,{gap:4,align:"center",children:[e.jsx(t.Text,{size:"sm",fw:500,ta:"center",children:"Publish to the web"}),e.jsx(t.Text,{size:"sm",fw:500,color:"var(--mantine-color-gray-6)",ta:"center",children:"Anyone with the link can view this page"})]}),e.jsx(t.Button,{variant:"filled",size:"xs",radius:"md",fw:500,fz:"var(--mantine-font-size-sm)",ta:"center",children:"Publish"})]})}),P=e.jsx(t.Box,{style:{width:"400px",maxHeight:"600px",overflow:"visible"},children:e.jsx(t.Stack,{gap:"lg",children:e.jsxs(t.Tabs,{color:"black",defaultValue:"invite",styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(t.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",children:[e.jsx(t.Tabs.Tab,{value:"invite",p:0,pb:6,onClick:()=>{S("invite")},onMouseEnter:()=>B("invite"),onMouseLeave:()=>B(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:w==="invite"?"var(--mantine-color-gray-1)":"transparent",color:v==="invite"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:"Invite"})}),e.jsx(t.Tabs.Tab,{value:"publish",p:0,pb:6,onClick:()=>{S("publish")},onMouseEnter:()=>B("publish"),onMouseLeave:()=>B(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:w==="publish"?"var(--mantine-color-gray-1)":"transparent",color:v==="publish"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:"Publish"})})]}),e.jsx(t.Tabs.Panel,{value:"invite",children:e.jsx(t.Box,{p:"sm",children:N})}),e.jsx(t.Tabs.Panel,{value:"publish",children:e.jsx(t.Box,{p:"sm",children:$})})]})})});return e.jsx(Ie,{trigger:c,menuItems:[],opened:n,onClose:r,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:P})},ro=({onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s,currentUser:a,roleOptions:i,suggestedUsers:c,label:d="Share"})=>{const[l,f]=u.useState(!1),h=()=>f(!1),g=e.jsx(Te,{label:d,onClick:()=>f(!0),isActive:l});return e.jsx(kn,{opened:l,onClose:h,onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s,currentUser:a,roleOptions:i,suggestedUsers:c,children:g})},so=({opened:n,onClose:r,onInvite:o,onUpdateRole:s,onRemoveUser:a,invitedUsers:i=[],roleOptions:c=[],suggestedUsers:d=[]})=>{const l=u.useRef(null),{emails:f,setEmails:h,selectedUsers:g,inputText:x,setInputText:y,tagDisplayMap:p,selectedRole:m,setSelectedRole:I,filteredUsers:b,handleInvite:v,handleUpdateRole:S,handleRemoveUser:w,handleToggleUser:B,handleAddSuggestedUser:M}=wn({onInvite:o,onUpdateRole:s,onRemoveUser:a,invitedUsers:i,suggestedUsers:d,roleOptions:c}),k=j=>{M(j),l.current&&l.current.clearInput()};return e.jsx(t.Modal,{opened:n,onClose:r,size:"md",withCloseButton:!1,radius:"md",centered:!0,closeOnClickOutside:!1,closeOnEscape:!0,trapFocus:!1,zIndex:300,children:e.jsxs(t.Stack,{gap:"lg",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Text,{size:"md",fw:500,c:"var(--mantine-color-gray-8)",children:"Share"}),e.jsx(K,{icon:C.IconX,size:"md",onClick:r,color:"var(--mantine-color-gray-8)"})]}),e.jsx(Sn,{ref:l,value:f,onChange:h,onInvite:v,roleOptions:c,selectedRole:m,onRoleChange:I,onInputChange:y,suggestedUsers:d,tagDisplayMap:p}),i.length>0&&e.jsxs(t.Box,{children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.Stack,{gap:"sm",children:i.map(j=>e.jsx(ye,{user:j,isSelected:g.includes(j.id),onToggle:B,onUpdateRole:S,onRemoveUser:w,roleOptions:c,variant:"invited"},j.id))})})]}),b.length>0&&e.jsxs(t.Box,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",x.trim()&&`(filtered by "${x}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.Stack,{gap:"sm",children:b.map(j=>e.jsx(ye,{user:j,isSelected:g.includes(j.id),onToggle:B,onUpdateRole:S,onRemoveUser:w,roleOptions:c,variant:"suggested",onClick:()=>k(j)},j.id))})})]})]})})},ao=({opened:n,onClose:r,options:o=[],onSave:s,onCancel:a,groups:i=[],styles:c})=>{const[d,l]=u.useState("");u.useEffect(()=>{n&&o.length>0?l(o[0].id):n||l("")},[n,o]);const f=()=>{s&&s(),r()},h=()=>{a&&a(),r()},g=()=>{r()},x=o.find(y=>y.id===d);return e.jsxs(t.Modal,{opened:n,onClose:g,size:"90%",centered:!0,closeOnClickOutside:!0,closeOnEscape:!0,withCloseButton:!1,p:"none",styles:{body:{...c==null?void 0:c.body,padding:0,height:"80vh"}},radius:"md",children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{style:{display:"flex",height:"100%",...c==null?void 0:c.body},children:[e.jsx(t.Box,{style:{width:"240px",backgroundColor:"var(--mantine-color-gray-0)"},children:e.jsx(t.ScrollArea,{h:"100%",children:e.jsx(t.Stack,{gap:0,p:"sm",children:i.map(y=>e.jsx(t.Box,{mb:"md",children:e.jsxs(u.Fragment,{children:[e.jsx(t.Text,{size:"xs",fw:600,c:"dimmed",m:4,children:y}),o.filter(p=>p.group===y).map(p=>e.jsx(_e,{label:p.label,icon:p.icon,onClick:()=>l(p.id),isActive:d===p.id},p.id))]},y)}))})})}),e.jsxs(t.Box,{style:{flex:1,display:"flex",flexDirection:"column"},children:[x?e.jsxs(e.Fragment,{children:[e.jsx(t.Box,{p:"md",children:e.jsx(t.Group,{gap:"md",wrap:"nowrap",children:e.jsxs(t.Stack,{gap:4,children:[e.jsx(t.Text,{size:"md",fw:600,children:x.alternateLabel||x.label}),x.description&&e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",children:x.description})]})})}),e.jsx(t.ScrollArea,{style:{flex:1},children:e.jsx(t.Box,{px:"md",children:x.content})})]}):e.jsx(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:e.jsx(t.Text,{c:"var(--mantine-color-gray-6)",size:"lg",children:"Select an option from the sidebar"})}),(x==null?void 0:x.saveButton)&&e.jsx(t.Box,{p:"md",children:e.jsxs(t.Group,{justify:"flex-end",gap:"md",children:[e.jsx(t.Button,{variant:"subtle",onClick:h,color:"gray",children:"Cancel"}),e.jsx(t.Button,{onClick:f,color:"blue",children:"Save Changes"})]})})]})]})]})},io=(n,r="es")=>{const o=new Date,s=typeof n=="string"?new Date(n):n,a=Math.floor((o.getTime()-s.getTime())/1e3),i={es:{now:"ahora",seconds:"segundos",second:"segundo",minutes:"minutos",minute:"minuto",hours:"horas",hour:"hora",days:"días",day:"día",weeks:"semanas",week:"semana",months:"meses",month:"mes",years:"años",year:"año",ago:"hace"},en:{now:"now",seconds:"seconds",second:"second",minutes:"minutes",minute:"minute",hours:"hours",hour:"hour",days:"days",day:"day",weeks:"weeks",week:"week",months:"months",month:"month",years:"years",year:"year",ago:"ago"}},c=i[r]||i.en;if(a<5)return c.now;if(a<60)return r==="es"?`${c.ago} ${a} ${a===1?c.second:c.seconds}`:`${a} ${a===1?c.second:c.seconds} ${c.ago}`;const d=Math.floor(a/60);if(d<60)return r==="es"?`${c.ago} ${d} ${d===1?c.minute:c.minutes}`:`${d} ${d===1?c.minute:c.minutes} ${c.ago}`;const l=Math.floor(d/60);if(l<24)return r==="es"?`${c.ago} ${l} ${l===1?c.hour:c.hours}`:`${l} ${l===1?c.hour:c.hours} ${c.ago}`;const f=Math.floor(l/24);if(f<7)return r==="es"?`${c.ago} ${f} ${f===1?c.day:c.days}`:`${f} ${f===1?c.day:c.days} ${c.ago}`;const h=Math.floor(f/7);if(h<4)return r==="es"?`${c.ago} ${h} ${h===1?c.week:c.weeks}`:`${h} ${h===1?c.week:c.weeks} ${c.ago}`;const g=Math.floor(f/30);if(g<12)return r==="es"?`${c.ago} ${g} ${g===1?c.month:c.months}`:`${g} ${g===1?c.month:c.months} ${c.ago}`;const x=Math.floor(f/365);return r==="es"?`${c.ago} ${x} ${x===1?c.year:c.years}`:`${x} ${x===1?c.year:c.years} ${c.ago}`},co=(n,r="es")=>{const o=typeof n=="string"?new Date(n):n,s={es:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],en:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},i=(s[r]||s.en)[o.getMonth()],c=o.getDate();return r==="es"?`${c} ${i}`:`${i} ${c}`},lo=n=>{const r=typeof n=="string"?new Date(n):n,o=new Date;return r.toDateString()===o.toDateString()},uo=n=>{const r=typeof n=="string"?new Date(n):n,o=new Date;return o.setDate(o.getDate()-1),r.toDateString()===o.toDateString()},fo=(n,r="es")=>lo(n)?r==="es"?"Hoy":"Today":uo(n)?r==="es"?"Ayer":"Yesterday":io(n,r),ho=({notification:n,message:r,markAsRead:o,archiveNotification:s,children:a,actions:i})=>{var h,g,x,y,p;const c=new Date().getTime()-new Date(n.timestamp).getTime()<6048e5?fo(n.timestamp,"en"):co(n.timestamp,"en"),[d,l]=u.useState(!1),f=e.jsxs(t.Group,{bg:"var(--mantine-color-gray-1)",p:4,style:{borderRadius:"var(--mantine-radius-md)"},w:"auto",wrap:"nowrap",gap:0,children:[!n.isRead&&e.jsx(K,{onClick:()=>o(n.id),icon:C.IconCheck}),!n.isArchived&&e.jsx(K,{onClick:()=>s(n.id),icon:C.IconArchive})]});return e.jsxs(t.Box,{p:"sm",bg:d?"var(--mantine-color-gray-0)":"white",style:{cursor:"pointer",borderTop:"1px solid var(--mantine-color-gray-2)"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[e.jsxs(t.Group,{justify:"space-between",align:"flex-start",gap:"sm",wrap:"nowrap",style:{margin:0},children:[(h=n.metadata)!=null&&h.avatar_url?e.jsx(t.Avatar,{name:(g=n.metadata)==null?void 0:g.fullname,size:"sm",radius:"md",src:(x=n.metadata)==null?void 0:x.avatar_url}):e.jsx(ln,{size:"xs",showText:!1,radius:"xs"}),e.jsxs(t.Stack,{gap:"xs",justify:"flex-start",w:"100%",children:[e.jsx(t.Box,{fz:"sm",m:0,style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis",minHeight:"unset",height:"auto",whiteSpace:"normal",wordBreak:"break-word"},children:r}),e.jsxs(t.Text,{size:"xs",c:"dimmed",fw:500,style:{whiteSpace:"nowrap"},children:[n.category?((y=n.category)==null?void 0:y.charAt(0).toUpperCase())+((p=n.category)==null?void 0:p.slice(1)):""," ","• ",c]})]}),d?f:!n.isRead&&e.jsx(t.Indicator,{color:"var(--mantine-color-blue-6)",size:10,position:"top-end"})]}),a,i&&e.jsx(t.Group,{justify:"flex-start",align:"flex-start",gap:"xs",wrap:"nowrap",pl:36,pt:8,children:i})]})},po=(n,r,o,s,a)=>{const[i,c]=u.useState(!1),d=u.useRef(null),l=u.useRef(null),f=u.useRef(null);u.useEffect(()=>{c(n)},[n]);const h=u.useCallback(x=>{x[0].isIntersecting&&s&&!a&&o&&o()},[s,a,o]),g=u.useCallback(()=>{if(!(!d.current||!n||!r||!o)){l.current&&(l.current.disconnect(),l.current=null);try{const x=new IntersectionObserver(h,{threshold:.1,rootMargin:"50px"});x.observe(d.current),l.current=x}catch(x){console.error("Failed to setup intersection observer:",x)}}},[n,r,o,h]);return u.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),!n||!r||!o){l.current&&(l.current.disconnect(),l.current=null);return}if(!d.current){f.current=setTimeout(()=>g(),50);return}return g(),()=>{f.current&&(clearTimeout(f.current),f.current=null),l.current&&(l.current.disconnect(),l.current=null)}},[n,r,o,g]),u.useEffect(()=>()=>{f.current&&clearTimeout(f.current),l.current&&l.current.disconnect()},[]),{isActive:i,loadMoreRef:d}},xo=({notifications:n,isLoading:r=!1,isLoadingMore:o=!1,hasMore:s=!1,unreadCount:a=0,markAllAsRead:i,archiveAllNotifications:c,markAsRead:d,archiveNotification:l,loadMore:f,onFilterChange:h,currentFilter:g="all",customRenderer:x,opened:y=!1,onOpen:p=()=>{},onClose:m=()=>{},enableInfiniteScroll:I=!0})=>{const b=[{children:"Mark all as read",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>i()},{children:"Archive all",leftSection:e.jsx(C.IconArchive,{size:16}),onClick:()=>c()}],v=[{children:"All",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("all"),active:g==="all"},{children:"Unread",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("unread"),active:g==="unread"},{children:"Archived",leftSection:e.jsx(C.IconArchive,{size:16}),onClick:()=>h==null?void 0:h("archived"),active:g==="archived"}],S=M=>x&&M.category&&["welcome","upgrade"].includes(M.category)?x(M,d,l):e.jsx(ho,{notification:M,markAsRead:d,archiveNotification:l,message:M.message,actions:M.actions},M.id),{isActive:w,loadMoreRef:B}=po(y,I,f||(()=>{}),s,o);return e.jsxs(e.Fragment,{children:[e.jsx(_e,{isActive:w,icon:e.jsx(C.IconBell,{strokeWidth:2,size:20,color:"var(--mantine-color-gray-7)"}),onClick:()=>{y?m():p()},disabled:!1,variant:"subtle",color:"gray",fullWidth:!0,style:{borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},label:"Inbox",indicator:a>0?a>99?"99+":a:void 0}),e.jsxs(t.Drawer,{opened:y,onClose:m,position:"left",size:400,style:{position:"relative",left:300,zIndex:0,borderLeft:"1px solid var(--mantine-color-gray-2)"},withCloseButton:!1,padding:0,withOverlay:!0,closeOnClickOutside:!0,closeOnEscape:!0,overlayProps:{backgroundOpacity:0,blur:0},children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{p:0,h:"100%",style:{display:"flex",flexDirection:"column"},children:[e.jsx(t.Box,{style:{position:"sticky",top:0,zIndex:10,backgroundColor:"var(--mantine-color-white)"},children:e.jsxs(t.Group,{justify:"space-between",align:"center",gap:"xs",style:{borderRadius:"var(--mantine-radius-md)"},px:"sm",py:"md",children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Inbox"}),e.jsxs(t.Group,{gap:"xs",children:[e.jsx(Ie,{position:"bottom-end",menuItems:v,trigger:e.jsx(K,{icon:C.IconFilter})}),e.jsx(Ie,{position:"bottom-end",menuItems:b,trigger:e.jsx(K,{onClick:()=>{},icon:C.IconDots,changeIconOnHover:!0,iconHovered:C.IconDots})})]})]})}),e.jsxs(t.Box,{style:{flex:1,overflow:"auto"},children:[r&&n.length===0?e.jsx(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:e.jsx(t.Loader,{})}):n.length>0?e.jsx(t.Stack,{gap:0,children:n.map(M=>S(M))}):e.jsxs(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(C.IconInbox,{size:24,color:"var(--mantine-color-gray-6)"}),e.jsx(t.Text,{size:"sm",fw:500,c:"dimmed",ta:"center",mt:"sm",children:"No new updates"})]}),e.jsx(t.Box,{ref:B,style:{padding:"16px",display:I?"flex":"none",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:o&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]})}),o&&!I&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]}),!I&&s&&f&&e.jsx(t.Button,{color:"var(--mantine-color-gray-3)",variant:"subtle",onClick:f,loading:o,disabled:o,style:{alignSelf:"center"},children:o?"Loading...":"Load More"})]})]})]})]})},Ve=({header:n,body:r,footer:o,withBorder:s=!0,position:a="left",bg:i="var(--mantine-color-gray-0)"})=>{const[c,d]=u.useState(!1),l=()=>{if(!s)return{};const f="var(--mantine-color-gray-3)",h="1px";return a==="left"?{borderRight:`${h} solid ${f}`}:a==="right"?{borderLeft:`${h} solid ${f}`}:{}};return e.jsxs(t.Stack,{gap:"sm",h:"100%",p:"sm",bg:i,style:l(),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[n&&e.jsx(t.Box,{children:typeof n=="function"?n({hovered:c}):n}),r&&e.jsx(t.Box,{style:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:typeof r=="function"?r({hovered:c}):r}),o&&e.jsx(t.Box,{children:typeof o=="function"?o({hovered:c}):o})]})},Cn=u.createContext(void 0),mo=({children:n})=>{const[r,{open:o,close:s}]=ge.useDisclosure(!1),a={openedNotificationSidebar:r,openNotificationSidebar:o,closeNotificationSidebar:s};return e.jsx(Cn.Provider,{value:a,children:n})},go=()=>{const n=u.useContext(Cn);if(n===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return n},Mn=({workspace:n,currentUserId:r,currentWorkspaceId:o,onClick:s})=>{const a=o===n.id,i=r&&n.ownerId===r;return e.jsxs(t.Box,{onClick:s,style:{display:"flex",alignItems:"center",padding:"6px",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",gap:"8px",width:"100%",boxSizing:"border-box"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent"},children:[e.jsx(se,{size:"xs",avatar:typeof n.avatar=="string"?{type:"image",value:n.avatar}:n.avatar,placeholder:n.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:n.name}),e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0,paddingLeft:"8px"},children:[a&&e.jsx(C.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),i&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},Io="workspace-selector-module__menuItem___FSB6P",yo="workspace-selector-module__workspaceButton___-P6kp",vo="workspace-selector-module__workspaceText___YDAlj",jo="workspace-selector-module__scrollWrapper___MzrJY",He={menuItem:Io,workspaceButton:yo,workspaceText:vo,scrollWrapper:jo},bo=({workspaces:n=[],currentWorkspace:r,currentUserId:o,isLoading:s=!1,error:a=null,onWorkspaceSelect:i,onCreateWorkspace:c,emptyMessage:d="No workspaces found",loadingMessage:l="Loading workspaces...",errorMessage:f="Failed to load workspaces",className:h,onCloseSidebar:g,sidebarHovered:x=!1,children:y,menuItems:p})=>{const[m,I]=u.useState(!1),[b,v]=u.useState(""),S=u.useMemo(()=>b?n.filter(k=>{var j;return k.name.toLowerCase().includes(b.toLowerCase())||((j=k.ownerEmail)==null?void 0:j.toLowerCase().includes(b.toLowerCase()))}):n,[n,b]),w=k=>{i==null||i(k.id),I(!1),v("")};if(s)return e.jsxs(t.Group,{gap:"xs",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"dimmed",children:l})]});if(a)return e.jsx(t.Alert,{color:"red",title:"Error",children:f});const[B,M]=u.useState(x);return n.length===0&&!s&&!a?e.jsx(t.Box,{children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:d})}):e.jsxs(t.Menu,{opened:m,onOpen:()=>I(!0),onClose:()=>I(!1),position:"bottom-start",styles:{dropdown:{width:"350px",overflow:"hidden"}},withinPortal:!0,children:[e.jsx(t.Menu.Target,{children:e.jsx(t.Box,{w:"100%",onClick:()=>I(!m),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${He.workspaceButton} ${h||""}`,bg:B||m?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",style:{width:"100%",overflow:"hidden"},children:r?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:"xs",avatar:typeof r.avatar=="string"?{type:"image",value:r.avatar}:r.avatar,placeholder:r.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:r.name}),e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{flexShrink:0},children:[e.jsx(t.ActionIcon,{radius:"md",size:"md",color:"gray",variant:"subtle",onClick:()=>I(!m),children:e.jsx(C.IconChevronDown,{size:20,strokeWidth:2,color:"var(--mantine-color-gray-7)"})}),(B||x)&&e.jsx(K,{icon:C.IconChevronsLeft,size:"md",color:"gray",variant:"subtle",onClick:()=>{g==null||g()}})]})]}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"Select workspace"})})})}),e.jsx(t.Menu.Dropdown,{style:{borderRadius:"var(--mantine-radius-md)"},p:0,children:e.jsxs(t.Stack,{gap:0,children:[y,e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),e.jsx(t.Stack,{gap:0,px:4,children:S.length===0?e.jsx(t.Menu.Item,{disabled:!0,children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:d})}):e.jsxs(e.Fragment,{children:[e.jsxs(t.Group,{justify:"space-between",align:"center",p:4,children:[e.jsx(t.Text,{size:"xs",c:"dimmed",fw:500,p:4,truncate:!0,children:"Workspaces"}),c&&e.jsx(t.Anchor,{onClick:()=>{c(),I(!1)},size:"xs",underline:"never",fw:500,p:4,truncate:!0,style:{display:"flex",alignItems:"center",gap:"4px"},children:"Add"})]}),e.jsx("div",{className:He.scrollWrapper,children:e.jsx(t.ScrollArea,{mah:150,scrollbarSize:6,scrollHideDelay:0,children:e.jsx(t.Stack,{gap:0,mb:6,children:S.map(k=>e.jsx(t.Box,{onClick:()=>w(k),className:He.menuItem,style:{padding:0,borderRadius:"var(--mantine-radius-md)",cursor:"pointer",overflow:"hidden"},onMouseEnter:j=>{j.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(Mn,{workspace:k,currentUserId:o,currentWorkspaceId:r==null?void 0:r.id,onClick:()=>w(k)})},k.id))})})})]})}),p&&e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),p&&e.jsx(t.Box,{p:4,children:p==null?void 0:p.map(k=>e.jsx(t.MenuItem,{onClick:k.onClick,leftSection:k.icon,children:k.label,color:k.color,"data-danger":k.color,fw:500,style:{height:"40px",borderRadius:"var(--mantine-radius-md)",padding:"6px"}},k.label))})]})})]})},Tn=({children:n,style:r,...o})=>e.jsx(t.Box,{style:{backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",minHeight:"20vh",width:"100%",flex:"1 1 0%",minWidth:0,maxWidth:"none",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",...r},...o,children:n});Tn.displayName="MatrixCenter";const Bn=({children:n,style:r,size:o="50px",state:s="empty",onStateChange:a,interactive:i=!0,...c})=>{const[d,l]=u.useState(s),[f,h]=u.useState(!1),g=a?s:i?d:s,x=()=>{if(!i)return;const m=["empty","outline","filled"],b=(m.indexOf(g)+1)%m.length,v=m[b];a?a(v):l(v)},y=()=>{switch(g){case"empty":return null;case"outline":return e.jsx(C.IconPoint,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});case"filled":return e.jsx(C.IconPointFilled,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});default:return null}},p=()=>{switch(g){case"empty":return"var(--mantine-color-gray-2)";case"outline":return"var(--mantine-color-blue-0)";case"filled":return"var(--mantine-color-green-0)";default:return"var(--mantine-color-gray-2)"}};return e.jsx(t.Box,{style:{width:o,height:o,backgroundColor:p(),borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center",cursor:i?"pointer":"default",transition:"all 0.2s ease",boxShadow:f&&i?"0 2px 8px rgba(0, 0, 0, 0.15)":"none",transform:f&&i?"translateY(-1px)":"translateY(0)",border:g==="outline"?"2px solid var(--mantine-color-gray-0)":"2px solid transparent",...r},onClick:x,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),...c,children:n||y()})};Bn.displayName="MatrixCell";const On=({children:n,style:r,size:o="50px",blockId:s,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!1),x.current&&(clearTimeout(x.current),x.current=null),y.current=!1};return e.jsx(t.Box,{style:{width:o,height:"100%",minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};On.displayName="MatrixBlockLeft";const zn=({children:n,style:r,size:o="50px",blockId:s,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!1),x.current&&(clearTimeout(x.current),x.current=null),y.current=!1};return e.jsx(t.Box,{style:{width:o,height:"100%",minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};zn.displayName="MatrixBlockRight";const Rn=({children:n,style:r,size:o="50px",blockId:s,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!1),x.current&&(clearTimeout(x.current),x.current=null),y.current=!1};return e.jsx(t.Box,{style:{width:"100%",height:o,minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};Rn.displayName="MatrixBlockUp";const Dn=({children:n,style:r,size:o="50px",blockId:s,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!1),x.current&&(clearTimeout(x.current),x.current=null),y.current=!1};return e.jsx(t.Box,{style:{width:"100%",height:o,minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};Dn.displayName="MatrixBlockDown";const En=({onLeftHover:n,onRightHover:r,onUpHover:o,onDownHover:s,showLeftControls:a=!1,showRightControls:i=!1,showUpControls:c=!1,showDownControls:d=!1})=>{const[l,f]=u.useState(!1),[h,g]=u.useState(!1),[x,y]=u.useState(!1),[p,m]=u.useState(!1),I=w=>{f(w),n==null||n(w)},b=w=>{g(w),r==null||r(w)},v=w=>{y(w),o==null||o(w)},S=w=>{m(w),s==null||s(w)};return e.jsxs(e.Fragment,{children:[a&&e.jsx(t.Box,{style:{position:"absolute",left:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)}),i&&e.jsx(t.Box,{style:{position:"absolute",right:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1)}),c&&e.jsx(t.Box,{style:{position:"absolute",top:0,left:0,right:0,height:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1)}),d&&e.jsx(t.Box,{style:{position:"absolute",bottom:0,left:0,right:0,height:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1)})]})};En.displayName="HoverZones";const An=({onLeftPrevious:n,onLeftNext:r,leftCurrentPage:o=1,leftTotalPages:s=1,leftDisabled:a=!1,leftVisible:i=!1,onLeftHover:c,onRightPrevious:d,onRightNext:l,rightCurrentPage:f=1,rightTotalPages:h=1,rightDisabled:g=!1,rightVisible:x=!1,onRightHover:y,onUpPrevious:p,onUpNext:m,upCurrentPage:I=1,upTotalPages:b=1,upDisabled:v=!1,upVisible:S=!1,onUpHover:w,onDownPrevious:B,onDownNext:M,downCurrentPage:k=1,downTotalPages:j=1,downDisabled:R=!1,downVisible:D=!1,onDownHover:O,onLeftAdd:E,onRightAdd:N,onUpAdd:$,onDownAdd:P,size:L="md",inline:V=!1})=>{const U=()=>s<=1||a?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:()=>n==null?void 0:n(),disabled:o<=1,color:"gray",radius:"md","aria-label":"Previous left blocks",children:e.jsx(C.IconChevronRight,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:E,color:"blue",radius:"md","aria-label":"Add left blocks",children:e.jsx(C.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:r,disabled:o>=s,color:"gray",radius:"md","aria-label":"Next left blocks",children:e.jsx(C.IconChevronLeft,{size:16,stroke:2})})]}),G=()=>h<=1||g?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:d,disabled:f<=1,color:"gray",radius:"md","aria-label":"Previous right blocks",children:e.jsx(C.IconChevronLeft,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:N,color:"blue",radius:"md","aria-label":"Add right blocks",children:e.jsx(C.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:l,disabled:f>=h,color:"gray",radius:"md","aria-label":"Next right blocks",children:e.jsx(C.IconChevronRight,{size:16,stroke:2})})]}),H=()=>b<=1||v?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:p,disabled:I<=1,color:"gray",radius:"md","aria-label":"Previous up blocks",children:e.jsx(C.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:$,color:"blue",radius:"md","aria-label":"Add up blocks",children:e.jsx(C.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:m,disabled:I>=b,color:"gray",radius:"md","aria-label":"Next up blocks",children:e.jsx(C.IconChevronUp,{size:16,stroke:2})})]}),Q=()=>j<=1||R?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:B,disabled:k<=1,color:"gray",radius:"md","aria-label":"Previous down blocks",children:e.jsx(C.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:P,color:"blue",radius:"md","aria-label":"Add down blocks",children:e.jsx(C.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:M,disabled:k>=j,color:"gray",radius:"md","aria-label":"Next down blocks",children:e.jsx(C.IconChevronUp,{size:16,stroke:2})})]}),T=s>1&&!a,z=h>1&&!g,A=b>1&&!v,F=j>1&&!R;return!T&&!z&&!A&&!F?null:V?e.jsxs(e.Fragment,{children:[T&&i&&n&&r&&e.jsx("div",{onMouseEnter:()=>c==null?void 0:c(!0),onMouseLeave:()=>c==null?void 0:c(!1),children:U()}),z&&x&&d&&l&&e.jsx("div",{onMouseEnter:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:G()}),A&&S&&p&&m&&e.jsx("div",{onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:H()}),F&&D&&B&&M&&e.jsx("div",{onMouseEnter:()=>O==null?void 0:O(!0),onMouseLeave:()=>O==null?void 0:O(!1),children:Q()})]}):e.jsxs(e.Fragment,{children:[T&&i&&n&&r&&e.jsx(t.Box,{style:{position:"absolute",left:"20px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto",opacity:i?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>c==null?void 0:c(!0),onMouseLeave:()=>c==null?void 0:c(!1),children:U()}),z&&x&&d&&l&&e.jsx(t.Box,{style:{position:"absolute",right:"20px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto",opacity:x?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:G()}),A&&S&&p&&m&&e.jsx(t.Box,{style:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:S?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:H()}),e.jsx(t.Box,{style:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:D?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>O==null?void 0:O(!0),onMouseLeave:()=>O==null?void 0:O(!1),children:F&&D&&B&&M&&Q()})]})};An.displayName="NavigationControls";const Se=({direction:n,text:r,show:o,actions:s,currentPage:a,totalPages:i,disabled:c,hoverState:d,onHover:l})=>{if(!r)return null;const f={left:{position:"absolute",left:"20px",top:"50%",transform:"translateY(-50%)"},right:{position:"absolute",right:"20px",top:"50%",transform:"translateY(-50%)"},up:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)"},down:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)"}},h={left:{onLeftPrevious:s.prev,onLeftNext:s.next,leftCurrentPage:a,leftTotalPages:i,leftDisabled:c,leftVisible:!0},right:{onRightPrevious:s.prev,onRightNext:s.next,rightCurrentPage:a,rightTotalPages:i,rightDisabled:c,rightVisible:!0},up:{onUpPrevious:s.prev,onUpNext:s.next,upCurrentPage:a,upTotalPages:i,upDisabled:c,upVisible:!0},down:{onDownPrevious:s.prev,onDownNext:s.next,downCurrentPage:a,downTotalPages:i,downDisabled:c,downVisible:!0}};return e.jsxs("div",{style:{...f[n],zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",width:"80px",height:"60px"},children:[e.jsx("div",{style:{color:"var(--mantine-color-gray-6)",fontSize:"14px",fontWeight:"500",opacity:d?0:1,transition:"opacity 0.2s ease",position:"absolute"},children:r}),o&&e.jsx("div",{style:{opacity:d?1:0,transition:"opacity 0.2s ease",position:"absolute"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:e.jsx(An,{...h[n],size:"sm",showLabels:!0,inline:!0})})]})},wo=n=>{const{totalBlocksLeft:r=0,totalBlocksRight:o=0,totalBlocksUp:s=0,totalBlocksDown:a=0,visibleBlocksLeft:i=1,visibleBlocksRight:c=1,visibleBlocksUp:d=1,visibleBlocksDown:l=1}=n,f=u.useMemo(()=>{const p=Math.max(1,Math.ceil(r/i)),m=Math.max(1,Math.ceil(o/c)),I=Math.max(1,Math.ceil(s/d)),b=Math.max(1,Math.ceil(a/l));return{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b,leftStartIndex:0,leftEndIndex:0,rightStartIndex:0,rightEndIndex:0,upStartIndex:0,upEndIndex:0,downStartIndex:0,downEndIndex:0}},[r,o,s,a,i,c,d,l]),[h,g]=u.useState({leftStartIndex:0,rightStartIndex:0,upStartIndex:0,downStartIndex:0}),x=u.useMemo(()=>{const{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b}=f,v=Math.min(h.leftStartIndex,Math.max(0,r-i)),S=Math.min(v+i,r),w=Math.min(h.rightStartIndex,Math.max(0,o-c)),B=Math.min(w+c,o),M=Math.min(h.upStartIndex,Math.max(0,s-d)),k=Math.min(M+d,s),j=Math.min(h.downStartIndex,Math.max(0,a-l)),R=Math.min(j+l,a);return{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b,leftStartIndex:v,leftEndIndex:S,rightStartIndex:w,rightEndIndex:B,upStartIndex:M,upEndIndex:k,downStartIndex:j,downEndIndex:R}},[h,f,i,c,d,l,r,o,s,a]),y={goToLeftPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*i);g(I=>({...I,leftStartIndex:Math.min(m,Math.max(0,r-i))}))},[i,r]),goToRightPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*c);g(I=>({...I,rightStartIndex:Math.min(m,Math.max(0,o-c))}))},[c,o]),goToUpPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*d);g(I=>({...I,upStartIndex:Math.min(m,Math.max(0,s-d))}))},[d,s]),goToDownPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*l);g(I=>({...I,downStartIndex:Math.min(m,Math.max(0,a-l))}))},[l,a]),nextLeftPage:u.useCallback(()=>{g(p=>({...p,leftStartIndex:Math.min(p.leftStartIndex+1,Math.max(0,r-i))}))},[r,i]),previousLeftPage:u.useCallback(()=>{g(p=>({...p,leftStartIndex:Math.max(p.leftStartIndex-1,0)}))},[]),nextRightPage:u.useCallback(()=>{g(p=>({...p,rightStartIndex:Math.min(p.rightStartIndex+1,Math.max(0,o-c))}))},[o,c]),previousRightPage:u.useCallback(()=>{g(p=>({...p,rightStartIndex:Math.max(p.rightStartIndex-1,0)}))},[]),nextUpPage:u.useCallback(()=>{g(p=>({...p,upStartIndex:Math.min(p.upStartIndex+1,Math.max(0,s-d))}))},[s,d]),previousUpPage:u.useCallback(()=>{g(p=>({...p,upStartIndex:Math.max(p.upStartIndex-1,0)}))},[]),nextDownPage:u.useCallback(()=>{g(p=>({...p,downStartIndex:Math.min(p.downStartIndex+1,Math.max(0,a-l))}))},[a,l]),previousDownPage:u.useCallback(()=>{g(p=>({...p,downStartIndex:Math.max(p.downStartIndex-1,0)}))},[])};return[h,y,x]},So=(n,r=0,o=0,s=0,a=0)=>{const[i,c]=u.useState({width:typeof window<"u"?window.innerWidth:1920,height:typeof window<"u"?window.innerHeight:1080});return u.useEffect(()=>{if(typeof window>"u")return;const l=()=>{c({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),u.useMemo(()=>{const{gap:l,cellSize:f,minBlocksPerSide:h=2,maxBlocksPerSide:g=15,minBlocksLeft:x=1,maxBlocksLeft:y=8,minBlocksRight:p=1,maxBlocksRight:m=8,minBlocksUp:I=1,maxBlocksUp:b=8,minBlocksDown:v=1,maxBlocksDown:S=8,responsiveCellSize:w=!1,minCellSize:B="30px",maxCellSize:M="80px"}=n,k=parseFloat(l.replace("px","")),j=parseFloat(f.replace("px","")),R=i.width-k*4,D=i.height-k*4,O=j+k,E=Math.floor(R/(2*O)),N=j+k,$=Math.floor(D/N)+2,P=Math.min(E,$),L=Math.max(h,Math.min(g,P)),V=Math.max(x,Math.min(y,Math.floor(P/2))),U=Math.max(p,Math.min(m,Math.floor(P/2)));let G=f;if(w){const A=parseFloat(B.replace("px","")),F=parseFloat(M.replace("px","")),_=Math.min(R/(i.width*.8),D/(i.height*.8));G=`${Math.max(A,Math.min(F,j*_))}px`}const H=Math.min(i.width/1920,i.height/1080);let Q,T;if(s>0&&a>0){const A=Math.max(s,a);Q=Math.max(I,Math.min(b,A)),T=Q}else{const A=Math.max(I,v),F=Math.min(b,S),_=Math.max(A,Math.min(F,Math.ceil(A+(F-A)*H)));Q=_,T=_}if(Q+T+1>$){const A=Math.max(2,$-1);if(Math.max(I,v)*2>A){const _=Math.max(1,Math.floor(A/2));Q=_,T=_}else{const _=Math.max(I,v);Q=_,T=_}}return console.log("Responsive Matrix Debug:",{windowSize:i,screenSizeRatio:H,minBlocksUp:I,minBlocksDown:v,maxBlocksUp:b,maxBlocksDown:S,blocksUp:s,blocksDown:a,calculatedBlocksUp:Q,calculatedBlocksDown:T,totalVerticalBlocks:Q+T+1,isSymmetric:Q===T,availableHeight:D,maxBlocksVertical:$}),{blocksPerSide:L,blocksLeft:V,blocksRight:U,cellSize:G,blocksUp:Q,blocksDown:T}},[i,n,r,o,s,a])},ko=({gap:n,cellSize:r,blocksLeft:o,blocksRight:s,blocksUp:a,blocksDown:i,totalBlocksLeft:c,totalBlocksRight:d,totalBlocksUp:l,totalBlocksDown:f,responsive:h,minBlocksPerSide:g,maxBlocksPerSide:x,minBlocksLeft:y,maxBlocksLeft:p,minBlocksRight:m,maxBlocksRight:I,minBlocksUp:b,maxBlocksUp:v,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:B,minCellSize:M,maxCellSize:k})=>{const j=u.useMemo(()=>c!==void 0||d!==void 0||l!==void 0||f!==void 0,[c,d,l,f]),R=So({gap:n,cellSize:r,minBlocksPerSide:g,maxBlocksPerSide:x,minBlocksLeft:y,maxBlocksLeft:p,minBlocksRight:m,maxBlocksRight:I,minBlocksUp:b,maxBlocksUp:v,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:B,minCellSize:M,maxCellSize:k},o??0,s??0,a,i),D=u.useMemo(()=>{let $=h?R.blocksLeft:o??0,P=h?R.blocksRight:s??0,L=h?R.blocksUp:a??0,V=h?R.blocksDown:i??0;if(!h){const U=parseFloat(n.replace("px","")),G=parseFloat(r.replace("px","")),H=typeof window<"u"?window.innerWidth-U*4:1920,Q=typeof window<"u"?window.innerHeight-U*4:1080,T=G+U,z=Math.floor(H/(2*T)),A=Math.floor(Q/(2*T));$=Math.min($,z),P=Math.min(P,z),L=Math.min(L,A),V=Math.min(V,A)}return{left:$,right:P,up:L,down:V}},[h,R,o,s,a,i,n,r]),O=u.useMemo(()=>{const $=j&&c?Math.min(D.left,c):D.left,P=j&&d?Math.min(D.right,d):D.right,L=j&&l?Math.min(D.up,l):D.up,V=j&&f?Math.min(D.down,f):D.down;return{left:$,right:P,up:L,down:V}},[j,D,c,d,l,f]),E=h?R.cellSize:r,N=u.useMemo(()=>{const $=(O.left>0?O.left:0)+1+(O.right>0?O.right:0),P=O.up>0||O.down>0?O.up+1+O.down:1,L=`${E} `.repeat(O.left)+"1fr "+`${E} `.repeat(O.right),V=O.up>0||O.down>0?`${E} `.repeat(O.up)+"1fr "+`${E} `.repeat(O.down):"1fr";return{totalColumns:$,totalRows:P,gridTemplateColumns:L.trim(),gridTemplateRows:V.trim()}},[O,E]);return{usePagination:j,visibleBlocks:D,finalBlocks:O,finalCellSize:E,gridDimensions:N}},Co=({blockItems:n})=>{const r=u.useMemo(()=>n.reduce((a,i)=>(a[i.id]=i,a),{}),[n]);return{getBlockContent:(a,i)=>{const c=`${a}-${i}`,d=r[c];return d?d.content:u.createElement("div",{style:{padding:"4px",textAlign:"center",fontSize:"10px",writingMode:a==="left"||a==="right"?"vertical-rl":"horizontal-tb",textOrientation:"mixed",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"}})},getIntersectionText:(a,i,c,d)=>{const l=[];if(a!==null){const f=r[`left-${a}`];l.push(f?`left-${a}`:`left${a+1}`)}if(i!==null){const f=r[`right-${i}`];l.push(f?`right-${i}`:`right${i+1}`)}if(c!==null){const f=r[`up-${c}`];l.push(f?`up-${c}`:`up${c+1}`)}if(d!==null){const f=r[`down-${d}`];l.push(f?`down-${d}`:`down${d+1}`)}return l.join(", ")}}},Mo=({blockConnections:n})=>{const r=u.useMemo(()=>{const s=new Map;return n.forEach(a=>{const i=`${a.source}-${a.target}`,c=`${a.target}-${a.source}`;s.set(i,a),s.set(c,a)}),s},[n]);return{getConnectionStateFromText:s=>{const a=s.split(", ").map(i=>i.trim());for(let i=0;i<a.length;i++)for(let c=i+1;c<a.length;c++){const d=a[i],l=a[c],f=`${d}-${l}`,h=r.get(f);if(h)return h.type}return"empty"}}},To=({usePagination:n,totalBlocksLeft:r,totalBlocksRight:o,totalBlocksUp:s,totalBlocksDown:a,paginationActions:i,paginationState:c,paginationInfo:d})=>{const[l,f]=u.useState({left:!1,right:!1,up:!1,down:!1}),h=(x,y)=>{f(p=>({...p,[x]:y}))};return{hoverStates:l,handleHover:h,getNavigationControlProps:x=>{const y={left:r,right:o,up:s,down:a}[x],p={left:{prev:i.previousLeftPage,next:i.nextLeftPage},right:{prev:i.previousRightPage,next:i.nextRightPage},up:{prev:i.previousUpPage,next:i.nextUpPage},down:{prev:i.previousDownPage,next:i.nextDownPage}}[x],m={left:c.leftStartIndex,right:c.rightStartIndex,up:c.upStartIndex,down:c.downStartIndex}[x],I={left:d.leftTotalPages,right:d.rightTotalPages,up:d.upTotalPages,down:d.downTotalPages}[x];return{show:n&&!!y,totalBlocks:y,actions:p,currentPage:m+1,totalPages:I,disabled:!y,hoverState:l[x],onHover:b=>h(x,b)}}}},Bo=({blockItems:n,blockConnections:r})=>{const[o,s]=u.useState(null),[a,i]=u.useState(!1),c=u.useMemo(()=>{const m=new Map;return r.forEach(I=>{const b=`${I.source}-${I.target}`,v=`${I.target}-${I.source}`;m.set(b,I),m.set(v,I)}),m},[r]),d=u.useCallback(m=>{const I=[];return n.forEach(b=>{if(b.id!==m){const v=`${m}-${b.id}`;c.has(v)&&I.push(b.id)}}),I},[n,c]),l=u.useCallback(m=>{const I=n.find(S=>S.id===m);if(!I)return[];const b=d(m),v=[m];switch(I.type){case"up":b.forEach(S=>{const w=n.find(B=>B.id===S);w&&(w.type==="left"||w.type==="right")&&(v.push(S),d(S).forEach(M=>{const k=n.find(j=>j.id===M);k&&k.type==="down"&&v.push(M)}))});break;case"down":b.forEach(S=>{const w=n.find(B=>B.id===S);w&&(w.type==="left"||w.type==="right")&&(v.push(S),d(S).forEach(M=>{const k=n.find(j=>j.id===M);k&&k.type==="up"&&v.push(M)}))});break;case"left":b.forEach(S=>{const w=n.find(B=>B.id===S);w&&(w.type==="up"||w.type==="down")&&(v.push(S),d(S).forEach(M=>{const k=n.find(j=>j.id===M);k&&k.type==="right"&&v.push(M)}))});break;case"right":b.forEach(S=>{const w=n.find(B=>B.id===S);w&&(w.type==="up"||w.type==="down")&&(v.push(S),d(S).forEach(M=>{const k=n.find(j=>j.id===M);k&&k.type==="left"&&v.push(M)}))});break}return[...new Set(v)]},[n,d]),f=u.useCallback(m=>!0,[]),h=u.useCallback(m=>!a||!o?!1:!l(o).includes(m),[a,o,l]),g=u.useCallback(m=>!a||!o?!1:l(o).includes(m),[a,o,l]),x=u.useCallback(m=>{a&&o===m?(i(!1),s(null)):(s(m),i(!0))},[a,o]),y=u.useCallback(m=>{console.log(`Block clicked: ${m}`)},[]),p=u.useCallback(()=>{i(!1),s(null)},[]);return{selectedBlockId:o,isFiltering:a,isBlockVisible:f,isBlockDimmed:h,shouldShowBlueBorder:g,handleBlockPress:x,handleBlockClick:y,clearFiltering:p,getFilteredBlockIds:l}},en=n=>parseInt(n.replace(/[^\d]/g,""),10)||0,Oo=(n,r)=>{const[o,s]=u.useState({width:0,height:0}),a=u.useCallback(()=>{const{width:i,height:c}=o;if(i===0||c===0)return{blocksUp:r.minVerticalBlocks/2,blocksDown:r.minVerticalBlocks/2,blocksLeft:r.minHorizontalBlocks/2,blocksRight:r.minHorizontalBlocks/2,containerWidth:i,containerHeight:c};const d=en(r.cellSize),l=en(r.gap),f=d+l,h=i-l*2,g=c-l*2,x=Math.floor(g*r.verticalMaxPercent/100/f),y=Math.floor(h*r.horizontalMaxPercent/100/f),p=Math.floor(g*r.verticalMinPercent/100/f),m=Math.floor(h*r.horizontalMinPercent/100/f),I=Math.max(r.minVerticalBlocks,p),b=Math.max(r.minHorizontalBlocks,m),v=Math.max(I,x),S=Math.max(b,y),w=Math.floor(v/2),B=Math.floor(v/2),M=Math.floor(S/2),k=Math.floor(S/2);return{blocksUp:w,blocksDown:B,blocksLeft:M,blocksRight:k,containerWidth:i,containerHeight:c}},[o,r]);return u.useEffect(()=>{const i=()=>{if(n.current){const d=n.current.getBoundingClientRect();s({width:d.width,height:d.height})}};i();const c=new ResizeObserver(i);return n.current&&c.observe(n.current),()=>{c.disconnect()}},[n]),a()},zo={verticalMinPercent:20,verticalMaxPercent:50,horizontalMinPercent:30,horizontalMaxPercent:50,minVerticalBlocks:2,minHorizontalBlocks:4,cellSize:"50px",gap:"8px"},Ln=({children:n,style:r,gap:o="8px",cellSize:s="50px",verticalBlocks:a,horizontalBlocks:i,responsiveConfig:c,enableResponsive:d=!1,blocksLeft:l,blocksRight:f,blocksUp:h=0,blocksDown:g=0,blockItems:x=[],blockConnections:y=[],enableFiltering:p=!1,onBlockClick:m,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:S,usePagination:w=!1,responsive:B=!1,minBlocksPerSide:M=2,maxBlocksPerSide:k=15,minBlocksHorizontal:j=2,maxBlocksHorizontal:R=16,minBlocksVertical:D=2,maxBlocksVertical:O=16,minBlocksLeft:E=1,maxBlocksLeft:N=8,minBlocksRight:$=1,maxBlocksRight:P=8,minBlocksUp:L=1,maxBlocksUp:V=8,minBlocksDown:U=1,maxBlocksDown:G=8,responsiveCellSize:H=!1,minCellSize:Q="30px",maxCellSize:T="80px",directionTexts:z,...A})=>{const F=u.useRef(null),_=Oo(F,{...zo,cellSize:s,gap:o,...c});let ne=l,W=f,oe=h,X=g;d?(ne=Math.floor(_.blocksLeft),W=Math.floor(_.blocksRight),oe=Math.floor(_.blocksUp),X=Math.floor(_.blocksDown)):(a!==void 0||i!==void 0)&&(a!==void 0&&(oe=Math.floor(a/2),X=Math.floor(a/2)),i!==void 0&&(ne=Math.floor(i/2),W=Math.floor(i/2)));const de=E!==1?E:Math.floor(j/2),De=N!==8?N:Math.floor(R/2),Ee=$!==1?$:Math.ceil(j/2),re=P!==8?P:Math.ceil(R/2),xe=L!==1?L:Math.floor(D/2),ve=V!==8?V:Math.floor(O/2),Gn=U!==1?U:Math.ceil(D/2),Vn=G!==8?G:Math.ceil(O/2),{usePagination:_n,finalBlocks:Y,finalCellSize:ae,gridDimensions:je}=ko({gap:o,cellSize:s,blocksLeft:ne,blocksRight:W,blocksUp:oe,blocksDown:X,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:S,responsive:B,minBlocksPerSide:M,maxBlocksPerSide:k,minBlocksLeft:de,maxBlocksLeft:De,minBlocksRight:Ee,maxBlocksRight:re,minBlocksUp:xe,maxBlocksUp:ve,minBlocksDown:Gn,maxBlocksDown:Vn,responsiveCellSize:H,minCellSize:Q,maxCellSize:T}),{getBlockContent:be,getIntersectionText:Qn}=Co({blockItems:x}),{getConnectionStateFromText:Yn}=Mo({blockConnections:y}),q=Bo({blockItems:x,blockConnections:y});u.useEffect(()=>{if(!p)return;const Ae=J=>{J.key==="Escape"&&q.clearFiltering()};return window.addEventListener("keydown",Ae),()=>window.removeEventListener("keydown",Ae)},[p,q]);const[ie,qn,Zn]=wo({totalBlocksLeft:I??0,totalBlocksRight:b??0,totalBlocksUp:v??0,totalBlocksDown:S??0,visibleBlocksLeft:Y.left,visibleBlocksRight:Y.right,visibleBlocksUp:Y.up,visibleBlocksDown:Y.down}),{getNavigationControlProps:ue}=To({usePagination:_n,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:S,paginationActions:qn,paginationState:ie,paginationInfo:Zn});return e.jsxs(t.Box,{ref:F,style:{display:"grid",gridTemplateColumns:je.gridTemplateColumns,gridTemplateRows:je.gridTemplateRows,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",padding:o,boxSizing:"border-box",gap:o,overflow:"hidden",...r},...A,children:[Array.from({length:je.totalRows},(Ae,J)=>Array.from({length:je.totalColumns},(Jo,te)=>{const Le=Y.up>0?J===Y.up:J===0,Fe=te===Y.left;if(Le&&Fe)return e.jsxs(Tn,{style:{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",position:"relative"},children:[n,e.jsx(Se,{direction:"left",text:z==null?void 0:z.left,...ue("left")}),e.jsx(Se,{direction:"right",text:z==null?void 0:z.right,...ue("right")}),e.jsx(Se,{direction:"up",text:z==null?void 0:z.up,...ue("up")}),e.jsx(Se,{direction:"down",text:z==null?void 0:z.down,...ue("down")}),w&&e.jsx(En,{showLeftControls:!!I,showRightControls:!!b,showUpControls:!!v,showDownControls:!!S,onLeftHover:Z=>ue("left").onHover(Z),onRightHover:Z=>ue("right").onHover(Z),onUpHover:Z=>ue("up").onHover(Z),onDownHover:Z=>ue("down").onHover(Z)})]},`center-${J}-${te}`);if(Le&&te<Y.left){const Z=w&&I?ie.leftStartIndex+te:te,ee=`left-${Z}`;return e.jsx(On,{size:ae,blockId:p?ee:void 0,isVisible:p?q.isBlockVisible(ee):!0,isDimmed:p?q.isBlockDimmed(ee):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ee):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:be("left",Z)},`left-${te}`)}if(Le&&te>Y.left){const Z=te-Y.left-1,ee=w&&b?ie.rightStartIndex+(Y.right-1-Z):Y.right-1-Z,ce=`right-${ee}`;return e.jsx(zn,{size:ae,blockId:p?ce:void 0,isVisible:p?q.isBlockVisible(ce):!0,isDimmed:p?q.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ce):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:be("right",ee)},`right-${Z}`)}if(Fe&&J<Y.up){const Z=w&&v?ie.upStartIndex+J:J,ee=`up-${Z}`;return e.jsx(Rn,{size:ae,blockId:p?ee:void 0,isVisible:p?q.isBlockVisible(ee):!0,isDimmed:p?q.isBlockDimmed(ee):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ee):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:be("up",Z)},`up-${J}`)}if(Fe&&J>Y.up){const Z=J-Y.up-1,ee=w&&S?ie.downStartIndex+Z:Z,ce=`down-${ee}`;return e.jsx(Dn,{size:ae,blockId:p?ce:void 0,isVisible:p?q.isBlockVisible(ce):!0,isDimmed:p?q.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ce):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:be("down",ee)},`down-${Z}`)}const Pe=te<Y.left?te:null,we=te>Y.left?te-Y.left-1:null,Ue=J<Y.up?J:null,Ne=J>Y.up?J-Y.up-1:null,Xn=w&&I&&Pe!==null?ie.leftStartIndex+Pe:Pe,Kn=w&&b&&we!==null?ie.rightStartIndex+(Y.right-1-we):we!==null?Y.right-1-we:null,Jn=w&&v&&Ue!==null?ie.upStartIndex+Ue:Ue,et=w&&S&&Ne!==null?ie.downStartIndex+Ne:Ne,We=Qn(Xn,Kn,Jn,et);if(We&&We.length>0){const Z=Yn(We);return e.jsx(Bn,{size:ae,state:Z,interactive:!1},`intersection-${J}-${te}`)}return e.jsx("div",{style:{width:ae,height:ae,minWidth:ae,minHeight:ae}},`empty-${J}-${te}`)})).flat(),p&&q.isFiltering&&e.jsx(t.Box,{style:{position:"fixed",top:12,right:12,background:"rgba(255, 255, 255, 0.9)",color:"var(--mantine-color-dark-7)",padding:"8px 12px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.12)",fontSize:12,fontWeight:600,pointerEvents:"none",zIndex:1e3},children:"Press Esc to clear filter"})]})};Ln.displayName="Matrix";const fe=({editable:n=!1,children:r,label:o,icon:s,value:a,className:i,style:c,...d})=>{const l={className:i,style:c};return ge.useMediaQuery("(max-width: 550px)",!1,{getInitialValueInEffect:!0})?e.jsxs(t.Stack,{gap:0,w:"100%",...l,children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:8},h:"auto",children:[s&&e.jsx(s,{size:20,style:{flexShrink:0},color:"var(--mantine-color-gray-6)",strokeWidth:2}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.6",children:o})]}),e.jsx(t.Box,{style:{display:"flex",alignItems:"flex-start"},w:"100%",children:n&&r?r:a})]}):e.jsxs(t.Group,{align:"flex-start",gap:0,w:"100%",...d,...l,children:[e.jsxs(t.Box,{w:"30%",style:{display:"flex",alignItems:"center",gap:8},h:"40px",children:[s&&e.jsx(s,{size:20,style:{flexShrink:0},color:"var(--mantine-color-gray-6)",strokeWidth:2}),e.jsx(t.Text,{size:"sm",fw:500,truncate:!0,c:"gray.6",children:o})]}),e.jsx(t.Box,{w:"70%",style:{display:"flex",alignItems:"flex-start"},mih:40,children:n&&r?r:a})]})},Ro=({label:n,icon:r,value:o,onChange:s,editable:a=!1,placeholder:i,disabled:c=!1})=>a&&s?e.jsx(fe,{label:n,icon:r,value:e.jsx(Be,{value:o,onChange:s,placeholder:i,disabled:c,size:"sm"})}):e.jsx(fe,{label:n,icon:r,value:e.jsx(t.Text,{size:"sm",c:o?void 0:"dimmed",fw:500,truncate:!0,children:o||i||"—"})}),Do=({label:n,icon:r,href:o,text:s,target:a="_blank"})=>{const i=s||o;return e.jsx(fe,{label:n,icon:r,value:e.jsx(t.Anchor,{href:o,target:a,size:"sm",underline:"hover",children:i})})},Eo=({label:n,icon:r,value:o,onChange:s,editable:a=!1,format:i,placeholder:c})=>{const d=o??null,l=d!==null&&i?i(d):d!==null?d.toString():null,f=h=>{if(!s)return;const g=h.trim();if(g===""){s(null);return}const x=Number(g);isNaN(x)||s(x)};return a&&s?e.jsx(fe,{label:n,icon:r,value:e.jsx(Be,{value:l||"",onChange:f,placeholder:c||"Enter number",size:"sm"})}):e.jsx(fe,{label:n,icon:r,value:e.jsx(t.Text,{size:"sm",c:d!==null?void 0:"dimmed",children:l||c||"—"})})},Ao=300,Lo=({users:n,onSearch:r,debounceSearch:o=!0,debounceDelay:s=Ao})=>{const[a,i]=u.useState(""),[c,d]=u.useState(n),[l,f]=u.useState(!1),h=u.useRef(null);return u.useEffect(()=>{if(!r){d(n);return}if(h.current&&clearTimeout(h.current),a.trim()){const g=async()=>{f(!0);try{const x=await r(a);d(x)}catch(x){console.error("Search error:",x)}finally{f(!1)}};o?h.current=setTimeout(g,s):g()}else d(n),f(!1);return()=>{h.current&&clearTimeout(h.current)}},[a,r,o,s,n]),u.useEffect(()=>{(!a.trim()||!r)&&d(n)},[n,a,r]),{searchQuery:a,setSearchQuery:i,displayedUsers:c,setDisplayedUsers:d,isSearching:l}},Fo=({value:n,multiple:r,users:o,displayedUsers:s,searchQuery:a,onSearch:i})=>{const c=u.useMemo(()=>r?Array.isArray(n)?n:[]:n?[n]:[],[n,r]),d=u.useMemo(()=>o.filter(h=>c.includes(h.id)),[o,c]),l=u.useMemo(()=>{if(!a.trim()||i)return s;const h=a.toLowerCase();return s.filter(g=>g.name.toLowerCase().includes(h)||g.email.toLowerCase().includes(h))},[s,a,i]),f=u.useMemo(()=>{const h=l.filter(y=>c.includes(y.id)),g=l.filter(y=>!c.includes(y.id)),x=d.filter(y=>!l.some(p=>p.id===y.id));return[...h,...x,...g]},[l,c,d]);return{selectedIds:c,selectedUsers:d,sortedUsers:f}},Po=({isFocused:n,dropdownRef:r})=>{const[o,s]=u.useState("bottom"),a=u.useCallback(i=>{if(r.current=i,i){const c=i.dataset.position;c==="top"||c==="bottom"?s(c):requestAnimationFrame(()=>{if(i.dataset.position){const d=i.dataset.position;(d==="top"||d==="bottom")&&s(d)}})}},[r]);return u.useLayoutEffect(()=>{if(!n||!r.current)return;const i=()=>{if(r.current){const l=r.current.dataset.position;(l==="top"||l==="bottom")&&s(l)}};i();const c=requestAnimationFrame(i),d=new MutationObserver(()=>{i()});return r.current&&d.observe(r.current,{attributes:!0,attributeFilter:["data-position"]}),()=>{cancelAnimationFrame(c),d.disconnect()}},[n,r]),{placement:o,dropdownRefCallback:a}},Uo=({onLoadMore:n,hasMore:r,loading:o,setDisplayedUsers:s})=>{const a=u.useRef(null);return u.useEffect(()=>{if(!n||!r||o)return;const i=new IntersectionObserver(c=>{c[0].isIntersecting&&r&&!o&&n().then(d=>{s(l=>[...l,...d])})},{threshold:.1});return a.current&&i.observe(a.current),()=>{i.disconnect()}},[n,r,o,s]),{loadMoreRef:a}},No=({combobox:n,dropdownRef:r})=>{const[o,s]=u.useState(!1),[a,i]=u.useState(!1),c=u.useCallback(()=>{s(!0),n.openDropdown()},[n]),d=u.useCallback(h=>{setTimeout(()=>{const g=h==null?void 0:h.relatedTarget;g&&r.current&&r.current.contains(g)||n.dropdownOpened||s(!1)},0)},[n,r]),l=u.useCallback(()=>{i(!0)},[]),f=u.useCallback(()=>{i(!1)},[]);return{isFocused:o,setIsFocused:s,isHovered:a,handleFocus:c,handleBlur:d,handleMouseEnter:l,handleMouseLeave:f}},Wo=({multiple:n,value:r,onChange:o,combobox:s})=>{const a=u.useCallback(c=>{if(n){const d=Array.isArray(r)?r:[],l=d.includes(c)?d.filter(f=>f!==c):[...d,c];o==null||o(l)}else o==null||o(c),s.closeDropdown()},[n,r,o,s]),i=u.useCallback(c=>{if(n){const d=Array.isArray(r)?r:[];o==null||o(d.filter(l=>l!==c))}else o==null||o("")},[n,r,o]);return{handleSelect:a,handleRemove:i}},$o="40px",Ho=300,pe=({editable:n=!1,label:r,icon:o,value:s,users:a=[],onChange:i,placeholder:c="Select users",multiple:d=!1,disabled:l=!1,onSearch:f,debounceSearch:h=!0,debounceDelay:g=Ho,onLoadMore:x,hasMore:y=!1,loading:p=!1})=>{const m=u.useRef(null),I=u.useRef(null),b=u.useRef(null),{searchQuery:v,setSearchQuery:S,displayedUsers:w,setDisplayedUsers:B,isSearching:M}=Lo({users:a,onSearch:f,debounceSearch:h,debounceDelay:g}),k=t.useCombobox({onDropdownClose:()=>{k.resetSelectedOption(),S(""),R(!1)},onDropdownOpen:()=>{k.updateSelectedOptionIndex("active"),R(!0)}}),{isFocused:j,setIsFocused:R,isHovered:D,handleFocus:O,handleBlur:E,handleMouseEnter:N,handleMouseLeave:$}=No({combobox:k,dropdownRef:b}),{placement:P,dropdownRefCallback:L}=Po({isFocused:j,dropdownRef:b}),{selectedIds:V,selectedUsers:U,sortedUsers:G}=Fo({value:s,multiple:d,users:a,displayedUsers:w,searchQuery:v,onSearch:f}),{loadMoreRef:H}=Uo({onLoadMore:x,hasMore:y,loading:p,setDisplayedUsers:B}),{handleSelect:Q,handleRemove:T}=Wo({multiple:d,value:s,onChange:i,combobox:k}),z=()=>{if(!d)return null;const W=5,oe=U.slice(0,W),X=U.length-W;return e.jsxs(t.Group,{gap:"xs",children:[oe.map(de=>e.jsx(ke,{avatar:de.avatar,name:de.name,withRemoveButton:j,onRemove:()=>T(de.id)},de.id)),X>0&&e.jsx(t.Pill,{ml:"xs",radius:"md",size:"md",bg:"transparent",children:e.jsxs(t.Group,{gap:"2px",wrap:"nowrap",style:{alignItems:"center",display:"flex"},h:"24px",children:[e.jsx(C.IconPlus,{size:16,style:{color:"var(--mantine-color-blue-5)"}}),e.jsxs(t.Text,{size:"sm",fw:400,c:"var(--mantine-color-blue-5)",children:[X," more"]})]})})]})},A=()=>{if(d)return null;const W=U[0];return W?e.jsx(ke,{avatar:W.avatar,name:W.name}):null},F=()=>j?"var(--mantine-color-gray-2)":"var(--mantine-color-gray-0)",_=()=>({input:{position:j?"absolute":"relative",zIndex:j?1e3:1,fontWeight:"400",color:"var(--mantine-color-gray-9)",cursor:l?"not-allowed":"pointer",backgroundColor:j||D?"var(--mantine-color-gray-0)":"transparent",border:j?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:j&&P==="bottom"?"var(--mantine-radius-md) var(--mantine-radius-md) 0 0":j&&P==="top"?"0 0 var(--mantine-radius-md) var(--mantine-radius-md)":"var(--mantine-radius-md)",paddingY:"6px",display:"flex",alignItems:"center",padding:"6px 14px",minHeight:"40px",flexWrap:d?"wrap":"nowrap",boxShadow:j&&P==="bottom"?"0 -4px 10px 0 rgba(0, 0, 0, 0.1)":j&&P==="top"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"none"}}),ne={group:{alignItems:"center",gap:"4px",minHeight:"0",lineHeight:"normal"}};return e.jsx(fe,{editable:n,label:r,icon:o,value:e.jsx(t.Group,{gap:"sm",wrap:"nowrap",style:{alignItems:"center"},w:"100%",h:40,p:"14px",children:U.map(W=>e.jsx(ke,{avatar:W.avatar,name:W.name,withRemoveButton:j,onRemove:()=>T(W.id)},W.id))}),children:e.jsxs(t.Combobox,{store:k,onOptionSubmit:Q,withinPortal:!1,offset:-2,children:[e.jsx(t.Combobox.DropdownTarget,{children:e.jsx(t.PillsInput,{onClick:()=>!l&&k.openDropdown(),radius:"md",disabled:l,styles:_,onFocus:O,onBlur:E,onMouseEnter:()=>!l&&N(),onMouseLeave:$,w:"100%",children:e.jsxs(t.Pill.Group,{styles:ne,children:[d?z():A(),e.jsx(t.Combobox.EventsTarget,{children:e.jsx(t.PillsInput.Field,{ref:m,onFocus:O,onBlur:E,placeholder:U.length===0||j||v.length>0?c:"",value:v,onChange:W=>{k.updateSelectedOptionIndex(),S(W.currentTarget.value)},onMouseDown:W=>{W.stopPropagation()},onKeyDown:W=>{W.key==="Backspace"&&v.length===0&&(W.preventDefault(),d&&U.length>0?T(U[U.length-1].id):!d&&U.length>0&&T(U[0].id))},pointer:!0,disabled:l,styles:{field:{minWidth:j||v.length>0||U.length===0?"60px":"0px",width:j||v.length>0||U.length===0?"auto":"0px",flex:j||v.length>0||U.length===0?"1":"0",border:"none",outline:"none",background:"transparent",fontSize:"inherit",fontFamily:"inherit",padding:"0",margin:"0",overflow:"hidden",lineHeight:"24px",display:"flex",alignItems:"center",height:j||v.length>0||U.length===0?"auto":"0px",minHeight:j||v.length>0||U.length===0?"auto":"0px","&::placeholder":{opacity:U.length===0||j||v.length>0?1:0,display:U.length===0||j||v.length>0?"block":"none",color:"var(--mantine-color-gray-9)",lineHeight:"24px"}}}})})]})})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:P==="bottom"?"0 0 var(--mantine-radius-md) var(--mantine-radius-md)":"var(--mantine-radius-md) var(--mantine-radius-md) 0 0",borderTop:"none",border:`1px solid ${F()}`,marginTop:"0",padding:"4px",boxShadow:P==="bottom"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"0 -4px 10px 0 rgba(0, 0, 0, 0.1)"}},ref:L,children:e.jsx(t.Combobox.Options,{children:e.jsx(t.ScrollArea,{ref:I,h:Math.min(G.length*parseFloat($o),300),scrollbarSize:6,children:e.jsxs(t.Stack,{gap:2,children:[G.map(W=>{const oe=V.includes(W.id);return e.jsx(t.Combobox.Option,{value:W.id,active:oe,onMouseDown:X=>{X.preventDefault(),Q(W.id)},style:{borderRadius:"var(--mantine-radius-md)",height:"40px"},children:e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",style:{display:"flex",alignItems:"center"},h:"28px",children:[e.jsx(se,{avatar:W.avatar,size:24,placeholder:W.name,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:400,truncate:!0,children:W.name}),oe&&e.jsx(C.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"})]})},W.id)}),(M||p)&&e.jsx(t.Box,{style:{padding:"12px",display:"flex",justifyContent:"center"},children:e.jsx(t.Loader,{size:"sm"})}),x&&y&&!p&&e.jsx("div",{ref:H,style:{height:"20px"}}),G.length===0&&!M&&!p&&e.jsx(t.Box,{style:{padding:"24px",textAlign:"center"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:"No users found"})})]})})})})]})})},Ye=({label:n,icon:r,value:o,onChange:s,editable:a=!1,placeholder:i,disabled:c=!1,minRows:d=1,maxRows:l,autosize:f=!0})=>{const[h,g]=u.useState(!1),[x,y]=u.useState(!1),p={wrapper:{...!f&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},borderRadius:"var(--mantine-radius-md)"},input:{backgroundColor:h||x?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-9)",border:h?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:"var(--mantine-radius-md)",width:"100%",cursor:"pointer",...!f&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},padding:"8px 14px",lineHeight:f?"1.5":"24px",fontWeight:450}};return e.jsx(fe,{editable:a,label:n,icon:r,value:e.jsx(t.Box,{w:"100%",style:{display:"flex",alignItems:"flex-start",minHeight:40},p:"xs",h:40,children:e.jsx(t.Text,{size:"sm",c:o?void 0:"dimmed",fw:400,style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o||i||"—"})}),children:e.jsx(t.Box,{w:"100%",style:{boxShadow:h?"var(--mantine-shadow-sm)":"none",borderRadius:"var(--mantine-radius-md)"},children:e.jsx(t.Textarea,{value:o,onChange:m=>s==null?void 0:s(m.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),placeholder:i,disabled:c,size:"sm",radius:"md",fw:400,minRows:h?1:d,maxRows:l,autosize:f,styles:{...p}})})})},Go=({opened:n,onClose:r,children:o,...s})=>e.jsxs(t.Modal,{withCloseButton:!1,opened:n,onClose:r,size:"70%",centered:!0,overlayProps:{backgroundOpacity:.55},styles:{content:{minHeight:"100%"}},padding:"md",...s,children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:e.jsx(K,{icon:C.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(t.Group,{justify:"space-between",gap:"xs",children:[e.jsx(K,{icon:C.IconStar,size:"md",onClick:()=>{}}),e.jsx(K,{icon:C.IconDots,size:"md",onClick:()=>{}})]})]}),o]}),Fn=({opened:n,onClose:r,editable:o,content:s,position:a="right",size:i="xl",onMaximize:c,rightCornerActions:d,headerProps:l,propertiesProps:f})=>{var w,B;const[h,g]=u.useState(!1),x=(f==null?void 0:f.hiddenProperties)&&f.hiddenProperties.length>0,[y,p]=u.useState(!1),[m,I]=u.useState(l==null?void 0:l.avatar),[b,v]=u.useState(!1);u.useEffect(()=>{I(l==null?void 0:l.avatar)},[l==null?void 0:l.avatar]);const S=e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var k;const M={type:"emoji",value:"😊"};I(M),(k=l==null?void 0:l.onAvatarChange)==null||k.call(l,M)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(C.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})});return e.jsxs(t.Drawer,{opened:n,onClose:r,position:a,size:i,padding:"md",withCloseButton:!1,overlayProps:{backgroundOpacity:0},shadow:"none",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:[e.jsx(K,{icon:C.IconChevronsRight,size:"md",onClick:r}),e.jsx(K,{icon:C.IconMaximize,size:"md",onClick:()=>c()})]}),e.jsx(t.Group,{justify:"space-between",gap:"xs",children:d})]}),e.jsxs(t.Box,{p:"3rem",children:[l&&e.jsxs(t.Box,{children:[e.jsx(t.Box,{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:m?e.jsx(Qe,{editable:o,avatar:m,size:"xl",opened:b,onOpen:()=>v(!0),onClose:()=>v(!1),onAvatarSelect:M=>{var k;I(M),(k=l==null?void 0:l.onAvatarChange)==null||k.call(l,M)},onRemove:()=>{I(void 0)}}):e.jsx(t.Box,{h:24,children:y&&S})}),o?e.jsx(Be,{value:l.title||"",onChange:M=>{var k;return(k=l.onTitleChange)==null?void 0:k.call(l,M)},pageTitle:!0,placeholder:l.placeholder}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:l.title})})]}),e.jsx(t.Stack,{gap:"sm",children:(w=f==null?void 0:f.visibleProperties)==null?void 0:w.map((M,k)=>e.jsx(t.Box,{children:M},k))}),x&&!h&&e.jsx(t.Box,{w:"100%",style:{display:"flex",justifyContent:"center"},children:e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray.4",onClick:()=>g(!0),children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-blue-5)",children:"Show"}),e.jsx(C.IconChevronDown,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),e.jsx(t.Collapse,{in:h,children:e.jsx(t.Stack,{gap:"sm",mt:"sm",children:(B=f==null?void 0:f.hiddenProperties)==null?void 0:B.map((M,k)=>e.jsx(t.Box,{children:M},k))})}),x&&h&&e.jsx(t.Box,{w:"100%",style:{display:"flex",justifyContent:"center"},mt:"sm",children:e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray.4",onClick:()=>g(!1),children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-blue-5)",children:"Hide"}),e.jsx(C.IconChevronUp,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),s]})]})},Vo=({children:n})=>e.jsx(t.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:n}),Pn=u.createContext(void 0),Un=({children:n})=>{const[r,{toggle:o,open:s,close:a}]=ge.useDisclosure(!0),[i,{toggle:c,open:d,close:l}]=ge.useDisclosure(!1),[f,{open:h,close:g}]=ge.useDisclosure(!1),[x,y]=u.useState(300),[p,m]=u.useState(500),I={opened:r,toggle:o,open:s,close:a,asideOpened:i,toggleAside:c,openAside:d,closeAside:l,sidebarWidth:x,setSidebarWidth:y,asideWidth:p,setAsideWidth:m,openedNotificationSidebar:f,openNotificationSidebar:h,closeNotificationSidebar:g};return e.jsx(Pn.Provider,{value:I,children:n})},qe=()=>{const n=u.useContext(Pn);if(n===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return n},Nn=({header:n,navbar:r,aside:o,children:s,...a})=>{const{opened:i,asideOpened:c,sidebarWidth:d,asideWidth:l}=qe();return e.jsxs(t.AppShell,{header:{height:n?60:0},navbar:{width:i?d:0,breakpoint:"sm",collapsed:{mobile:!0}},aside:{width:c?l:0,breakpoint:"sm",collapsed:{mobile:!0}},padding:0,...a,children:[n&&e.jsx(t.AppShell.Header,{children:n}),e.jsx(t.AppShell.Navbar,{style:{display:i?"block":"none",width:i?d:0,border:"none"},children:r}),e.jsx(t.AppShell.Aside,{style:{display:c?"block":"none",width:c?l:0},children:o}),e.jsx(t.AppShell.Main,{children:s})]})},_o=({items:n,selectedId:r,onSelect:o})=>e.jsx(t.Stack,{gap:0,children:n.map(s=>{var a;return e.jsx(Ge,{label:s.label,isActive:r===s.id,noChild:!s.children||s.children.length===0,onClick:()=>(!s.children||s.children.length===0)&&(o==null?void 0:o(s.id)),children:(a=s.children)==null?void 0:a.map(i=>e.jsx(Ge,{label:i.label,noChild:!0,level:4,isActive:r===i.id,onClick:()=>o==null?void 0:o(i.id)},i.id))},s.id)})}),Qo=({items:n,selectedId:r,onSelect:o,headerLeft:s,headerRight:a,renderPreview:i,renderAside:c,sidebarTitle:d="Documentation",topNavItems:l,selectedTopNavId:f,onTopNavSelect:h})=>{const{opened:g,toggle:x}=qe(),[y,p]=u.useState(r),m=r??y,I=b=>{o==null||o(b),r===void 0&&p(b)};return e.jsx(Nn,{header:l?e.jsx(Ve,{withBorder:!0,bg:"transparent",position:"left",header:e.jsx(t.Group,{h:40,w:"100%",justify:"space-between",wrap:"nowrap",children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",children:g&&e.jsx(t.Text,{fw:600,size:"sm",children:d})})})}):void 0,navbar:e.jsx(Ve,{withBorder:!0,bg:"transparent",position:"left",header:e.jsxs(t.Group,{h:40,w:"100%",justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Group,{gap:"xs",wrap:"nowrap",children:g&&e.jsx(t.Text,{fw:600,size:"sm",children:d})}),e.jsx(K,{icon:g?C.IconChevronsLeft:C.IconChevronsRight,size:"md",onClick:x})]}),body:g&&e.jsx(t.ScrollArea,{h:"100%",type:"hover",scrollbarSize:10,styles:{scrollbar:{'&[data-state="visible"]':{background:"transparent"}},thumb:{backgroundColor:"var(--mantine-color-gray-4)",opacity:.3,"&:hover":{backgroundColor:"var(--mantine-color-gray-4)",opacity:.3}}},children:e.jsx(_o,{items:n,selectedId:m,onSelect:I})}),footer:e.jsx(e.Fragment,{})}),aside:e.jsx(t.Box,{p:"md",h:"100%",children:c==null?void 0:c(m)}),children:e.jsxs(t.Box,{style:{height:"100vh",display:"flex",flexDirection:"column",background:"var(--mantine-color-body)"},children:[e.jsxs(t.Group,{p:"md",justify:"space-between",align:"center",children:[e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[!g&&e.jsx(K,{icon:C.IconChevronsRight,size:"md",variant:"subtle",tooltip:"Open sidebar",onClick:x}),s??e.jsx(Te,{label:m||"Select a topic",onClick:()=>{}})]}),!l&&a]}),e.jsx(t.Box,{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"40px"},children:e.jsx(t.Box,{p:"xl",style:{borderRadius:"var(--mantine-radius-md)",width:"100%"},children:i(m)})})]})})},Yo=n=>e.jsx(Un,{children:e.jsx(Qo,{...n})}),Ze=(n,r)=>{const o=u.useCallback(i=>{const c=Array.isArray(i)?i:[i];n.onUserIdsChange(c)},[n]),s=u.useCallback(i=>{const c=Array.isArray(i)?i:[i],d=r.members.filter(y=>c.includes(y.id)),l=d.map(y=>y.id),f=c.filter(y=>!l.includes(y)),g=[...r.members,...n.users].filter(y=>f.includes(y.id)),x=[...d,...g];r.onMembersChange(x)},[r,n]);return{availableMembersUsers:u.useMemo(()=>{const i=[...r.members];return n.users.forEach(c=>{i.find(d=>d.id===c.id)||i.push(c)}),i},[r.members,n.users]),handleResponsibleChange:o,handleMembersChange:s}},qo=({opened:n,onClose:r,onMaximize:o,editable:s,name:a,onNameChange:i,avatar:c,onAvatarChange:d,owner:l,responsibleProps:f,membersProps:h,descriptionProps:g})=>{const{availableMembersUsers:x,handleResponsibleChange:y,handleMembersChange:p}=Ze(f,h),m=u.useMemo(()=>[e.jsx(Ye,{label:"Description",icon:C.IconAlignLeft,value:g.description,onChange:g.onDescriptionChange,editable:s},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:C.IconUserCircle,value:l.id,users:[l]},"owner"),e.jsx(pe,{multiple:!1,editable:s,label:"Team Leader",icon:C.IconUser,value:f.userIds.length>0?f.userIds[0]:void 0,users:f.users,onChange:y,onSearch:f.handleSearch,onLoadMore:f.handleLoadMore,hasMore:f.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:s,label:"Team Members",icon:C.IconUsers,value:h.members.map(I=>I.id),users:x,onChange:p,onSearch:h.handleSearch,onLoadMore:h.handleLoadMore,hasMore:h.hasMore},"members")],[g.description,g.onDescriptionChange,s,l,f.handleLoadMore,f.handleSearch,f.hasMore,f.userIds,f.users,y,h.handleLoadMore,h.handleSearch,h.hasMore,h.members,x,p]);return e.jsx(Fn,{opened:n,onClose:r,onMaximize:o,editable:s,headerProps:{avatar:c,onAvatarChange:I=>d==null?void 0:d(I),title:a,onTitleChange:i,placeholder:"Team name"},propertiesProps:{visibleProperties:m}})},Wn=({isSidebarOpen:n,fullWidth:r=!1,editable:o,rightNavigation:s,headerProps:a,properties:i,children:c,footer:d})=>{const[l,f]=u.useState(a==null?void 0:a.avatar),[h,g]=u.useState(!1),[x,y]=u.useState(!1),p=r?"0":{base:"1rem",sm:"2rem",md:"4rem",lg:"8rem",xl:"10rem"},[m,I]=u.useState(n);u.useEffect(()=>{I(n)},[n]);const b=()=>{I(v=>!v)};return e.jsxs(t.Stack,{gap:"md",p:"md",children:[e.jsxs(t.Group,{justify:"space-between",children:[e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[e.jsx(K,{icon:m?C.IconChevronsRight:C.IconMenu2,size:"md",color:"gray",changeIconOnHover:!0,iconHovered:m?C.IconMenu2:C.IconChevronsRight,variant:"subtle",onClick:b,"aria-pressed":m}),e.jsx(Te,{label:a.title,onClick:()=>{}})]}),e.jsx(t.Box,{children:s})]}),e.jsx(t.Box,{px:p,w:"100%",maw:{base:"100%",md:"80vw"},mx:"auto",children:e.jsxs(t.Stack,{gap:"md",children:[a&&e.jsxs(t.Stack,{gap:"md",children:[e.jsx(t.Box,{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),h:l?64:24,children:l?e.jsx(Qe,{editable:o,avatar:l,size:64,opened:h,onOpen:()=>g(!0),onClose:()=>g(!1),onAvatarSelect:v=>{var S;f(v),(S=a==null?void 0:a.onAvatarChange)==null||S.call(a,v)},onRemove:()=>{f(void 0)}}):e.jsx(t.Box,{h:24,children:x&&e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var S;const v={type:"emoji",value:"😊"};f(v),(S=a==null?void 0:a.onAvatarChange)==null||S.call(a,v)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(C.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})})})}),e.jsx(t.Box,{children:o?e.jsx(dn,{value:a.title||"",onChange:v=>{var S;return(S=a.onTitleChange)==null?void 0:S.call(a,v)},placeholder:a.placeholder,pageTitle:!0}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:a.title})})})]}),i,c,d]})})]})},$n=({editable:n,owner:r,descriptionProps:o,responsibleProps:s,membersProps:a})=>{const{availableMembersUsers:i,handleResponsibleChange:c,handleMembersChange:d}=Ze(s,a);return e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(Ye,{label:"Description",icon:C.IconAlignLeft,value:o.description,onChange:o.onDescriptionChange,editable:n},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:C.IconUserCircle,value:r.id,users:[r]},"owner"),e.jsx(pe,{multiple:!1,editable:n,label:"Team Leader",icon:C.IconUser,value:s.userIds.length>0?s.userIds[0]:void 0,users:s.users,onChange:c,onSearch:s.handleSearch,onLoadMore:s.handleLoadMore,hasMore:s.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:n,label:"Team Members",icon:C.IconUsers,value:a.members.map(l=>l.id),users:i,onChange:d,onSearch:a.handleSearch,onLoadMore:a.handleLoadMore,hasMore:a.hasMore},"members")]})},Zo=({editable:n,headerProps:r,rightNavigation:o,properties:s,children:a,footer:i})=>e.jsx(Wn,{isSidebarOpen:!0,editable:n,rightNavigation:o,headerProps:r,properties:e.jsx($n,{...s}),children:a,footer:i}),Xo=({title:n,properties:r,children:o})=>e.jsxs(t.Stack,{gap:"sm",p:"3rem",children:[e.jsx(t.Text,{size:"2.5rem",fw:600,children:n}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Stack,{gap:"xs",children:r}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Box,{children:o})]}),Hn=t.createTheme({primaryColor:"blue",fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",fontFamilyMonospace:"Monaco, Courier, monospace",headings:{fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif"},colors:{gray:["#f6f5f4","#f1f0ef","#cecece","#b3b3b3","#9d9c9a","#908d89","#8b8580","#78726d","#6c655f","#5f574e"]},components:{}});function Ko({children:n,theme:r}){return e.jsxs(t.MantineProvider,{theme:r||Hn,children:[e.jsx(it.Notifications,{}),e.jsx(ct.ModalsProvider,{children:e.jsx(lt.DatesProvider,{settings:{firstDayOfWeek:0},children:n})})]})}exports.ActionButton=K;exports.AppLayout=Nn;exports.AppLayoutProvider=Un;exports.AvatarSelector=Qe;exports.BaseLayout=Xo;exports.BoxAvatar=se;exports.CenterPeek=Go;exports.DocsTemplate=Yo;exports.EditableText=Be;exports.EditableTextarea=dn;exports.EmojiAvatar=tn;exports.ExpandableSearch=un;exports.FilterDropdown=bt;exports.FilterDropdownButton=Oe;exports.FilterDropdownFilters=ze;exports.FullPage=Vo;exports.GenericTable=hn;exports.IconAvatar=sn;exports.ImageAvatar=an;exports.InvitedUserCard=ye;exports.LinkProperty=Do;exports.Logo=ln;exports.Matrix=Ln;exports.Menu=Ie;exports.ModalSettings=ao;exports.NavButton=_e;exports.NavLink=Ge;exports.Navbar=Ve;exports.NavbarProvider=mo;exports.NotificationSidebar=xo;exports.NumberProperty=Eo;exports.PageLayout=Wn;exports.PageProperty=fe;exports.PlaceholderAvatar=Me;exports.PopoverItem=fn;exports.PopoverSelector=Re;exports.SelectUserProperty=pe;exports.ShareButton=ro;exports.ShareMenu=kn;exports.ShareModal=so;exports.SidePeek=Fn;exports.TeamPage=Zo;exports.TeamProperties=$n;exports.TeamSidePeek=qo;exports.TextButton=Te;exports.TextProperty=Ro;exports.TextareaProperty=Ye;exports.ThemeProvider=Ko;exports.UserChip=ke;exports.WorkspaceSelector=bo;exports.WorkspaceSelectorItem=Mn;exports.getInitialsFromName=cn;exports.theme=Hn;exports.useAppLayout=qe;exports.useNavbar=go;exports.useTeamProperties=Ze;
18
+ `})]})},ze=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="md",filterButtonDropdownPosition:a="bottom-end"})=>{const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),[c,d]=u.useState(!1),l=n.length>0,f=m=>{if(m==="remove-filters")r([]);else{const I=o==null?void 0:o.find(b=>b.value===m);if(I){const b={id:`${I.value}-${Date.now()}`,filterOption:I};r([...n,b])}}i.closeDropdown()},h=(o||[]).filter(m=>!n.some(I=>I.filterOption.value===m.value)),g={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},y=(()=>{switch(s){case"sm":return{height:"32px",width:"32px",iconSize:20};case"md":return{height:"32px",width:"32px",iconSize:20};default:return{height:"32px",width:"32px",iconSize:20}}})(),x=e.jsx(t.Box,{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:l||c?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",transition:"all 0.2s ease",...y},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:()=>i.toggleDropdown(),children:e.jsx(k.IconFilter,{size:20,stroke:2.3})});return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,children:[e.jsx(t.Combobox.Target,{children:l?e.jsx(t.Indicator,{offset:2,position:"top-end",color:"var(--mantine-color-yellow-7)",children:x}):x}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",width:"auto",minWidth:"160px"}},children:e.jsxs(t.Combobox.Options,{children:[h.map(m=>e.jsx(t.Combobox.Option,{value:m.value,style:{...g},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.icon,m.label]})},m.value)),l&&e.jsx(t.Combobox.Option,{value:"remove-filters",style:{borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",fontWeight:"500",color:"var(--mantine-color-red-6)"},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(k.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},vt=({filterTag:n,onUpdate:r,onRemove:o,options:s=[],filterTagDropdownPosition:a="bottom-start"})=>{var p;const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),c=!!n.selectedOption,d=c?`${n.filterOption.label}: ${(p=n.selectedOption)==null?void 0:p.label}`:n.filterOption.label,l=s&&s.length>0?s:[{value:"option-a",label:"TagFilterOptionA"},{value:"option-b",label:"TagFilterOptionB"},{value:"option-c",label:"TagFilterOptionC"}],f=y=>{if(y==="remove")o();else{const x=l.find(m=>m.value===y);x&&r({...n,selectedOption:x})}i.closeDropdown()},h={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},g={display:"inline-flex",alignItems:"center",gap:"4px",backgroundColor:c?"var(--mantine-color-blue-0)":"var(--mantine-color-gray-0)",color:c?"var(--mantine-color-blue-7)":"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-xl)",cursor:"pointer",transition:"all 0.2s ease",height:"32px",fontSize:"var(--mantine-font-size-sm)",padding:"0 12px"};return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,middlewares:{flip:!1,shift:!0},children:[e.jsx(t.Combobox.Target,{children:e.jsxs(t.Box,{style:{...g},onClick:()=>i.toggleDropdown(),fw:500,pl:"sm",children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px"},children:[n.filterOption.icon,d]}),e.jsx(k.IconChevronDown,{size:16,strokeWidth:2,color:"var(--mantine-color-gray-5)"})]})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",minWidth:"150px"}},children:e.jsxs(t.Combobox.Options,{children:[l.map(y=>{var x;return e.jsx(t.Combobox.Option,{value:y.value,active:((x=n.selectedOption)==null?void 0:x.value)===y.value,style:{...h},children:y.label},y.value)}),e.jsx(t.Combobox.Option,{value:"remove",style:{borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",fontWeight:"500",color:"var(--mantine-color-red-6)"},children:"Or remove filter"})]})})]})},jt=({activeFilters:n,onFiltersChange:r,availableFilters:o,addFilterButtonDropdownPosition:s="bottom-start"})=>{const a=t.useCombobox({onDropdownClose:()=>a.resetSelectedOption(),onDropdownOpen:()=>a.updateSelectedOptionIndex("active")}),[i,c]=u.useState(!1),d=p=>{const y=o==null?void 0:o.find(x=>x.value===p);if(y){const x={id:`${y.value}-${Date.now()}`,filterOption:y};r([...n,x])}a.closeDropdown()},l=(o||[]).filter(p=>!n.some(y=>y.filterOption.value===p.value)),f={display:"inline-flex",alignItems:"center",backgroundColor:i?"var(--mantine-color-gray-0)":"transparent",borderRadius:"var(--mantine-radius-xl)",cursor:"pointer",transition:"all 0.2s ease",border:"1px solid transparent",height:"32px",fontSize:"var(--mantine-font-size-sm)",padding:"0 12px"},h={dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",width:"auto",minWidth:"120px"}},g={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"};return e.jsxs(t.Combobox,{store:a,onOptionSubmit:d,withinPortal:!1,offset:4,position:s,children:[e.jsx(t.Combobox.Target,{children:e.jsx(t.Box,{style:{...f},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:()=>a.toggleDropdown(),children:e.jsx(t.Box,{style:{fontWeight:"500",color:"var(--mantine-color-blue-6)"},children:"Add filter"})})}),e.jsx(t.Combobox.Dropdown,{styles:{...h},children:e.jsx(t.Combobox.Options,{children:l.map(p=>e.jsx(t.Combobox.Option,{value:p.value,style:{...g},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p.icon,p.label]})},p.value))})})]})},Re=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="sm",getFilterOptions:a,filterTagDropdownPosition:i="bottom-start"})=>{const c=f=>{const h=(n||[]).map(g=>g.id===f.id?f:g);r(h)},d=f=>{const h=(n||[]).filter(g=>g.id!==f);r(h)},l=(o||[]).filter(f=>!n.some(h=>h.filterOption.value===f.value));return!n||n.length===0?null:e.jsx("div",{style:{width:"100%"},children:e.jsxs(t.Group,{gap:"sm",align:"center",wrap:"wrap",children:[(n||[]).map(f=>{const h=a?a(f.filterOption.value)||[]:[];return e.jsx(vt,{filterTag:f,onUpdate:c,onRemove:()=>d(f.id),size:s,options:h,filterTagDropdownPosition:i},f.id)}),l.length>0&&e.jsx(jt,{activeFilters:n,onFiltersChange:r,availableFilters:l,size:s})]})})},bt=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="md",getFilterOptions:a,filterTagDropdownPosition:i="bottom-start"})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsx(ze,{activeFilters:n,onFiltersChange:r,availableFilters:o,size:s}),e.jsx(Re,{activeFilters:n,onFiltersChange:r,availableFilters:o,size:"sm",getFilterOptions:a,filterTagDropdownPosition:i})]}),wt=Object.assign(bt,{Button:ze,Filters:Re}),St=({children:n,danger:r,active:o,...s})=>e.jsx(t.MenuItem,{...s,style:{borderRadius:"8px",color:o?"var(--mantine-color-blue-7)":r?"var(--mantine-color-red-9)":"var(--mantine-color-gray-9)",backgroundColor:o?"var(--mantine-color-blue-0)":"transparent",...s.style},children:n}),ye=({trigger:n,menuItems:r,children:o,...s})=>{const a=u.useRef(null),[i,c]=u.useState(0);return u.useEffect(()=>{a.current&&c(a.current.offsetWidth)},[n]),e.jsxs(t.Menu,{...s,children:[e.jsx(t.Menu.Target,{children:e.jsx("div",{ref:a,onClick:d=>d.stopPropagation(),style:{cursor:"pointer",outline:"none",boxShadow:"none",display:"flex",alignItems:"center"},children:n})}),e.jsxs(t.Menu.Dropdown,{styles:{dropdown:{cursor:"pointer",borderRadius:"8px",minWidth:`${i}px`}},children:[o,r==null?void 0:r.map((d,l)=>e.jsx(St,{...d},l))]})]})},Qe=({label:n,icon:r,onClick:o,color:s="gray",disabled:a=!1,"aria-label":i,indicator:c,fullWidth:d,isActive:l=!1,...f})=>{const[h,g]=u.useState(!1),p=()=>{a||o==null||o()};return e.jsx(t.Box,{style:{cursor:a?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},variant:"transparent",justify:"flex-start",display:"flex",color:s,radius:"md",w:d?"100%":"auto",px:6,h:40,onMouseEnter:()=>!a&&g(!0),onMouseLeave:()=>g(!1),onClick:p,bg:h||l?"gray.1":"transparent","aria-label":i||`${n} navigation button`,...f,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,justify:"left",align:"center",children:[r,e.jsx(t.Text,{ta:"left",size:"sm",fw:600,c:"var(--mantine-color-gray-8)",truncate:!0,style:{flex:1,opacity:a?.5:1},children:n}),c&&e.jsx(t.Box,{style:{cursor:"pointer",backgroundColor:"var(--mantine-color-red-7)",color:"var(--mantine-color-white)",borderRadius:"var(--mantine-radius-lg)",padding:"0px 4px",fontSize:"12px",fontWeight:600,height:"20px",minWidth:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:c})]})})},Ve=({label:n,rightLabel:r,children:o,onAddChild:s,onMenuAction:a,menuItems:i,color:c="gray",defaultText:d="No items",level:l=0,disabled:f=!1,noChild:h=!1,isActive:g=!1,showAvatar:p=!0,avatar:y,placeholder:x,onClick:m,"aria-label":I,...b})=>{const[v,S]=u.useState(!1),[w,B]=u.useState(!1),M=u.Children.count(o)>0,C=!h&&M&&(p?w:!0),j=u.useCallback(()=>{f||m==null||m()},[m,f]),R=u.useCallback(F=>{F.stopPropagation(),!f&&(s==null||s())},[s,f]),D=u.useCallback(()=>{f||(M&&!h&&S(!v),m==null||m())},[f,M,h,v,m]),O=u.useCallback(()=>{f||s==null||s()},[s,f]),E=u.useCallback(F=>{f||a==null||a(F)},[a,f,n]),N=u.useCallback(()=>M?u.Children.map(o,F=>u.isValidElement(F)?u.cloneElement(F,{...F.props,level:l+1}):F):null,[o,M,l]),H=(i==null?void 0:i.map(F=>({children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[F.icon&&e.jsx(F.icon,{size:16}),e.jsx(t.Text,{size:"sm",children:F.label})]}),onClick:()=>E(F.action)})))||[],U=[{children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(k.IconPlus,{size:16}),e.jsx(t.Text,{size:"sm",children:"Add child"})]}),onClick:R}],L=H.length>0?H:U;return e.jsxs(t.Stack,{gap:0,children:[e.jsx(t.Box,{style:{cursor:f?"not-allowed":"pointer",borderRadius:"8px"},variant:"transparent",justify:"space-between",display:"flex",color:c,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!f&&B(!0),onMouseLeave:()=>B(!1),onClick:j,bg:g||w?"var(--mantine-color-gray-1)":"transparent","aria-expanded":v,"aria-label":I||`${n} navigation link`,...b,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,onClick:j,style:{paddingLeft:h&&!C?`${(l+1)*32}px`:l>0?`${l*32}px`:"0px"},children:[C?e.jsx(me,{icon:v?k.IconChevronDown:k.IconChevronRight,iconOnHover:v?k.IconChevronDown:k.IconChevronRight,grayScaleBaseColor:w?1:0,color:"var(--mantine-color-gray-7)",onClick:D,disabled:f}):p?e.jsx(se,{size:"xs",avatar:y,showPlaceholder:!0,placeholder:x}):null,e.jsx(t.Text,{size:"sm",fw:600,c:"var(--mantine-color-gray-7)",truncate:!0,w:"100%",style:{opacity:f?.5:1},children:n}),e.jsxs(t.Group,{gap:"xs",align:"center",children:[r&&e.jsx(t.Text,{size:"xs",c:"dimmed",children:r}),w&&!f&&e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[s&&e.jsx(me,{icon:k.IconPlus,grayScaleBaseColor:1,onClick:O,color:"var(--mantine-color-gray-7)"}),(i&&i.length>0||s)&&e.jsx("div",{onClick:F=>F.stopPropagation(),children:e.jsx(ye,{menuItems:L,trigger:e.jsx(me,{icon:k.IconDots,grayScaleBaseColor:1,color:"var(--mantine-color-gray-7)"}),position:"bottom-end",shadow:"md"})})]})]})]})}),v&&!h&&e.jsx(t.Stack,{gap:0,style:{width:"100%"},children:M?N():e.jsx(t.Box,{style:{marginLeft:l>0?`${l*16}px`:"0px"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"left",p:"sm",fw:500,children:d})})})]})},kt="userChip-module__pill___DgFME",Ct={pill:kt},Ce=({avatar:n,name:r,withRemoveButton:o=!1,onRemove:s})=>e.jsx(t.Pill,{withRemoveButton:o,onRemove:s,radius:"md",p:"0px",size:"md",className:Ct.pill,bg:"transparent",children:e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{alignItems:"center"},children:[e.jsx(se,{avatar:n,size:24,placeholder:r,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:450,c:"var(--mantine-color-gray-9)",children:r})]})}),Mt="200px",Tt="4px 8px",Bt=40,Ot="var(--mantine-radius-md)",zt=16,hn=({item:n,withAvatars:r,disabled:o=!1,onClick:s,selected:a=!1})=>{const[i,c]=u.useState(!1);return e.jsx(t.Box,{onMouseEnter:()=>!o&&c(!0),onMouseLeave:()=>!o&&c(!1),onClick:d=>{d.preventDefault(),d.stopPropagation(),o||s==null||s(n.value)},onMouseDown:d=>{d.stopPropagation()},style:{minWidth:Mt,backgroundColor:o?"transparent":i?"var(--mantine-color-gray-1)":"transparent",cursor:o?"default":"pointer",borderRadius:Ot,padding:Tt,transition:"background-color 0.2s ease",opacity:o?.5:1},children:e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",align:"flex-start",style:{alignItems:"center"},h:Bt,children:[r&&n.avatar&&e.jsx("img",{src:n.avatar,alt:n.label,style:{width:"24px",height:"24px",borderRadius:"var(--mantine-radius-sm)",objectFit:"cover"}}),e.jsxs(t.Stack,{gap:0,style:{flex:1},children:[e.jsx(t.Text,{size:"sm",fw:500,lh:-1,c:o?"var(--mantine-color-gray-5)":"var(--mantine-color-gray-9)",children:n.label}),e.jsx(t.Text,{size:"xs",c:o?"var(--mantine-color-gray-4)":"dimmed",children:n.description})]}),a&&e.jsx(k.IconCheck,{size:zt,color:"var(--mantine-color-gray-9)"})]})})},Rt="bottom-end",Dt=1e4,Et="24px",At="0 8px",Lt="6px",Je="var(--mantine-radius-md)",Ft="46px",De=({value:n,onChange:r,data:o,withRemove:s=!1,withAvatars:a=!1,onRemove:i,disabledOptions:c=[],disabled:d=!1,defaultOption:l,popoverStyles:f,dropdownStyles:h,triggerStyles:g,textStyles:p})=>{const[y,x]=u.useState(!1),m=(o||[]).find(j=>j.value===n)||l,[I,b]=u.useState(!1),[v,S]=u.useState(!1),[w,B]=u.useState(!1),M=s?e.jsx(t.Group,{p:"sm",onClick:j=>{j.stopPropagation(),i==null||i(n)},style:{cursor:"pointer",height:Ft,display:"flex",alignItems:"center",borderRadius:Je,backgroundColor:v?"var(--mantine-color-red-0)":"transparent",transition:"background-color 0.2s ease"},onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-red-6)",fw:500,children:"Remove user"})}):null,C=e.jsxs(t.Box,{onMouseEnter:()=>!d&&b(!0),onMouseLeave:()=>!d&&b(!1),onClick:()=>{d||(x(!0),B(!0))},style:{height:Et,cursor:d?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:Je,backgroundColor:d?"transparent":I||w?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:At,gap:Lt,width:"auto",opacity:d?.6:1,...g},children:[e.jsx(t.Text,{size:"sm",fw:p!=null&&p.fontWeight?void 0:500,c:d?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",style:{color:d?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",lineHeight:"24px",whiteSpace:"nowrap",...p},children:(m==null?void 0:m.label)||"Select option"}),e.jsx(k.IconChevronDown,{size:16,style:{color:d?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(t.Popover,{opened:y,onChange:j=>{x(j),j||B(!1)},position:Rt,shadow:"md",withinPortal:!0,zIndex:Dt,styles:f,children:[e.jsx(t.Popover.Target,{children:C}),e.jsx(t.Popover.Dropdown,{onClick:j=>j.stopPropagation(),onMouseDown:j=>j.stopPropagation(),styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",padding:"4px",...h}},children:e.jsxs(t.Stack,{gap:0,onClick:j=>j.stopPropagation(),onMouseDown:j=>j.stopPropagation(),children:[(o||[]).map(j=>{const R=c.includes(j.value),D=j.value===n;return e.jsx(hn,{item:j,withAvatars:a,disabled:R,selected:D,onClick:O=>{r==null||r(O),x(!1),B(!1)}},j.value)}),M]})})]})},Pt=(n,r,o,s)=>{const a=u.useRef(null),i=u.useRef(null),c=u.useCallback(l=>{l[0].isIntersecting&&o&&!s&&r&&r()},[o,s,r]),d=u.useCallback(()=>{if(!(!a.current||!n||!r)){i.current&&(i.current.disconnect(),i.current=null);try{const l=new IntersectionObserver(c,{threshold:.1,rootMargin:"50px"});l.observe(a.current),i.current=l}catch(l){console.error("Failed to setup intersection observer:",l)}}},[n,r,c]);return u.useEffect(()=>(d(),()=>{i.current&&(i.current.disconnect(),i.current=null)}),[d]),u.useEffect(()=>()=>{i.current&&(i.current.disconnect(),i.current=null)},[]),{loadMoreRef:a}},pn=({tableName:n,data:r,columns:o,onAddItem:s,addItemComponent:a,addItemLabel:i="Add item",loading:c=!1,emptyMessage:d="No data found",searchPlaceholder:l="Search...",enableAutoFilters:f=!0,customFilters:h=[],onCustomFilter:g,onSort:p,sortColumn:y,sortDirection:x,onSearch:m,onRowClick:I,size:b="md",striped:v=!1,highlightOnHover:S=!0,enableInfiniteScroll:w=!1,isLoadingMore:B=!1,hasMore:M=!1,onLoadMore:C})=>{const[j,R]=u.useState(""),[D,O]=u.useState([]),{loadMoreRef:E}=Pt(w,C||(()=>{}),M,B),N=u.useMemo(()=>[...f?o.filter(z=>z.type==="select"&&z.options).map(z=>({value:z.key,label:z.label})):[],...h],[o,f,h]),H=u.useMemo(()=>{let T=r||[];if(j){const z=j.toLowerCase();T=T.filter(A=>o.some(P=>{if(!P.searchable)return!1;const V=A[P.key];return V==null?!1:String(V).toLowerCase().includes(z)}))}return D.forEach(z=>{if(z.filterTag.selectedOption){const A=o.find(P=>P.key===z.filterTag.filterOption.value);A&&(T=T.filter(P=>{var ne;const V=P[A.key];return String(V)===((ne=z.filterTag.selectedOption)==null?void 0:ne.value)}))}}),T},[r,j,D,o]),U=T=>{R(T),m==null||m(T)},L=T=>{const z=o.find(P=>P.key===T);if(!(z!=null&&z.sortable))return;const A=y===T&&x==="asc"?"desc":"asc";p==null||p(T,A)},F=T=>{const z=o.find(A=>A.key===T);return(z==null?void 0:z.type)==="select"&&z.options?z.options.map(A=>({value:A.value,label:A.label})):(z==null?void 0:z.type)==="badge"?[...new Set(r.map(P=>P[z.key]).filter(Boolean))].map(P=>({value:String(P),label:String(P).charAt(0).toUpperCase()+String(P).slice(1)})):z?[...new Set(r.map(P=>P[z.key]).filter(Boolean))].map(P=>({value:String(P),label:String(P).charAt(0).toUpperCase()+String(P).slice(1)})):[]},W=(T,z)=>{var P,V,ne,$,oe;const A=z[T.key];switch(T.type){case"text":return e.jsx(t.Text,{size:"sm",c:A?void 0:"dimmed",children:A||"—"});case"date":if(!A)return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});const Z=new Date(A),de=T.format?Z.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):Z.toLocaleDateString();return e.jsx(t.Text,{size:"sm",c:"dimmed",children:de});case"select":return T.options?e.jsx(De,{value:A,data:T.options,placeholder:T.label,onChange:re=>{var xe;return(xe=T.onSelectChange)==null?void 0:xe.call(T,re,z)},disabled:(P=T.disabled)==null?void 0:P.call(T,z)}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Ee=((V=T.badgeColors)==null?void 0:V[A])||"gray";return e.jsx(t.Badge,{color:Ee,variant:"light",size:"sm",radius:"md",fw:600,children:A||"Unknown"});case"avatar":const Ae=((ne=T.fallbackText)==null?void 0:ne.call(T,z))||String(A).charAt(0).toUpperCase();return e.jsx(se,{avatar:A,size:"xs",placeholder:Ae,showPlaceholder:!0});case"custom":return(($=T.render)==null?void 0:$.call(T,A,z))||e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(oe=T.actions)!=null&&oe.length?e.jsxs(t.Menu,{shadow:"md",width:200,position:"bottom-end",styles:{dropdown:{borderRadius:"var(--mantine-radius-md)"}},children:[e.jsx(t.Menu.Target,{children:e.jsx(t.ActionIcon,{variant:"subtle",size:"md",color:"gray",radius:"md",children:e.jsx(k.IconDots,{size:16})})}),e.jsx(t.Menu.Dropdown,{children:T.actions.map((re,xe)=>{var je;return e.jsx(t.Menu.Item,{color:re.color,leftSection:re.icon,disabled:(je=re.disabled)==null?void 0:je.call(re,z),onClick:()=>re.onClick(z),styles:{item:{borderRadius:"var(--mantine-radius-md)"}},children:re.label},xe)})})]}):null;default:return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"})}},G=T=>{var z;return(z=o.find(A=>A.key===T))!=null&&z.sortable?y===T?x==="asc"?e.jsx(k.IconChevronUp,{size:14}):e.jsx(k.IconChevronDown,{size:14}):e.jsx(k.IconChevronUp,{size:14,style:{opacity:.3}}):null},_=(()=>{switch(b){case"sm":return{buttonSize:"xs",textSize:"sm"};case"lg":return{buttonSize:"md",textSize:"md"};default:return{buttonSize:"sm",textSize:"sm"}}})();return e.jsxs(t.Box,{pos:"relative",children:[e.jsx(t.LoadingOverlay,{visible:c}),e.jsxs(t.Stack,{gap:"sm",w:"100%",children:[e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",justify:"space-between",children:[e.jsx(t.Text,{fw:600,c:"var(--mantine-color-gray-8)",children:n}),e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[e.jsx(fn,{placeholder:l,value:j,onChange:U,onSearch:U,expandDirection:"right",size:_.buttonSize}),N.length>0&&e.jsx(ze,{activeFilters:D.map(T=>T.filterTag),onFiltersChange:T=>{O(T.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),g==null||g(T)},availableFilters:N,size:_.buttonSize})]}),s&&e.jsx(t.Button,{size:"compact-md",h:32,style:{fontSize:`var(--mantine-font-size-${_.textSize})`,border:"none"},radius:"md",onClick:s,children:i})]})]}),N.length>0&&e.jsx(Re,{activeFilters:D.map(T=>T.filterTag),onFiltersChange:T=>{O(T.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),g==null||g(T)},availableFilters:N,size:"md",getFilterOptions:F})]}),a,e.jsxs(t.Table,{striped:v,highlightOnHover:S,highlightOnHoverColor:"var(--mantine-color-gray-0)",mt:"xs",children:[e.jsx(t.Table.Thead,{children:e.jsx(t.Table.Tr,{children:o.map(T=>e.jsx(t.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:T.width,textAlign:T.align||"left",cursor:T.sortable?"pointer":"default"},onClick:()=>T.sortable&&L(T.key),children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[T.icon&&e.jsx(t.Box,{style:{display:"flex",alignItems:"center"},children:T.icon}),e.jsx(t.Text,{size:_.textSize,fw:500,children:T.label}),G(T.key)]})},String(T.key)))})}),e.jsx(t.Table.Tbody,{children:H.length===0?e.jsx(t.Table.Tr,{children:e.jsx(t.Table.Td,{colSpan:o.length,ta:"center",py:"xl",children:e.jsx(t.Text,{c:"dimmed",children:d})})}):H.map((T,z)=>e.jsx(t.Table.Tr,{style:{cursor:I?"pointer":"default"},onClick:()=>I==null?void 0:I(T),children:o.map(A=>e.jsx(t.Table.Td,{style:{textAlign:A.align||"left"},children:W(A,T)},String(A.key)))},T.id||z))})]}),w&&e.jsx(t.Box,{ref:E,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:B&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more..."})]})})]})};Object.assign(pn,{});const Ut=({onAvatarSelect:n,onEmojiSelect:r,onImageSelect:o,onIconSelect:s}={})=>{const[a,i]=u.useState("emoji"),[c,d]=u.useState(null),[l,f]=u.useState(null),[h,g]=u.useState(null),[p,y]=u.useState(null),[x,m]=u.useState(null),I=u.useCallback(j=>{i(j)},[]),b=u.useCallback(j=>{d(j)},[]),v=u.useCallback(j=>{m(j);const R=new FileReader;R.onload=D=>{var E;const O=(E=D.target)==null?void 0:E.result;f(O)},R.readAsDataURL(j)},[]),S=u.useCallback(j=>{g(j),f(null),m(null),y(null),n==null||n({type:"emoji",value:j}),r==null||r(j)},[n,r]),w=u.useCallback(j=>{y(j),f(null),m(null),g(null),n==null||n({type:"icon",value:j}),s==null||s(j)},[n,s]),B=u.useCallback(()=>{if(x&&l){const j=URL.createObjectURL(x);n==null||n({type:"image",value:j}),o==null||o(x)}},[x,l,n,o]),M=u.useCallback(()=>{f(null),m(null),g(null),y(null)},[]),C=u.useCallback(()=>{f(null),g(null),y(null),m(null),i("emoji"),d(null)},[]);return{selectedTab:a,tabHovered:c,previewImage:l,selectedEmoji:h,selectedIcon:p,selectedFile:x,handleTabChange:I,handleTabHover:b,handleImagePreview:v,handleImageAccept:B,handleEmojiSelect:S,handleIconSelect:w,clearImagePreview:M,resetState:C}},Nt=({opened:n,onClose:r,popoverRef:o})=>{const s=u.useCallback(i=>{n&&o.current&&!o.current.contains(i.target)&&(console.log("Click outside detected, closing popover"),r())},[n,r,o]),a=u.useCallback(i=>{i.key==="Escape"&&n&&(console.log("Escape key pressed, closing popover"),r())},[n,r]);return u.useEffect(()=>{if(n)return document.addEventListener("mousedown",s),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",a)}},[n,s,a]),{handleClickOutside:s,handleEscape:a}},Wt=({selectedTab:n,tabHovered:r,onTabChange:o,onTabHover:s,onRemove:a,hasAvatar:i=!1,children:c})=>{const[d,l]=u.useState(!1);return e.jsxs(t.Tabs,{color:"black",value:n,styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(t.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",w:"100%",children:[e.jsx(t.Tabs.Tab,{value:"emoji",p:0,pb:"xs",onClick:()=>o("emoji"),onMouseEnter:()=>s("emoji"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:r==="emoji"?"var(--mantine-color-gray-1)":"transparent",color:n==="emoji"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Emoji"})})}),e.jsx(t.Tabs.Tab,{value:"icons",p:0,pb:"xs",onClick:()=>o("icons"),onMouseEnter:()=>s("icons"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:r==="icons"?"var(--mantine-color-gray-1)":"transparent",color:n==="icons"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Icons"})})}),e.jsx(t.Tabs.Tab,{value:"image",p:0,pb:"xs",onClick:()=>o("image"),onMouseEnter:()=>s("image"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:r==="image"?"var(--mantine-color-gray-1)":"transparent",color:n==="image"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Image"})})}),a&&i&&e.jsx(t.Group,{justify:"flex-end",display:"flex",flex:1,pb:"xs",children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:d?"var(--mantine-color-red-0)":"transparent",color:d?"var(--mantine-color-red-6)":"var(--mantine-color-gray-6)",cursor:"pointer",transition:"all 0.1s ease"},fw:500,fz:"var(--mantine-font-size-sm)",onClick:a,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:"Remove"})})]}),e.jsx(t.Tabs.Panel,{value:"emoji",children:n==="emoji"?c:null}),e.jsx(t.Tabs.Panel,{value:"icons",children:n==="icons"?c:null}),e.jsx(t.Tabs.Panel,{value:"image",children:n==="image"?c:null})]})};let en=!1;en||(tn.init({data:Me}),en=!0);const $t=()=>{const n=[{id:"frequent",name:"Frequently Used",icon:e.jsx(k.IconClock,{size:20,strokeWidth:2.5})}];return Me.categories.forEach(r=>{if(r.emojis&&r.emojis.length>0){let o=e.jsx(k.IconMoodSmile,{size:20,strokeWidth:2}),s=r.name;switch(r.id){case"people":o=e.jsx(k.IconMoodSmile,{size:20,strokeWidth:2}),s="Smileys & People";break;case"nature":o=e.jsx(k.IconTrees,{size:20,strokeWidth:2}),s="Animals & Nature";break;case"foods":o=e.jsx(k.IconApple,{size:20,strokeWidth:2}),s="Food & Drink";break;case"activity":o=e.jsx(k.IconBallBasketball,{size:20,strokeWidth:2}),s="Activities";break;case"travel":o=e.jsx(k.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"places":o=e.jsx(k.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"objects":o=e.jsx(k.IconBulb,{size:20,strokeWidth:2}),s="Objects";break;case"symbols":o=e.jsx(k.IconHeart,{size:20,strokeWidth:2}),s="Symbols";break;case"flags":o=e.jsx(k.IconFlag,{size:20,strokeWidth:2}),s="Flags";break;case"frequent":return;default:o=e.jsx(k.IconMoodSmile,{size:20,strokeWidth:2}),s=`Category: ${r.id}`;break}n.push({id:r.id,name:s,icon:o})}}),n},Ht=({onEmojiSelect:n,height:r=200})=>{const[o,s]=u.useState(""),[a,i]=u.useState("people"),[c,d]=u.useState(()=>{if(typeof window<"u"){const I=localStorage.getItem("emoji-frequent");return I?JSON.parse(I):[]}return[]}),[l,f]=u.useState([]),[h,g]=u.useState(!1),p=$t();u.useEffect(()=>{o.trim()?(g(!0),tn.SearchIndex.search(o).then(I=>{f(I.map(b=>({id:b.id,native:b.skins[0].native,name:b.name,keywords:b.keywords}))),g(!1)})):f([])},[o]);const y=u.useMemo(()=>{if(o.trim())return l;if(a==="frequent")return c.map(b=>({id:b,native:b,name:"",keywords:[]}));const I=Me.categories.find(b=>b.id===a);return I?I.emojis.map(b=>{const v=Me.emojis[b];return{id:v.id,native:v.skins[0].native,name:v.name,keywords:v.keywords}}):[]},[o,a,c,l]),x=I=>{n(I),d(b=>{const v=b.filter(w=>w!==I),S=[I,...v].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(S)),S})},m=I=>{if(o.trim())return"Results";const b=p.find(v=>v.id===I);return b?b.name:I.charAt(0).toUpperCase()+I.slice(1)};return e.jsxs(t.Stack,{gap:0,style:{height:r,width:"100%"},children:[e.jsx(t.Box,{p:"sm",pb:"xs",children:e.jsxs(t.Stack,{gap:"xs",children:[e.jsx(t.TextInput,{placeholder:"Search emojis...",value:o,onChange:I=>s(I.target.value),leftSection:e.jsx(k.IconSearch,{size:16,strokeWidth:2.5}),fw:500,size:"sm",radius:"md",styles:{input:{backgroundColor:"var(--mantine-color-gray-0)",color:"var(--mantine-color-gray-9)"}}}),e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:m(a)})]})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.ScrollArea,{h:"100%",type:"hover",offsetScrollbars:!1,children:e.jsx(t.Box,{style:{display:"grid",gridTemplateColumns:"repeat(9, 1fr)",gap:"0px",padding:"0px 12px 12px 12px"},children:h?e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"Searching..."}):y.length>0?y.map(I=>e.jsx(t.Tooltip,{label:I.name||I.id,position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Button,{variant:"subtle",size:"sm",p:0,onClick:()=>x(I.native),style:{width:"40px",height:"40px",fontSize:"22px",border:"none",backgroundColor:"transparent",borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent"},children:I.native})},I.id)):e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"No emojis found"})})})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:p.map(I=>e.jsx(t.Tooltip,{label:I.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>{i(I.id),s("")},style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer","&:hover":{backgroundColor:"var(--mantine-color-gray-0)"},backgroundColor:a===I.id?"var(--mantine-color-gray-0)":"transparent",color:a===I.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.1s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent"},children:I.icon})},I.id))})})]})},xn=["IconUser","IconUserCircle","IconUserCheck","IconUserX","IconUserPlus","IconUserMinus","IconUserEdit","IconUserCog","IconUserShield","IconUserStar","IconUserSearch","IconUserQuestion","IconUserOff","IconUsers","IconUserBolt","IconUserCode","IconUserDollar","IconUserExclamation","IconUserFilled","IconUserHexagon","IconUserKey","IconUserPause","IconUserPin","IconUserPlay","IconUserScan","IconUserShare","IconUserSquare","IconUserUp","IconUserVoice","IconUserWrench"],mn=["IconBriefcase","IconBuilding","IconBuildingStore","IconBuildingBank","IconBuildingWarehouse","IconBuildingSkyscraper","IconBuildingBridge","IconBuildingCar","IconBuildingFactory","IconBuildingHospital","IconBuildingMonument","IconBuildingPavilon","IconBuildingTunnel","IconBuildingWindmill","IconChartBar","IconChartLine","IconChartPie","IconChartDots","IconChartArea","IconChartArcs","IconChartCandle","IconChartDonut","IconChartRadar","IconTrendingUp","IconTrendingDown","IconTarget","IconFlag","IconTrophy","IconAward","IconMedal","IconCertificate","IconBadge","IconCrown","IconStar","IconStarFilled","IconStarHalf","IconStarOff","IconFileText","IconFile","IconFileAlert","IconFileAnalytics","IconFileBarcode","IconFileBroken","IconFileCertificate","IconFileChart","IconFileCheck","IconFileCode","IconFileDatabase","IconFileDollar","IconFileDownload","IconFileEuro","IconFileExport","IconFileFunction","IconFileImport","IconFileInfo","IconFileInvoice","IconFileLambda","IconFileLike","IconFileMinus","IconFileMusic","IconFileOff","IconFilePencil","IconFilePhone","IconFilePlus","IconFileReport","IconFileRss","IconFileScissors","IconFileSearch","IconFileSettings","IconFileShredder","IconFileSignal","IconFileSpreadsheet","IconFileStar","IconFileSymlink","IconFileTime","IconFileType","IconFileTypography","IconFileUnknown","IconFileUpload","IconFileVector","IconFileX","IconFileZip","IconFolder","IconFolderOpen","IconFolderPlus","IconFolderMinus","IconFolderX","IconFolderCheck","IconFolderCog","IconFolderDown","IconFolderHeart","IconFolderOff","IconFolderPause","IconFolderPin","IconFolderQuestion","IconFolderSearch","IconFolderShare","IconFolderStar","IconFolderUp","IconFolderWrench","IconArchive","IconArchiveOff","IconBox","IconBoxMultiple","IconBoxOff","IconBoxPadding","IconBoxSeam","IconBriefcaseOff","IconClipboard","IconClipboardCheck","IconClipboardCopy","IconClipboardData","IconClipboardHeart","IconClipboardList","IconClipboardOff","IconClipboardPaste","IconClipboardText","IconClipboardTypography","IconClipboardX","IconCopy","IconCut","IconPaste","IconDuplicate","IconEdit","IconEditCircle","IconEditCircleOff"],gn=["IconDeviceDesktop","IconDeviceLaptop","IconDeviceMobile","IconDeviceTablet","IconDeviceWatch","IconDeviceTv","IconDeviceGamepad","IconDeviceAirpods","IconDeviceImac","IconDeviceIpad","IconDeviceIphone","IconDeviceMacbook","IconDeviceNintendo","IconDevicePlaystation","IconDeviceXbox","IconCode","IconTerminal","IconDatabase","IconServer","IconWifi","IconBluetooth","IconCpu","IconKeyboard","IconMouse","IconCamera","IconVideo","IconMicrophone","IconSpeaker","IconHeadphones","IconPrinter","IconScanner","IconRouter","IconModem","IconAntenna","IconSatellite","IconRadar","IconRadar2","IconBroadcast","IconBroadcastOff","IconRadio","IconRadioactive","IconRadioactiveOff","IconSignal","IconSignal4G","IconSignal5G","IconSignalOff","IconBattery","IconBattery1","IconBattery2","IconBattery3","IconBattery4","IconBatteryOff","IconBatteryCharging","IconBatteryAutomotive","IconBatteryEco","IconBatteryFilled","IconPlug","IconPlugConnected","IconPlugConnectedX","IconPlugOff","IconPlugX","IconPower","IconPowerOff","IconOutlet","IconCable","IconCableOff","IconCircuitAmmeter","IconCircuitBattery","IconCircuitBulb","IconCircuitCapacitor","IconCircuitCell","IconCircuitCellPlus","IconCircuitChangeover","IconCircuitDiode","IconCircuitDiodeZener","IconCircuitGround","IconCircuitGroundDigital","IconCircuitInductor","IconCircuitMotor","IconCircuitPushbutton","IconCircuitResistor","IconCircuitSwitchClosed","IconCircuitSwitchOpen","IconCircuitVoltmeter","IconCpu2","IconCpuOff","IconMemory","IconMemoryCard","IconMemoryStick","IconHardDrive","IconHardDrive2","IconDisk","IconDiskOff","IconCd","IconCdOff","IconDvd","IconDvdOff","IconFloppyDisk","IconFloppyDiskOff","IconUsb","IconUsbOff","IconSdCard","IconSdCardOff","IconCloud","IconCloudComputing","IconCloudDataConnection","IconCloudDownload","IconCloudLock","IconCloudOff","IconCloudRain","IconCloudSnow","IconCloudStorm","IconCloudUpload","IconCloudCheck","IconCloudCode","IconCloudCog","IconCloudDollar","IconCloudDown","IconCloudExclamation","IconCloudHeart","IconCloudMinus","IconCloudPause","IconCloudPin","IconCloudPlus","IconCloudQuestion","IconCloudSearch","IconCloudShare","IconCloudStar","IconCloudUp","IconCloudX"],In=["IconMoodSmile","IconMoodHappy","IconMoodWink","IconMoodSad","IconMoodConfused","IconMoodAnnoyed","IconMoodAngry","IconMoodCry","IconMoodTongue","IconMoodKiss","IconMoodHeart","IconMoodLove","IconMoodEmpty","IconMoodNervous","IconMoodSuprised","IconMoodSilence","IconMoodSick","IconMoodTongueWink","IconMoodTongueWink2","IconMoodWink2","IconHeart","IconHeartFilled","IconHeartBroken","IconHeartHandshake","IconHeartMinus","IconHeartOff","IconHeartPlus","IconHeartRateMonitor","IconThumbUp","IconThumbDown","IconSmile","IconFrown","IconMeh","IconLaugh","IconWink","IconKiss","IconTongue","IconGrin","IconSmirk"],yn=["IconTrees","IconLeaf","IconFlower","IconPlant","IconSun","IconMoon","IconStar","IconCloud","IconCloudRain","IconCloudSnow","IconSnowflake","IconDroplet","IconFlame","IconMountain","IconTree","IconPineTree","IconBug","IconButterfly","IconFish","IconBird","IconCat","IconDog","IconRabbit","IconPaw","IconPawprint","IconFeather","IconSeeding","IconSeedingOff","IconPlant2","IconPlantOff","IconLeafOff","IconFlower2","IconFlowerOff","IconTreesOff","IconTreeOff","IconPineTreeOff","IconPalmTree","IconPalmTreeOff","IconSunOff","IconSunHigh","IconSunLow","IconMoonOff","IconMoonStars","IconMoon2","IconMoonFilled","IconStars","IconStarsOff","IconStarFilled","IconStarHalf","IconStarOff","IconCloudOff","IconCloudStorm","IconCloudFog","IconCloudWind","IconSnowflakeOff","IconDropletOff","IconDropletFilled","IconDropletHalf","IconDropletHalf2","IconDropletHalfFilled","IconFlameOff","IconFire","IconFireExtinguisher","IconMountainOff","IconMountain2","IconHills","IconHillsOff","IconValley","IconValleyOff","IconBugOff","IconButterflyOff","IconBee","IconBeeOff","IconSpider","IconSpiderOff","IconAnt","IconAntOff","IconLadybug","IconLadybugOff","IconGrasshopper","IconGrasshopperOff","IconCricket","IconCricketOff","IconFishOff","IconFishBone","IconFishBoneOff","IconShark","IconSharkOff","IconWhale","IconWhaleOff","IconDolphin","IconDolphinOff","IconOctopus","IconOctopusOff","IconSeahorse","IconSeahorseOff","IconBirdOff","IconEagle","IconEagleOff","IconOwl","IconOwlOff","IconParrot","IconParrotOff","IconPeacock","IconPeacockOff","IconPenguin","IconPenguinOff","IconSwan","IconSwanOff","IconCatOff","IconDogOff","IconRabbitOff","IconFeatherOff","IconWing","IconWingOff","IconEgg","IconEggOff","IconEggCracked","IconEggCrackedOff","IconEggFilled","IconEggFilledOff","IconEggFried","IconEggFriedOff","IconNest","IconNestOff","IconNestEggs","IconNestEggsOff"],vn=["IconCircle","IconSquare","IconTriangle","IconDiamond","IconHexagon","IconPentagon","IconOctagon","IconCross","IconPlus","IconMinus","IconCheck","IconX","IconArrowUp","IconArrowDown","IconArrowLeft","IconArrowRight","IconArrowUpLeft","IconArrowUpRight","IconArrowDownLeft","IconArrowDownRight","IconArrowLeftUp","IconArrowLeftDown","IconArrowRightUp","IconArrowRightDown","IconPlay","IconPause","IconStop","IconRecord","IconSkipBack","IconSkipForward","IconRewind","IconFastForward","IconCircleDot","IconCircleFilled","IconCircleHalf","IconCircleHalf2","IconCircleHalfFilled","IconCircleOff","IconCircleX","IconSquareDot","IconSquareFilled","IconSquareHalf","IconSquareHalfFilled","IconSquareOff","IconSquareRounded","IconSquareRoundedDot","IconSquareRoundedFilled","IconSquareRoundedHalf","IconSquareRoundedHalfFilled","IconSquareRoundedOff","IconSquareRoundedX","IconSquareX","IconTriangleFilled","IconTriangleInverted","IconTriangleInvertedFilled","IconTriangleOff","IconTriangleSquare","IconTriangleSquareCircle","IconDiamondFilled","IconDiamondOff","IconHexagonFilled","IconHexagonOff","IconPentagonFilled","IconPentagonOff","IconOctagonFilled","IconOctagonOff","IconCrossOff","IconPlusMinus","IconMinusMinus","IconCheckbox","IconCheckboxOff","IconChecks","IconXbox","IconXboxOff","IconYinYang","IconYinYangOff","IconYoga","IconYogaOff","IconZodiac","IconZodiacOff","IconZoom","IconZoomCancel","IconZoomCode","IconZoomExclamation","IconZoomFilled","IconZoomIn","IconZoomInArea","IconZoomInAreaFilled","IconZoomInFilled","IconZoomMoney","IconZoomPan","IconZoomQuestion","IconZoomReplace","IconZoomReset","IconZoomScan","IconZoomScanFilled","IconZoomX"],jn=["IconEdit","IconDelete","IconSave","IconOpen","IconClose","IconAdd","IconRemove","IconSearch","IconFilter","IconSort","IconRefresh","IconReload","IconUndo","IconRedo","IconCut","IconCopy","IconPaste","IconDuplicate","IconMove","IconRotate","IconFlip","IconResize","IconScale","IconCrop","IconTransform","IconWrench","IconHammer","IconScrewdriver","IconTool","IconTools","IconSaw","IconDrill","IconDrillOff","IconAxe","IconAxeOff","IconPickaxe","IconPickaxeOff","IconShovel","IconShovelOff","IconRake","IconRakeOff","IconHoe","IconHoeOff","IconScythe","IconScytheOff","IconPitchfork","IconPitchforkOff","IconFork","IconForkOff","IconKnife","IconKnifeOff","IconSword","IconSwordOff","IconDagger","IconDaggerOff","IconSpear","IconSpearOff","IconBow","IconBowOff","IconArrow","IconArrowOff","IconCrossbow","IconCrossbowOff","IconGun","IconGunOff","IconPistol","IconPistolOff","IconRifle","IconRifleOff","IconShotgun","IconShotgunOff","IconBomb","IconBombOff","IconGrenade","IconGrenadeOff","IconDynamite","IconDynamiteOff","IconMine","IconMineOff","IconTorpedo","IconTorpedoOff","IconMissile","IconMissileOff","IconRocket","IconRocketOff","IconBazooka","IconBazookaOff","IconCannon","IconCannonOff","IconTank","IconTankOff","IconHelicopter","IconHelicopterOff","IconPlane","IconPlaneOff","IconJet","IconJetOff","IconSatellite","IconSatelliteOff","IconSpace","IconSpaceOff","IconGalaxy","IconGalaxyOff","IconPlanet","IconPlanetOff","IconEarth","IconEarthOff","IconMoon","IconMoonOff","IconSun","IconSunOff","IconStar","IconStarOff","IconAsteroid","IconAsteroidOff","IconComet","IconCometOff","IconMeteor","IconMeteorOff","IconUfo","IconUfoOff","IconAlien","IconAlienOff","IconRobot","IconRobotOff","IconAndroid","IconAndroidOff","IconIos","IconIosOff","IconWindows","IconWindowsOff","IconLinux","IconLinuxOff","IconMac","IconMacOff","IconUbuntu","IconUbuntuOff","IconDebian","IconDebianOff","IconRedhat","IconRedhatOff","IconCentos","IconCentosOff","IconFedora","IconFedoraOff","IconSuse","IconSuseOff","IconArch","IconArchOff","IconGentoo","IconGentooOff","IconSlackware","IconSlackwareOff","IconMint","IconMintOff","IconKali","IconKaliOff","IconParrot","IconParrotOff","IconBacktrack","IconBacktrackOff","IconBlackarch","IconBlackarchOff","IconPentoo","IconPentooOff","IconMatriux","IconMatriuxOff","IconNodezero","IconNodezeroOff","IconBugtraq","IconBugtraqOff","IconCyborg","IconCyborgOff","IconDefensive","IconDefensiveOff","IconDracos","IconDracosOff","IconFembuntu","IconFembuntuOff","IconGnacktrack","IconGnacktrackOff","IconHackintosh","IconHackintoshOff","IconHak5","IconHak5Off","IconHavij","IconHavijOff","IconJackal","IconJackalOff","IconKnoppix","IconKnoppixOff","IconKodachi","IconKodachiOff","IconLion","IconLionOff","IconMandriva","IconMandrivaOff","IconMobily","IconMobilyOff","IconMuslim","IconMuslimOff","IconNetrunner","IconNetrunnerOff","IconPardus","IconPardusOff","IconQubes","IconQubesOff","IconSabayon","IconSabayonOff","IconScientific","IconScientificOff","IconSemplice","IconSempliceOff","IconSiduction","IconSiductionOff","IconSlax","IconSlaxOff","IconSli","IconSliOff","IconTails","IconTailsOff","IconVector","IconVectorOff","IconVoid","IconVoidOff","IconWhonix","IconWhonixOff","IconZorin","IconZorinOff","IconAlpine","IconAlpineOff","IconElementary","IconElementaryOff","IconManjaro","IconManjaroOff","IconOpenbsd","IconOpenbsdOff","IconOpenSuse","IconOpenSuseOff","IconPop","IconPopOff","IconSolus","IconSolusOff"],bn=["IconMessage","IconMessageCircle","IconMessageDots","IconMessagePlus","IconMessageReport","IconMessageShare","IconMessageText","IconMessages","IconMessagesOff","IconMail","IconMailOpened","IconMailFast","IconMailOff","IconMailPause","IconMailPin","IconMailPlus","IconMailQuestion","IconMailSearch","IconMailShare","IconMailStar","IconMailUp","IconMailX","IconPhone","IconPhoneCall","IconPhoneIncoming","IconPhoneOff","IconPhoneOutgoing","IconPhonePause","IconPhonePlus","IconPhoneX","IconVideo","IconVideoOff","IconVideoPlus","IconCamera","IconCameraOff","IconCameraPlus","IconMicrophone","IconMicrophoneOff","IconMicrophone2","IconMicrophone2Off","IconHeadphones","IconHeadphonesOff","IconSpeaker","IconSpeakerOff","IconBroadcast","IconBroadcastOff","IconRadio","IconRadioactive","IconRadioactiveOff","IconAntenna","IconAntennaBars1","IconAntennaBars2","IconAntennaBars3","IconAntennaBars4","IconAntennaBars5","IconAntennaOff","IconSatellite","IconSatelliteOff","IconWifi","IconWifi0","IconWifi1","IconWifi2","IconWifiOff","IconBluetooth","IconBluetoothConnected","IconBluetoothOff","IconBluetoothX","IconShare","IconShareOff","IconShare2","IconShare3","IconAt","IconHash","IconLink","IconLinkOff","IconExternalLink","IconExternalLinkOff","IconSend","IconSendOff","IconSend2","IconReceipt","IconReceiptOff","IconReceipt2","IconReceiptRefund","IconReceiptTax","IconReceiptEuro","IconReceiptDollar","IconReceiptPound","IconReceiptYen","IconReceiptYuan","IconReceiptWon","IconReceiptRupee","IconReceiptBaht","IconReceiptLira","IconReceiptRuble","IconReceiptShekel","IconReceiptTaka","IconReceiptHryvnia","IconReceiptKrone","IconReceiptKrona","IconReceiptZloty","IconReceiptForint","IconReceiptLeu","IconReceiptLev","IconReceiptKuna","IconReceiptDinar","IconReceiptDirham","IconReceiptRial","IconReceiptRiyal","IconReceiptAfghani","IconReceiptAriary","IconReceiptCedi","IconReceiptDalasi","IconReceiptFranc","IconReceiptGourde","IconReceiptKina","IconReceiptKip","IconReceiptKwacha","IconReceiptKwanza","IconReceiptLari","IconReceiptLek","IconReceiptLilangeni","IconReceiptLoti","IconReceiptManat","IconReceiptMetical","IconReceiptNaira","IconReceiptPeso","IconReceiptPula","IconReceiptRand","IconReceiptRupiah","IconReceiptShilling","IconReceiptSom","IconReceiptSomoni","IconReceiptTenge","IconReceiptVatu","IconReceiptWon","IconReceiptXof","IconReceiptYuan","IconReceiptZloty"];[...xn,...mn,...gn,...In,...yn,...vn,...jn,...bn];const ge=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:xn},{id:"business",name:"Business & Work",icons:mn},{id:"tech",name:"Technology",icons:gn},{id:"expressions",name:"Expressions",icons:In},{id:"nature",name:"Nature & Animals",icons:yn},{id:"shapes",name:"Shapes & Symbols",icons:vn},{id:"actions",name:"Actions & Tools",icons:jn},{id:"communication",name:"Communication",icons:bn}],Gt={recent:e.jsx(k.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(k.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(k.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(k.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(k.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(k.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(k.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(k.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(k.IconMessage,{size:20,strokeWidth:2.5})},Vt=({selectedCategory:n,onCategoryChange:r})=>e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:ge.map(o=>{const s=Gt[o.id];return e.jsx(t.Tooltip,{label:o.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>r(o.id),style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",backgroundColor:n===o.id?"var(--mantine-color-gray-0)":"transparent",color:n===o.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.2s ease"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:a=>{a.currentTarget.style.backgroundColor=n===o.id?"var(--mantine-color-gray-0)":"transparent"},children:s})},o.id)})}),wn=u.memo(({onIconSelect:n,height:r=358})=>{var I,b;const[o,s]=u.useState(""),[a,i]=u.useState("recent"),[c,d]=u.useState(!1),[l,f]=u.useState([]);u.useLayoutEffect(()=>{if(typeof window<"u"){const v=localStorage.getItem("avatar-icon-recent");if(v)try{f(JSON.parse(v))}catch(S){console.warn("Error parsing recent icons from localStorage:",S)}}},[]);const h=u.useMemo(()=>ge.filter(v=>v.id!=="recent"&&!("isDynamic"in v)).flatMap(v=>v.icons),[]),g=u.useMemo(()=>{if(a==="recent"){const S=new Set(h);return l.filter(w=>S.has(w))}const v=ge.find(S=>S.id===a);return(v==null?void 0:v.icons)||[]},[a,l,h]),p=u.useCallback((v,S)=>{if(!v.trim())return S;const w=v.toLowerCase().trim(),B=w.split(/\s+/);return S.filter(M=>{const j=M.replace(/^Icon/,"").split(/(?=[A-Z])/).map(R=>R.toLowerCase().trim()).filter(R=>R.length>0);return!!(j.some(R=>B.some(D=>R===D))||w.length>2&&j.some(R=>B.some(D=>R.startsWith(D)))||w.length<=2&&j.some(R=>B.some(D=>R.includes(D)))||B.length>1&&B.every(R=>j.some(D=>D===R||D.startsWith(R))))})},[]),y=u.useMemo(()=>o.trim()?p(o,h):g,[o,g,h,p]),x=u.useCallback(v=>{h.includes(v)&&f(w=>{const B=[v,...w.filter(M=>M!==v)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(B)),B}),n(v)},[n,h]),m=u.useCallback(v=>{a!==v&&(s(""),i(v),requestAnimationFrame(()=>{d(!0),setTimeout(()=>d(!1),100)}))},[a]);return e.jsxs(t.Stack,{gap:0,style:{height:r,width:"100%"},children:[e.jsx(t.Box,{p:"sm",pb:"xs",children:e.jsxs(t.Stack,{gap:"xs",children:[e.jsx(t.TextInput,{placeholder:o.trim()?"Search all icons...":`Search in ${(I=ge.find(v=>v.id===a))==null?void 0:I.name}...`,value:o,onChange:v=>s(v.target.value),leftSection:e.jsx(k.IconSearch,{size:16}),fw:500,size:"sm",radius:"md",styles:{input:{backgroundColor:"var(--mantine-color-gray-0)",color:"var(--mantine-color-gray-9)"}}}),e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:o.trim()?"Results":(b=ge.find(v=>v.id===a))==null?void 0:b.name})]})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.ScrollArea,{h:"100%",type:"hover",children:e.jsx(t.Box,{style:{display:"grid",gridTemplateColumns:"repeat(8, 1fr)",gap:"4px",padding:"0 12px 12px 12px",opacity:c?.7:1,transition:"opacity 0.05s ease"},children:y.map(v=>e.jsx(rn,{iconName:v,onClick:()=>x(v),size:20},o.trim()?`search-${v}`:`${a}-${v}`))},`${a}-${o}`)})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(Vt,{selectedCategory:a,onCategoryChange:m})})]})});wn.displayName="IconGrid";const _t=({previewImage:n,fileInputRef:r,selectedEmoji:o,size:s,loading:a,onFileInputClick:i,onImageChange:c,onImageAccept:d,onClearImagePreview:l})=>e.jsx(t.Box,{p:"sm",style:{width:"384px"},children:e.jsxs(t.Stack,{gap:"md",align:"center",children:[n||o?e.jsxs(t.Box,{children:[e.jsx(t.Text,{size:"sm",fw:500,mb:"xs",children:"Preview"}),e.jsx(t.Avatar,{src:n,radius:"md",style:{width:`${he(s)}px !important`,height:`${he(s)}px !important`,minWidth:`${he(s)}px`,minHeight:`${he(s)}px`,maxWidth:`${he(s)}px`,maxHeight:`${he(s)}px`,border:"1px solid var(--mantine-color-gray-4)",objectFit:"cover",boxSizing:"border-box"},children:o})]}):e.jsx(t.Button,{variant:"subtle",bg:"gray.0",styles:{root:{height:"64px"}},leftSection:e.jsx(k.IconPhoto,{size:20}),onClick:i,loading:a,disabled:a,fullWidth:!0,children:"Choose Image"}),n||o?e.jsx(t.Button,{variant:"outline",leftSection:e.jsx(k.IconPhoto,{size:16}),onClick:i,loading:a,disabled:a,fullWidth:!0,children:n||o?"Change Image":"Choose Image"}):null,e.jsx("input",{ref:r,type:"file",accept:"image/jpeg,image/jpg,image/png,image/gif,image/webp",onChange:f=>{var h;return c(((h=f.target.files)==null?void 0:h[0])||null)},style:{display:"none"},disabled:a}),(n||o)&&e.jsxs(t.Group,{gap:"sm",w:"100%",children:[e.jsx(t.Button,{variant:"outline",color:"gray",onClick:l,fullWidth:!0,children:"Back"}),e.jsx(t.Button,{color:"blue",onClick:d,loading:a,disabled:a,fullWidth:!0,children:"Accept"})]}),e.jsx(t.Text,{size:"xs",c:"var(--mantine-color-gray-6)",ta:"center",children:"Supported formats: JPG, PNG, GIF, WebP"})]})}),Qt=({onEmojiSelect:n})=>e.jsx(Ht,{onEmojiSelect:n,height:358}),Yt=({onIconSelect:n})=>e.jsx(wn,{onIconSelect:n,height:358}),qt=({previewImage:n,selectedEmoji:r,size:o,loading:s,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:d,fileInputRef:l})=>e.jsx(_t,{previewImage:n,fileInputRef:l,selectedEmoji:r,size:o,loading:s,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:d}),Zt=()=>e.jsx(t.Box,{style:{width:400,height:358,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs(t.Stack,{align:"center",gap:"sm",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"gray.6",children:"Loading avatar options..."})]})}),Ye=({editable:n=!0,opened:r,onOpen:o,onClose:s,avatar:a,onAvatarSelect:i,onRemove:c,size:d="lg",loading:l=!1,placeholder:f,showPlaceholder:h=!0,position:g="bottom-start",withinPortal:p=!0,zIndex:y=1e3})=>{const x=u.useRef(null),m=u.useRef(null),I=u.useRef(null),{selectedTab:b,tabHovered:v,previewImage:S,selectedEmoji:w,selectedIcon:B,selectedFile:M,handleTabChange:C,handleTabHover:j,handleImagePreview:R,handleImageAccept:D,handleEmojiSelect:O,handleIconSelect:E,clearImagePreview:N,resetState:H}=Ut({onAvatarSelect:i});Nt({opened:r,onClose:s,popoverRef:m}),u.useEffect(()=>{r||H()},[r,H]);const U=Z=>{console.log("Emoji clicked:",Z),O(Z),s()},L=Z=>{console.log("Icon clicked:",Z),E(Z),s()},F=Z=>{Z&&R(Z)},W=()=>{M?(D(),s()):(w||B)&&s()},G=()=>{x.current&&x.current.click()},X=()=>{N()},_=()=>{console.log("Avatar removed"),c==null||c(),s()},T=()=>!!a,z=()=>l?e.jsx(Te,{size:d,loading:!0}):e.jsx(se,{avatar:a,size:d,placeholder:f,showPlaceholder:h,editable:!0,onClick:()=>{!l&&!r&&o()}}),A=e.jsx(Qt,{onEmojiSelect:U}),P=e.jsx(Yt,{onIconSelect:L}),V=e.jsx(qt,{previewImage:S,selectedEmoji:w,size:d,loading:l,onFileInputClick:G,onImageChange:F,onImageAccept:W,onClearImagePreview:X,fileInputRef:x}),ne=e.jsx(t.Box,{children:e.jsx(Wt,{selectedTab:b,tabHovered:v,onTabChange:C,onTabHover:j,onRemove:_,hasAvatar:T(),children:b==="emoji"?A:b==="icons"?P:V})}),$=e.jsx("div",{style:{position:"relative",display:"inline-block"},children:e.jsxs(t.Popover,{opened:r,onClose:()=>{console.log("Popover onClose called"),s()},position:g,withinPortal:p,withArrow:!0,shadow:"md",radius:"md",closeOnClickOutside:!1,closeOnEscape:!1,offset:8,children:[e.jsx(t.Popover.Target,{children:e.jsx("div",{ref:I,style:{position:"relative"},children:z()})}),e.jsx(t.Popover.Dropdown,{ref:m,p:0,style:{width:"auto",overflow:"hidden",zIndex:y},children:e.jsx(u.Suspense,{fallback:e.jsx(Zt,{}),children:ne})})]})}),oe=e.jsx(se,{avatar:a,size:d,placeholder:f,showPlaceholder:h});return e.jsx(e.Fragment,{children:n?$:oe})},Xt=n=>{if(!n||typeof n!="string")return!1;const r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return n.length<5||n.length>254?!1:r.test(n.trim())},Kt=n=>{const r=[];return n.forEach(o=>{Xt(o)||r.push({email:o,error:"Please enter a valid email address"})}),{isValid:r.length===0,errors:r}},Jt=n=>{const r=[],o=new Set;return n.forEach(s=>{const a=s.toLowerCase().trim();o.has(a)?r.push({email:s,error:"This email has already been added"}):o.add(a)}),r},eo=n=>{const r=Kt(n),o=Jt(n),s=[...r.errors,...o];return{isValid:s.length===0,errors:s}},no=({value:n,onChange:r,onInputChange:o,suggestedUsers:s=[],tagDisplayMap:a={}})=>{const[i,c]=u.useState(""),[d,l]=u.useState([]),f=u.useRef(null),h=n.map(m=>{if(a[m])return a[m];const I=s.find(b=>b.email===m);return I&&I.name?I.name:m});u.useEffect(()=>{o&&o(i)},[i,o]),u.useEffect(()=>{if(n.length>0){const m=eo(n);l(m.errors)}else l([])},[n]),u.useEffect(()=>{const m=f.current;if(!m)return;let I;const b=v=>{const w=v.target.value||"";clearTimeout(I),I=setTimeout(()=>{c(w)},150)};return m.addEventListener("input",b),()=>{m.removeEventListener("input",b),clearTimeout(I)}},[]);const g=u.useCallback(m=>{const I=s.map(v=>({name:v.name||v.email,email:v.email})),b=m.map(v=>{const S=I.find(w=>w.name.toLowerCase()===v.toLowerCase());return S?S.email:v}).filter(v=>v.includes("@")?!0:!I.some(w=>{const B=w.name.toLowerCase(),M=v.toLowerCase();return B.startsWith(M)&&M!==B}));r(b),c("")},[r,s]),p=u.useCallback(()=>{f.current&&(f.current.value="",c(""))},[]),y=d.length===0&&n.length>0,x=u.useCallback((m,I,b)=>{m&&n.length>0&&I&&(m(n,I,b),c(""))},[n]);return{inputText:i,tagsInputRef:f,displayValue:h,validationErrors:d,isValid:y,handleEmailChange:g,clearInput:p,handleInvite:x}},Sn=({onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s=[],suggestedUsers:a=[],roleOptions:i=[]})=>{const[c,d]=u.useState([]),[l,f]=u.useState([]),[h,g]=u.useState(""),[p,y]=u.useState({}),x=i.length>0?i[0].value:void 0,[m,I]=u.useState(x);u.useEffect(()=>{i.length>0&&!m&&I(i[0].value)},[i.length,m]),u.useEffect(()=>{const O=a.filter(E=>c.includes(E.email)).map(E=>E.id);f(E=>E.filter(N=>O.includes(N)))},[c,a.length]);const[b,v]=u.useState("invite"),[S,w]=u.useState(null),B=(O,E,N)=>{n&&n(O,E,N),d([]),g("")},M=(O,E)=>{r&&r(O,E)},C=O=>{o&&o(O)},j=O=>{f(E=>E.includes(O)?E.filter(N=>N!==O):[...E,O])},R=O=>{c.includes(O.email)||(d([...c,O.email]),y(E=>({...E,[O.email]:O.name||O.email})),l.includes(O.id)||f([...l,O.id]),g(""))},D=h.trim()?a.filter(O=>{var N;const E=h.toLowerCase();return O.email.toLowerCase().includes(E)||((N=O.name)==null?void 0:N.toLowerCase().includes(E))}):[];return{emails:c,setEmails:d,selectedUsers:l,setSelectedUsers:f,inputText:h,setInputText:g,tagDisplayMap:p,setTagDisplayMap:y,selectedRole:m,setSelectedRole:I,selectedTab:b,setSelectedTab:v,tabHovered:S,setTabHovered:w,filteredUsers:D,handleInvite:B,handleUpdateRole:M,handleRemoveUser:C,handleToggleUser:j,handleAddSuggestedUser:R}},kn=u.forwardRef(({value:n,onChange:r,placeholder:o="Add one or more emails",onInvite:s,roleOptions:a=[],selectedRole:i,onRoleChange:c,onInputChange:d,suggestedUsers:l=[],tagDisplayMap:f={}},h)=>{const[g,p]=u.useState("Hello, I would like to invite you to join my workspace"),{tagsInputRef:y,displayValue:x,validationErrors:m,isValid:I,handleEmailChange:b,clearInput:v,handleInvite:S}=no({value:n,onChange:r,onInputChange:d,suggestedUsers:l,tagDisplayMap:f}),w=()=>{S(s,i,g),p("")};u.useImperativeHandle(h,()=>({clearInput:v}),[v]);const B=x.length>0,M=c&&a.length>0,C=m.length>0;return e.jsxs(t.Stack,{gap:"md",children:[e.jsxs(t.Box,{children:[e.jsx(t.Box,{style:{maxHeight:"120px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.TagsInput,{ref:y,value:x,onChange:b,placeholder:B?"":o,radius:"md",rightSection:M?e.jsx(t.Box,{style:{position:"absolute",right:"8px",top:"17px",transform:"translateY(-50%)",height:"24px",display:"flex",alignItems:"center"},children:e.jsx(De,{value:i||"",onChange:j=>c(j),data:a,placeholder:"Select role",defaultOption:a[a.length-1],disabledOptions:["owner"]})}):null,rightSectionProps:{style:{width:M?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:M?"130px":"12px",minHeight:"36px",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",borderRadius:"var(--mantine-radius-md)",border:C?"2px solid var(--mantine-color-red-6)":"2px solid var(--mantine-color-blue-7)",backgroundColor:"var(--mantine-color-gray-0)"},pillsList:{height:"24px !important",borderRadius:"var(--mantine-radius-md) !important"},pill:{height:"24px !important",borderRadius:"var(--mantine-radius-md) !important",backgroundColor:C?"var(--mantine-color-red-1) !important":"var(--mantine-color-orange-1) !important",color:C?"var(--mantine-color-red-7) !important":"var(--mantine-color-gray-7) !important",fontSize:"var(--mantine-font-size-sm)"}}})}),C&&e.jsx(t.Stack,{gap:"xs",mt:"xs",children:m.map((j,R)=>e.jsxs(t.Text,{size:"xs",c:"red",children:[j.email,": ",j.error]},R))})]}),B&&e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(t.Textarea,{size:"sm",value:g,onChange:j=>p(j.currentTarget.value),minRows:2,maxRows:4,radius:"md"}),e.jsx(t.Button,{variant:"filled",color:"blue",onClick:w,fullWidth:!0,radius:"md",disabled:!I,children:"Send invitations"})]})]})}),to=n=>{switch(n){case"member":return"green";case"invited":return"orange";case"declined":return"red";case"revoked":return"red";case"expired":return"red";default:return"gray"}},oo=n=>{switch(n){case"member":return"Member";case"invited":return"Invited";case"declined":return"Declined";case"revoked":return"Revoked";case"expired":return"Expired";default:return"Unknown"}},ro=n=>{if(n){if(typeof n=="object"&&"type"in n)return n;if(typeof n=="string")return{type:"image",value:n}}},ve=({user:n,isSelected:r=!1,onToggle:o,onUpdateRole:s,onRemoveUser:a,roleOptions:i=[],variant:c="invited",onClick:d})=>{var I;const l=((I=n.name)==null?void 0:I.trim())||n.email,f=()=>{o&&o(n.id)},h=b=>{if(s){const v=b;s(n.id,v)}},g=c==="suggested"||c==="read-only",p=c==="invited"&&i.length>0,[y,x]=u.useState(!1),m=()=>{d==null||d()};return e.jsxs(t.Group,{justify:"space-between",align:"center",wrap:"nowrap",w:"100%",style:{cursor:"pointer",borderRadius:"var(--mantine-radius-md)",padding:"6px"},onClick:m,bg:y?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),children:[e.jsxs(t.Group,{gap:"sm",w:"100%",align:"flex-start",wrap:"nowrap",children:[e.jsx(se,{avatar:ro(n.avatar),size:"md",placeholder:l,showPlaceholder:!0}),e.jsxs(t.Stack,{gap:0,w:"100%",justify:"flex-start",align:"flex-start",children:[e.jsxs(t.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsxs(t.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsx(t.Text,{size:"sm",fw:500,lineClamp:1,mb:-2,children:l}),n.isCurrentUser&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"gray",radius:"sm",children:"Owner"})]}),n.status!=="member"&&e.jsx(t.Badge,{size:"xs",variant:"light",color:to(n.status),radius:"sm",children:oo(n.status)})]}),e.jsx(t.Text,{size:"xs",c:"dimmed",lineClamp:1,children:n.email})]})]}),e.jsxs(t.Group,{gap:"sm",align:"center",children:[g&&c!=="read-only"&&e.jsx(t.Radio,{checked:r,onChange:f,size:"sm",onClick:b=>b.stopPropagation(),pr:4}),p&&!n.isCurrentUser&&e.jsx(De,{value:n.role,onChange:h,data:i,placeholder:"Select role",defaultOption:i.find(b=>b.value===n.role),withRemove:!0,onRemove:()=>a==null?void 0:a(n.id)})]})]})},Cn=({opened:n,onClose:r,onInvite:o,onUpdateRole:s,onRemoveUser:a,invitedUsers:i=[],children:c,roleOptions:d=[],suggestedUsers:l=[]})=>{const f=u.useRef(null),{emails:h,setEmails:g,selectedUsers:p,inputText:y,setInputText:x,tagDisplayMap:m,selectedRole:I,setSelectedRole:b,selectedTab:v,setSelectedTab:S,tabHovered:w,setTabHovered:B,filteredUsers:M,handleInvite:C,handleUpdateRole:j,handleRemoveUser:R,handleToggleUser:D,handleAddSuggestedUser:O}=Sn({onInvite:o,onUpdateRole:s,onRemoveUser:a,invitedUsers:i,suggestedUsers:l,roleOptions:d}),E=L=>{O(L),f.current&&f.current.clearInput()},N=e.jsxs(e.Fragment,{children:[e.jsx(kn,{ref:f,value:h,onChange:g,onInvite:C,roleOptions:d,selectedRole:I,onRoleChange:b,onInputChange:x,suggestedUsers:l,tagDisplayMap:m}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.ScrollArea,{mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:i.map(L=>e.jsx(ve,{user:L,isSelected:p.includes(L.id),onToggle:D,onUpdateRole:j,onRemoveUser:R,roleOptions:d,variant:"invited"},L.id))})]})})}),M.length>0&&e.jsx(t.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:M.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",y.trim()&&`(filtered by "${y}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:M.map(L=>e.jsx(ve,{user:L,isSelected:p.includes(L.id),onToggle:D,onUpdateRole:j,onRemoveUser:R,roleOptions:d,variant:"suggested",onClick:()=>E(L)},L.id))})]}):null})})]}),H=e.jsx(e.Fragment,{children:e.jsxs(t.Stack,{gap:"md",p:"sm",children:[e.jsxs(t.Stack,{gap:4,align:"center",children:[e.jsx(t.Text,{size:"sm",fw:500,ta:"center",children:"Publish to the web"}),e.jsx(t.Text,{size:"sm",fw:500,color:"var(--mantine-color-gray-6)",ta:"center",children:"Anyone with the link can view this page"})]}),e.jsx(t.Button,{variant:"filled",size:"xs",radius:"md",fw:500,fz:"var(--mantine-font-size-sm)",ta:"center",children:"Publish"})]})}),U=e.jsx(t.Box,{style:{width:"400px",maxHeight:"600px",overflow:"visible"},children:e.jsx(t.Stack,{gap:"lg",children:e.jsxs(t.Tabs,{color:"black",defaultValue:"invite",styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(t.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",children:[e.jsx(t.Tabs.Tab,{value:"invite",p:0,pb:6,onClick:()=>{S("invite")},onMouseEnter:()=>B("invite"),onMouseLeave:()=>B(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:w==="invite"?"var(--mantine-color-gray-1)":"transparent",color:v==="invite"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:"Invite"})}),e.jsx(t.Tabs.Tab,{value:"publish",p:0,pb:6,onClick:()=>{S("publish")},onMouseEnter:()=>B("publish"),onMouseLeave:()=>B(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:w==="publish"?"var(--mantine-color-gray-1)":"transparent",color:v==="publish"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:"Publish"})})]}),e.jsx(t.Tabs.Panel,{value:"invite",children:e.jsx(t.Box,{p:"sm",children:N})}),e.jsx(t.Tabs.Panel,{value:"publish",children:e.jsx(t.Box,{p:"sm",children:H})})]})})});return e.jsx(ye,{trigger:c,menuItems:[],opened:n,onClose:r,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:U})},so=({onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s,currentUser:a,roleOptions:i,suggestedUsers:c,label:d="Share"})=>{const[l,f]=u.useState(!1),h=()=>f(!1),g=e.jsx(Be,{label:d,onClick:()=>f(!0),isActive:l});return e.jsx(Cn,{opened:l,onClose:h,onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s,currentUser:a,roleOptions:i,suggestedUsers:c,children:g})},ao=({opened:n,onClose:r,onInvite:o,onUpdateRole:s,onRemoveUser:a,invitedUsers:i=[],roleOptions:c=[],suggestedUsers:d=[]})=>{const l=u.useRef(null),{emails:f,setEmails:h,selectedUsers:g,inputText:p,setInputText:y,tagDisplayMap:x,selectedRole:m,setSelectedRole:I,filteredUsers:b,handleInvite:v,handleUpdateRole:S,handleRemoveUser:w,handleToggleUser:B,handleAddSuggestedUser:M}=Sn({onInvite:o,onUpdateRole:s,onRemoveUser:a,invitedUsers:i,suggestedUsers:d,roleOptions:c}),C=j=>{M(j),l.current&&l.current.clearInput()};return e.jsx(t.Modal,{opened:n,onClose:r,size:"md",withCloseButton:!1,radius:"md",centered:!0,closeOnClickOutside:!1,closeOnEscape:!0,trapFocus:!1,zIndex:300,children:e.jsxs(t.Stack,{gap:"lg",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Text,{size:"md",fw:500,c:"var(--mantine-color-gray-8)",children:"Share"}),e.jsx(ee,{icon:k.IconX,size:"md",onClick:r,color:"var(--mantine-color-gray-8)"})]}),e.jsx(kn,{ref:l,value:f,onChange:h,onInvite:v,roleOptions:c,selectedRole:m,onRoleChange:I,onInputChange:y,suggestedUsers:d,tagDisplayMap:x}),i.length>0&&e.jsxs(t.Box,{children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.Stack,{gap:"sm",children:i.map(j=>e.jsx(ve,{user:j,isSelected:g.includes(j.id),onToggle:B,onUpdateRole:S,onRemoveUser:w,roleOptions:c,variant:"invited"},j.id))})})]}),b.length>0&&e.jsxs(t.Box,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",p.trim()&&`(filtered by "${p}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.Stack,{gap:"sm",children:b.map(j=>e.jsx(ve,{user:j,isSelected:g.includes(j.id),onToggle:B,onUpdateRole:S,onRemoveUser:w,roleOptions:c,variant:"suggested",onClick:()=>C(j)},j.id))})})]})]})})},io=({opened:n,onClose:r,options:o=[],onSave:s,onCancel:a,groups:i=[],styles:c})=>{const[d,l]=u.useState("");u.useEffect(()=>{n&&o.length>0?l(o[0].id):n||l("")},[n,o]);const f=()=>{s&&s(),r()},h=()=>{a&&a(),r()},g=()=>{r()},p=o.find(y=>y.id===d);return e.jsxs(t.Modal,{opened:n,onClose:g,size:"90%",centered:!0,closeOnClickOutside:!0,closeOnEscape:!0,withCloseButton:!1,p:"none",styles:{body:{...c==null?void 0:c.body,padding:0,height:"80vh"}},radius:"md",children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{style:{display:"flex",height:"100%",...c==null?void 0:c.body},children:[e.jsx(t.Box,{style:{width:"240px",backgroundColor:"var(--mantine-color-gray-0)"},children:e.jsx(t.ScrollArea,{h:"100%",children:e.jsx(t.Stack,{gap:0,p:"sm",children:i.map(y=>e.jsx(t.Box,{mb:"md",children:e.jsxs(u.Fragment,{children:[e.jsx(t.Text,{size:"xs",fw:600,c:"dimmed",m:4,children:y}),o.filter(x=>x.group===y).map(x=>e.jsx(Qe,{label:x.label,icon:x.icon,onClick:()=>l(x.id),isActive:d===x.id},x.id))]},y)}))})})}),e.jsxs(t.Box,{style:{flex:1,display:"flex",flexDirection:"column"},children:[p?e.jsxs(e.Fragment,{children:[e.jsx(t.Box,{p:"md",children:e.jsx(t.Group,{gap:"md",wrap:"nowrap",children:e.jsxs(t.Stack,{gap:4,children:[e.jsx(t.Text,{size:"md",fw:600,children:p.alternateLabel||p.label}),p.description&&e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",children:p.description})]})})}),e.jsx(t.ScrollArea,{style:{flex:1},children:e.jsx(t.Box,{px:"md",children:p.content})})]}):e.jsx(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:e.jsx(t.Text,{c:"var(--mantine-color-gray-6)",size:"lg",children:"Select an option from the sidebar"})}),(p==null?void 0:p.saveButton)&&e.jsx(t.Box,{p:"md",children:e.jsxs(t.Group,{justify:"flex-end",gap:"md",children:[e.jsx(t.Button,{variant:"subtle",onClick:h,color:"gray",children:"Cancel"}),e.jsx(t.Button,{onClick:f,color:"blue",children:"Save Changes"})]})})]})]})]})},co=(n,r="es")=>{const o=new Date,s=typeof n=="string"?new Date(n):n,a=Math.floor((o.getTime()-s.getTime())/1e3),i={es:{now:"ahora",seconds:"segundos",second:"segundo",minutes:"minutos",minute:"minuto",hours:"horas",hour:"hora",days:"días",day:"día",weeks:"semanas",week:"semana",months:"meses",month:"mes",years:"años",year:"año",ago:"hace"},en:{now:"now",seconds:"seconds",second:"second",minutes:"minutes",minute:"minute",hours:"hours",hour:"hour",days:"days",day:"day",weeks:"weeks",week:"week",months:"months",month:"month",years:"years",year:"year",ago:"ago"}},c=i[r]||i.en;if(a<5)return c.now;if(a<60)return r==="es"?`${c.ago} ${a} ${a===1?c.second:c.seconds}`:`${a} ${a===1?c.second:c.seconds} ${c.ago}`;const d=Math.floor(a/60);if(d<60)return r==="es"?`${c.ago} ${d} ${d===1?c.minute:c.minutes}`:`${d} ${d===1?c.minute:c.minutes} ${c.ago}`;const l=Math.floor(d/60);if(l<24)return r==="es"?`${c.ago} ${l} ${l===1?c.hour:c.hours}`:`${l} ${l===1?c.hour:c.hours} ${c.ago}`;const f=Math.floor(l/24);if(f<7)return r==="es"?`${c.ago} ${f} ${f===1?c.day:c.days}`:`${f} ${f===1?c.day:c.days} ${c.ago}`;const h=Math.floor(f/7);if(h<4)return r==="es"?`${c.ago} ${h} ${h===1?c.week:c.weeks}`:`${h} ${h===1?c.week:c.weeks} ${c.ago}`;const g=Math.floor(f/30);if(g<12)return r==="es"?`${c.ago} ${g} ${g===1?c.month:c.months}`:`${g} ${g===1?c.month:c.months} ${c.ago}`;const p=Math.floor(f/365);return r==="es"?`${c.ago} ${p} ${p===1?c.year:c.years}`:`${p} ${p===1?c.year:c.years} ${c.ago}`},lo=(n,r="es")=>{const o=typeof n=="string"?new Date(n):n,s={es:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],en:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},i=(s[r]||s.en)[o.getMonth()],c=o.getDate();return r==="es"?`${c} ${i}`:`${i} ${c}`},uo=n=>{const r=typeof n=="string"?new Date(n):n,o=new Date;return r.toDateString()===o.toDateString()},fo=n=>{const r=typeof n=="string"?new Date(n):n,o=new Date;return o.setDate(o.getDate()-1),r.toDateString()===o.toDateString()},ho=(n,r="es")=>uo(n)?r==="es"?"Hoy":"Today":fo(n)?r==="es"?"Ayer":"Yesterday":co(n,r),po=({notification:n,message:r,markAsRead:o,archiveNotification:s,children:a,actions:i})=>{var h,g,p,y,x;const c=new Date().getTime()-new Date(n.timestamp).getTime()<6048e5?ho(n.timestamp,"en"):lo(n.timestamp,"en"),[d,l]=u.useState(!1),f=e.jsxs(t.Group,{bg:"var(--mantine-color-gray-1)",p:4,style:{borderRadius:"var(--mantine-radius-md)"},w:"auto",wrap:"nowrap",gap:0,children:[!n.isRead&&e.jsx(ee,{onClick:()=>o(n.id),icon:k.IconCheck}),!n.isArchived&&e.jsx(ee,{onClick:()=>s(n.id),icon:k.IconArchive})]});return e.jsxs(t.Box,{p:"sm",bg:d?"var(--mantine-color-gray-0)":"white",style:{cursor:"pointer",borderTop:"1px solid var(--mantine-color-gray-2)"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[e.jsxs(t.Group,{justify:"space-between",align:"flex-start",gap:"sm",wrap:"nowrap",style:{margin:0},children:[(h=n.metadata)!=null&&h.avatar_url?e.jsx(t.Avatar,{name:(g=n.metadata)==null?void 0:g.fullname,size:"sm",radius:"md",src:(p=n.metadata)==null?void 0:p.avatar_url}):e.jsx(dn,{size:"xs",showText:!1,radius:"xs"}),e.jsxs(t.Stack,{gap:"xs",justify:"flex-start",w:"100%",children:[e.jsx(t.Box,{fz:"sm",m:0,style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis",minHeight:"unset",height:"auto",whiteSpace:"normal",wordBreak:"break-word"},children:r}),e.jsxs(t.Text,{size:"xs",c:"dimmed",fw:500,style:{whiteSpace:"nowrap"},children:[n.category?((y=n.category)==null?void 0:y.charAt(0).toUpperCase())+((x=n.category)==null?void 0:x.slice(1)):""," ","• ",c]})]}),d?f:!n.isRead&&e.jsx(t.Indicator,{color:"var(--mantine-color-blue-6)",size:10,position:"top-end"})]}),a,i&&e.jsx(t.Group,{justify:"flex-start",align:"flex-start",gap:"xs",wrap:"nowrap",pl:36,pt:8,children:i})]})},xo=(n,r,o,s,a)=>{const[i,c]=u.useState(!1),d=u.useRef(null),l=u.useRef(null),f=u.useRef(null);u.useEffect(()=>{c(n)},[n]);const h=u.useCallback(p=>{p[0].isIntersecting&&s&&!a&&o&&o()},[s,a,o]),g=u.useCallback(()=>{if(!(!d.current||!n||!r||!o)){l.current&&(l.current.disconnect(),l.current=null);try{const p=new IntersectionObserver(h,{threshold:.1,rootMargin:"50px"});p.observe(d.current),l.current=p}catch(p){console.error("Failed to setup intersection observer:",p)}}},[n,r,o,h]);return u.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),!n||!r||!o){l.current&&(l.current.disconnect(),l.current=null);return}if(!d.current){f.current=setTimeout(()=>g(),50);return}return g(),()=>{f.current&&(clearTimeout(f.current),f.current=null),l.current&&(l.current.disconnect(),l.current=null)}},[n,r,o,g]),u.useEffect(()=>()=>{f.current&&clearTimeout(f.current),l.current&&l.current.disconnect()},[]),{isActive:i,loadMoreRef:d}},mo=({notifications:n,isLoading:r=!1,isLoadingMore:o=!1,hasMore:s=!1,unreadCount:a=0,markAllAsRead:i,archiveAllNotifications:c,markAsRead:d,archiveNotification:l,loadMore:f,onFilterChange:h,currentFilter:g="all",customRenderer:p,opened:y=!1,onOpen:x=()=>{},onClose:m=()=>{},enableInfiniteScroll:I=!0})=>{const b=[{children:"Mark all as read",leftSection:e.jsx(k.IconChecklist,{size:16}),onClick:()=>i()},{children:"Archive all",leftSection:e.jsx(k.IconArchive,{size:16}),onClick:()=>c()}],v=[{children:"All",leftSection:e.jsx(k.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("all"),active:g==="all"},{children:"Unread",leftSection:e.jsx(k.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("unread"),active:g==="unread"},{children:"Archived",leftSection:e.jsx(k.IconArchive,{size:16}),onClick:()=>h==null?void 0:h("archived"),active:g==="archived"}],S=M=>p&&M.category&&["welcome","upgrade"].includes(M.category)?p(M,d,l):e.jsx(po,{notification:M,markAsRead:d,archiveNotification:l,message:M.message,actions:M.actions},M.id),{isActive:w,loadMoreRef:B}=xo(y,I,f||(()=>{}),s,o);return e.jsxs(e.Fragment,{children:[e.jsx(Qe,{isActive:w,icon:e.jsx(k.IconBell,{strokeWidth:2,size:20,color:"var(--mantine-color-gray-7)"}),onClick:()=>{y?m():x()},disabled:!1,variant:"subtle",color:"gray",fullWidth:!0,style:{borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},label:"Inbox",indicator:a>0?a>99?"99+":a:void 0}),e.jsxs(t.Drawer,{opened:y,onClose:m,position:"left",size:400,style:{position:"relative",left:300,zIndex:0,borderLeft:"1px solid var(--mantine-color-gray-2)"},withCloseButton:!1,padding:0,withOverlay:!0,closeOnClickOutside:!0,closeOnEscape:!0,overlayProps:{backgroundOpacity:0,blur:0},children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{p:0,h:"100%",style:{display:"flex",flexDirection:"column"},children:[e.jsx(t.Box,{style:{position:"sticky",top:0,zIndex:10,backgroundColor:"var(--mantine-color-white)"},children:e.jsxs(t.Group,{justify:"space-between",align:"center",gap:"xs",style:{borderRadius:"var(--mantine-radius-md)"},px:"sm",py:"md",children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Inbox"}),e.jsxs(t.Group,{gap:"xs",children:[e.jsx(ye,{position:"bottom-end",menuItems:v,trigger:e.jsx(ee,{icon:k.IconFilter})}),e.jsx(ye,{position:"bottom-end",menuItems:b,trigger:e.jsx(ee,{onClick:()=>{},icon:k.IconDots,changeIconOnHover:!0,iconHovered:k.IconDots})})]})]})}),e.jsxs(t.Box,{style:{flex:1,overflow:"auto"},children:[r&&n.length===0?e.jsx(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:e.jsx(t.Loader,{})}):n.length>0?e.jsx(t.Stack,{gap:0,children:n.map(M=>S(M))}):e.jsxs(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(k.IconInbox,{size:24,color:"var(--mantine-color-gray-6)"}),e.jsx(t.Text,{size:"sm",fw:500,c:"dimmed",ta:"center",mt:"sm",children:"No new updates"})]}),e.jsx(t.Box,{ref:B,style:{padding:"16px",display:I?"flex":"none",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:o&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]})}),o&&!I&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]}),!I&&s&&f&&e.jsx(t.Button,{color:"var(--mantine-color-gray-3)",variant:"subtle",onClick:f,loading:o,disabled:o,style:{alignSelf:"center"},children:o?"Loading...":"Load More"})]})]})]})]})},_e=({header:n,body:r,footer:o,withBorder:s=!0,position:a="left",bg:i="var(--mantine-color-gray-0)"})=>{const[c,d]=u.useState(!1),l=()=>{if(!s)return{};const f="var(--mantine-color-gray-3)",h="1px";return a==="left"?{borderRight:`${h} solid ${f}`}:a==="right"?{borderLeft:`${h} solid ${f}`}:{}};return e.jsxs(t.Stack,{gap:"sm",h:"100%",p:"sm",bg:i,style:l(),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[n&&e.jsx(t.Box,{children:typeof n=="function"?n({hovered:c}):n}),r&&e.jsx(t.Box,{style:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:typeof r=="function"?r({hovered:c}):r}),o&&e.jsx(t.Box,{children:typeof o=="function"?o({hovered:c}):o})]})},Mn=u.createContext(void 0),go=({children:n})=>{const[r,{open:o,close:s}]=Ie.useDisclosure(!1),a={openedNotificationSidebar:r,openNotificationSidebar:o,closeNotificationSidebar:s};return e.jsx(Mn.Provider,{value:a,children:n})},Io=()=>{const n=u.useContext(Mn);if(n===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return n},Tn=({workspace:n,currentUserId:r,currentWorkspaceId:o,onClick:s})=>{const a=o===n.id,i=r&&n.ownerId===r;return e.jsxs(t.Box,{onClick:s,style:{display:"flex",alignItems:"center",padding:"6px",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",gap:"8px",width:"100%",boxSizing:"border-box"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent"},children:[e.jsx(se,{size:"xs",avatar:typeof n.avatar=="string"?{type:"image",value:n.avatar}:n.avatar,placeholder:n.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:n.name}),e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0,paddingLeft:"8px"},children:[a&&e.jsx(k.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),i&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},yo="workspace-selector-module__menuItem___FSB6P",vo="workspace-selector-module__workspaceButton___-P6kp",jo="workspace-selector-module__workspaceText___YDAlj",bo="workspace-selector-module__scrollWrapper___MzrJY",Ge={menuItem:yo,workspaceButton:vo,workspaceText:jo,scrollWrapper:bo},wo=({workspaces:n=[],currentWorkspace:r,currentUserId:o,isLoading:s=!1,error:a=null,onWorkspaceSelect:i,onCreateWorkspace:c,emptyMessage:d="No workspaces found",loadingMessage:l="Loading workspaces...",errorMessage:f="Failed to load workspaces",className:h,onCloseSidebar:g,sidebarHovered:p=!1,children:y,menuItems:x})=>{const[m,I]=u.useState(!1),[b,v]=u.useState(""),S=u.useMemo(()=>b?n.filter(C=>{var j;return C.name.toLowerCase().includes(b.toLowerCase())||((j=C.ownerEmail)==null?void 0:j.toLowerCase().includes(b.toLowerCase()))}):n,[n,b]),w=C=>{i==null||i(C.id),I(!1),v("")};if(s)return e.jsxs(t.Group,{gap:"xs",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"dimmed",children:l})]});if(a)return e.jsx(t.Alert,{color:"red",title:"Error",children:f});const[B,M]=u.useState(p);return n.length===0&&!s&&!a?e.jsx(t.Box,{children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:d})}):e.jsxs(t.Menu,{opened:m,onOpen:()=>I(!0),onClose:()=>I(!1),position:"bottom-start",styles:{dropdown:{width:"350px",overflow:"hidden"}},withinPortal:!0,children:[e.jsx(t.Menu.Target,{children:e.jsx(t.Box,{w:"100%",onClick:()=>I(!m),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${Ge.workspaceButton} ${h||""}`,bg:B||m?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",style:{width:"100%",overflow:"hidden"},children:r?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:"xs",avatar:typeof r.avatar=="string"?{type:"image",value:r.avatar}:r.avatar,placeholder:r.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:r.name}),e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{flexShrink:0},children:[e.jsx(me,{icon:k.IconChevronDown,size:"md",onClick:()=>I(!m),grayScaleBaseColor:B||p?1:void 0}),(B||p)&&e.jsx(me,{icon:k.IconChevronsLeft,size:"md",onClick:()=>{g==null||g()},grayScaleBaseColor:B||p?1:0})]})]}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"Select workspace"})})})}),e.jsx(t.Menu.Dropdown,{style:{borderRadius:"var(--mantine-radius-md)"},p:0,children:e.jsxs(t.Stack,{gap:0,children:[y,e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),e.jsx(t.Stack,{gap:0,px:4,children:S.length===0?e.jsx(t.Menu.Item,{disabled:!0,children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:d})}):e.jsxs(e.Fragment,{children:[e.jsxs(t.Group,{justify:"space-between",align:"center",p:4,children:[e.jsx(t.Text,{size:"xs",c:"dimmed",fw:500,p:4,truncate:!0,children:"Workspaces"}),c&&e.jsx(t.Anchor,{onClick:()=>{c(),I(!1)},size:"xs",underline:"never",fw:500,p:4,truncate:!0,style:{display:"flex",alignItems:"center",gap:"4px"},children:"Add"})]}),e.jsx("div",{className:Ge.scrollWrapper,children:e.jsx(t.ScrollArea,{mah:150,scrollbarSize:6,scrollHideDelay:0,children:e.jsx(t.Stack,{gap:0,mb:6,children:S.map(C=>e.jsx(t.Box,{onClick:()=>w(C),className:Ge.menuItem,style:{padding:0,borderRadius:"var(--mantine-radius-md)",cursor:"pointer",overflow:"hidden"},onMouseEnter:j=>{j.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(Tn,{workspace:C,currentUserId:o,currentWorkspaceId:r==null?void 0:r.id,onClick:()=>w(C)})},C.id))})})})]})}),x&&e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),x&&e.jsx(t.Box,{p:4,children:x==null?void 0:x.map(C=>e.jsx(t.MenuItem,{onClick:C.onClick,leftSection:C.icon,children:C.label,color:C.color,"data-danger":C.color,fw:500,style:{height:"40px",borderRadius:"var(--mantine-radius-md)",padding:"6px"}},C.label))})]})})]})},Bn=({children:n,style:r,...o})=>e.jsx(t.Box,{style:{backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",minHeight:"20vh",width:"100%",flex:"1 1 0%",minWidth:0,maxWidth:"none",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",...r},...o,children:n});Bn.displayName="MatrixCenter";const On=({children:n,style:r,size:o="50px",state:s="empty",onStateChange:a,interactive:i=!0,...c})=>{const[d,l]=u.useState(s),[f,h]=u.useState(!1),g=a?s:i?d:s,p=()=>{if(!i)return;const m=["empty","outline","filled"],b=(m.indexOf(g)+1)%m.length,v=m[b];a?a(v):l(v)},y=()=>{switch(g){case"empty":return null;case"outline":return e.jsx(k.IconPoint,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});case"filled":return e.jsx(k.IconPointFilled,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});default:return null}},x=()=>{switch(g){case"empty":return"var(--mantine-color-gray-2)";case"outline":return"var(--mantine-color-blue-0)";case"filled":return"var(--mantine-color-green-0)";default:return"var(--mantine-color-gray-2)"}};return e.jsx(t.Box,{style:{width:o,height:o,backgroundColor:x(),borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center",cursor:i?"pointer":"default",transition:"all 0.2s ease",boxShadow:f&&i?"0 2px 8px rgba(0, 0, 0, 0.15)":"none",transform:f&&i?"translateY(-1px)":"translateY(0)",border:g==="outline"?"2px solid var(--mantine-color-gray-0)":"2px solid transparent",...r},onClick:p,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),...c,children:n||y()})};On.displayName="MatrixCell";const zn=({children:n,style:r,size:o="50px",blockId:s,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),p=u.useRef(null),y=u.useRef(!1),x=()=>{!s||!l||(g(!0),y.current=!1,p.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),p.current&&(clearTimeout(p.current),p.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!1),p.current&&(clearTimeout(p.current),p.current=null),y.current=!1};return e.jsx(t.Box,{style:{width:o,height:"100%",minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:x,onMouseUp:m,onMouseLeave:I,...f,children:n})};zn.displayName="MatrixBlockLeft";const Rn=({children:n,style:r,size:o="50px",blockId:s,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),p=u.useRef(null),y=u.useRef(!1),x=()=>{!s||!l||(g(!0),y.current=!1,p.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),p.current&&(clearTimeout(p.current),p.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!1),p.current&&(clearTimeout(p.current),p.current=null),y.current=!1};return e.jsx(t.Box,{style:{width:o,height:"100%",minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:x,onMouseUp:m,onMouseLeave:I,...f,children:n})};Rn.displayName="MatrixBlockRight";const Dn=({children:n,style:r,size:o="50px",blockId:s,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),p=u.useRef(null),y=u.useRef(!1),x=()=>{!s||!l||(g(!0),y.current=!1,p.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),p.current&&(clearTimeout(p.current),p.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!1),p.current&&(clearTimeout(p.current),p.current=null),y.current=!1};return e.jsx(t.Box,{style:{width:"100%",height:o,minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:x,onMouseUp:m,onMouseLeave:I,...f,children:n})};Dn.displayName="MatrixBlockUp";const En=({children:n,style:r,size:o="50px",blockId:s,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),p=u.useRef(null),y=u.useRef(!1),x=()=>{!s||!l||(g(!0),y.current=!1,p.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),p.current&&(clearTimeout(p.current),p.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!1),p.current&&(clearTimeout(p.current),p.current=null),y.current=!1};return e.jsx(t.Box,{style:{width:"100%",height:o,minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:x,onMouseUp:m,onMouseLeave:I,...f,children:n})};En.displayName="MatrixBlockDown";const An=({onLeftHover:n,onRightHover:r,onUpHover:o,onDownHover:s,showLeftControls:a=!1,showRightControls:i=!1,showUpControls:c=!1,showDownControls:d=!1})=>{const[l,f]=u.useState(!1),[h,g]=u.useState(!1),[p,y]=u.useState(!1),[x,m]=u.useState(!1),I=w=>{f(w),n==null||n(w)},b=w=>{g(w),r==null||r(w)},v=w=>{y(w),o==null||o(w)},S=w=>{m(w),s==null||s(w)};return e.jsxs(e.Fragment,{children:[a&&e.jsx(t.Box,{style:{position:"absolute",left:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)}),i&&e.jsx(t.Box,{style:{position:"absolute",right:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1)}),c&&e.jsx(t.Box,{style:{position:"absolute",top:0,left:0,right:0,height:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1)}),d&&e.jsx(t.Box,{style:{position:"absolute",bottom:0,left:0,right:0,height:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1)})]})};An.displayName="HoverZones";const Ln=({onLeftPrevious:n,onLeftNext:r,leftCurrentPage:o=1,leftTotalPages:s=1,leftDisabled:a=!1,leftVisible:i=!1,onLeftHover:c,onRightPrevious:d,onRightNext:l,rightCurrentPage:f=1,rightTotalPages:h=1,rightDisabled:g=!1,rightVisible:p=!1,onRightHover:y,onUpPrevious:x,onUpNext:m,upCurrentPage:I=1,upTotalPages:b=1,upDisabled:v=!1,upVisible:S=!1,onUpHover:w,onDownPrevious:B,onDownNext:M,downCurrentPage:C=1,downTotalPages:j=1,downDisabled:R=!1,downVisible:D=!1,onDownHover:O,onLeftAdd:E,onRightAdd:N,onUpAdd:H,onDownAdd:U,size:L="md",inline:F=!1})=>{const W=()=>s<=1||a?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:()=>n==null?void 0:n(),disabled:o<=1,color:"gray",radius:"md","aria-label":"Previous left blocks",children:e.jsx(k.IconChevronRight,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:E,color:"blue",radius:"md","aria-label":"Add left blocks",children:e.jsx(k.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:r,disabled:o>=s,color:"gray",radius:"md","aria-label":"Next left blocks",children:e.jsx(k.IconChevronLeft,{size:16,stroke:2})})]}),G=()=>h<=1||g?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:d,disabled:f<=1,color:"gray",radius:"md","aria-label":"Previous right blocks",children:e.jsx(k.IconChevronLeft,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:N,color:"blue",radius:"md","aria-label":"Add right blocks",children:e.jsx(k.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:l,disabled:f>=h,color:"gray",radius:"md","aria-label":"Next right blocks",children:e.jsx(k.IconChevronRight,{size:16,stroke:2})})]}),X=()=>b<=1||v?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:x,disabled:I<=1,color:"gray",radius:"md","aria-label":"Previous up blocks",children:e.jsx(k.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:H,color:"blue",radius:"md","aria-label":"Add up blocks",children:e.jsx(k.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:m,disabled:I>=b,color:"gray",radius:"md","aria-label":"Next up blocks",children:e.jsx(k.IconChevronUp,{size:16,stroke:2})})]}),_=()=>j<=1||R?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:B,disabled:C<=1,color:"gray",radius:"md","aria-label":"Previous down blocks",children:e.jsx(k.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:U,color:"blue",radius:"md","aria-label":"Add down blocks",children:e.jsx(k.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:M,disabled:C>=j,color:"gray",radius:"md","aria-label":"Next down blocks",children:e.jsx(k.IconChevronUp,{size:16,stroke:2})})]}),T=s>1&&!a,z=h>1&&!g,A=b>1&&!v,P=j>1&&!R;return!T&&!z&&!A&&!P?null:F?e.jsxs(e.Fragment,{children:[T&&i&&n&&r&&e.jsx("div",{onMouseEnter:()=>c==null?void 0:c(!0),onMouseLeave:()=>c==null?void 0:c(!1),children:W()}),z&&p&&d&&l&&e.jsx("div",{onMouseEnter:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:G()}),A&&S&&x&&m&&e.jsx("div",{onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:X()}),P&&D&&B&&M&&e.jsx("div",{onMouseEnter:()=>O==null?void 0:O(!0),onMouseLeave:()=>O==null?void 0:O(!1),children:_()})]}):e.jsxs(e.Fragment,{children:[T&&i&&n&&r&&e.jsx(t.Box,{style:{position:"absolute",left:"20px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto",opacity:i?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>c==null?void 0:c(!0),onMouseLeave:()=>c==null?void 0:c(!1),children:W()}),z&&p&&d&&l&&e.jsx(t.Box,{style:{position:"absolute",right:"20px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto",opacity:p?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:G()}),A&&S&&x&&m&&e.jsx(t.Box,{style:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:S?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:X()}),e.jsx(t.Box,{style:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:D?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>O==null?void 0:O(!0),onMouseLeave:()=>O==null?void 0:O(!1),children:P&&D&&B&&M&&_()})]})};Ln.displayName="NavigationControls";const ke=({direction:n,text:r,show:o,actions:s,currentPage:a,totalPages:i,disabled:c,hoverState:d,onHover:l})=>{if(!r)return null;const f={left:{position:"absolute",left:"20px",top:"50%",transform:"translateY(-50%)"},right:{position:"absolute",right:"20px",top:"50%",transform:"translateY(-50%)"},up:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)"},down:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)"}},h={left:{onLeftPrevious:s.prev,onLeftNext:s.next,leftCurrentPage:a,leftTotalPages:i,leftDisabled:c,leftVisible:!0},right:{onRightPrevious:s.prev,onRightNext:s.next,rightCurrentPage:a,rightTotalPages:i,rightDisabled:c,rightVisible:!0},up:{onUpPrevious:s.prev,onUpNext:s.next,upCurrentPage:a,upTotalPages:i,upDisabled:c,upVisible:!0},down:{onDownPrevious:s.prev,onDownNext:s.next,downCurrentPage:a,downTotalPages:i,downDisabled:c,downVisible:!0}};return e.jsxs("div",{style:{...f[n],zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",width:"80px",height:"60px"},children:[e.jsx("div",{style:{color:"var(--mantine-color-gray-6)",fontSize:"14px",fontWeight:"500",opacity:d?0:1,transition:"opacity 0.2s ease",position:"absolute"},children:r}),o&&e.jsx("div",{style:{opacity:d?1:0,transition:"opacity 0.2s ease",position:"absolute"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:e.jsx(Ln,{...h[n],size:"sm",showLabels:!0,inline:!0})})]})},So=n=>{const{totalBlocksLeft:r=0,totalBlocksRight:o=0,totalBlocksUp:s=0,totalBlocksDown:a=0,visibleBlocksLeft:i=1,visibleBlocksRight:c=1,visibleBlocksUp:d=1,visibleBlocksDown:l=1}=n,f=u.useMemo(()=>{const x=Math.max(1,Math.ceil(r/i)),m=Math.max(1,Math.ceil(o/c)),I=Math.max(1,Math.ceil(s/d)),b=Math.max(1,Math.ceil(a/l));return{leftTotalPages:x,rightTotalPages:m,upTotalPages:I,downTotalPages:b,leftStartIndex:0,leftEndIndex:0,rightStartIndex:0,rightEndIndex:0,upStartIndex:0,upEndIndex:0,downStartIndex:0,downEndIndex:0}},[r,o,s,a,i,c,d,l]),[h,g]=u.useState({leftStartIndex:0,rightStartIndex:0,upStartIndex:0,downStartIndex:0}),p=u.useMemo(()=>{const{leftTotalPages:x,rightTotalPages:m,upTotalPages:I,downTotalPages:b}=f,v=Math.min(h.leftStartIndex,Math.max(0,r-i)),S=Math.min(v+i,r),w=Math.min(h.rightStartIndex,Math.max(0,o-c)),B=Math.min(w+c,o),M=Math.min(h.upStartIndex,Math.max(0,s-d)),C=Math.min(M+d,s),j=Math.min(h.downStartIndex,Math.max(0,a-l)),R=Math.min(j+l,a);return{leftTotalPages:x,rightTotalPages:m,upTotalPages:I,downTotalPages:b,leftStartIndex:v,leftEndIndex:S,rightStartIndex:w,rightEndIndex:B,upStartIndex:M,upEndIndex:C,downStartIndex:j,downEndIndex:R}},[h,f,i,c,d,l,r,o,s,a]),y={goToLeftPage:u.useCallback(x=>{const m=Math.max(0,(x-1)*i);g(I=>({...I,leftStartIndex:Math.min(m,Math.max(0,r-i))}))},[i,r]),goToRightPage:u.useCallback(x=>{const m=Math.max(0,(x-1)*c);g(I=>({...I,rightStartIndex:Math.min(m,Math.max(0,o-c))}))},[c,o]),goToUpPage:u.useCallback(x=>{const m=Math.max(0,(x-1)*d);g(I=>({...I,upStartIndex:Math.min(m,Math.max(0,s-d))}))},[d,s]),goToDownPage:u.useCallback(x=>{const m=Math.max(0,(x-1)*l);g(I=>({...I,downStartIndex:Math.min(m,Math.max(0,a-l))}))},[l,a]),nextLeftPage:u.useCallback(()=>{g(x=>({...x,leftStartIndex:Math.min(x.leftStartIndex+1,Math.max(0,r-i))}))},[r,i]),previousLeftPage:u.useCallback(()=>{g(x=>({...x,leftStartIndex:Math.max(x.leftStartIndex-1,0)}))},[]),nextRightPage:u.useCallback(()=>{g(x=>({...x,rightStartIndex:Math.min(x.rightStartIndex+1,Math.max(0,o-c))}))},[o,c]),previousRightPage:u.useCallback(()=>{g(x=>({...x,rightStartIndex:Math.max(x.rightStartIndex-1,0)}))},[]),nextUpPage:u.useCallback(()=>{g(x=>({...x,upStartIndex:Math.min(x.upStartIndex+1,Math.max(0,s-d))}))},[s,d]),previousUpPage:u.useCallback(()=>{g(x=>({...x,upStartIndex:Math.max(x.upStartIndex-1,0)}))},[]),nextDownPage:u.useCallback(()=>{g(x=>({...x,downStartIndex:Math.min(x.downStartIndex+1,Math.max(0,a-l))}))},[a,l]),previousDownPage:u.useCallback(()=>{g(x=>({...x,downStartIndex:Math.max(x.downStartIndex-1,0)}))},[])};return[h,y,p]},ko=(n,r=0,o=0,s=0,a=0)=>{const[i,c]=u.useState({width:typeof window<"u"?window.innerWidth:1920,height:typeof window<"u"?window.innerHeight:1080});return u.useEffect(()=>{if(typeof window>"u")return;const l=()=>{c({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),u.useMemo(()=>{const{gap:l,cellSize:f,minBlocksPerSide:h=2,maxBlocksPerSide:g=15,minBlocksLeft:p=1,maxBlocksLeft:y=8,minBlocksRight:x=1,maxBlocksRight:m=8,minBlocksUp:I=1,maxBlocksUp:b=8,minBlocksDown:v=1,maxBlocksDown:S=8,responsiveCellSize:w=!1,minCellSize:B="30px",maxCellSize:M="80px"}=n,C=parseFloat(l.replace("px","")),j=parseFloat(f.replace("px","")),R=i.width-C*4,D=i.height-C*4,O=j+C,E=Math.floor(R/(2*O)),N=j+C,H=Math.floor(D/N)+2,U=Math.min(E,H),L=Math.max(h,Math.min(g,U)),F=Math.max(p,Math.min(y,Math.floor(U/2))),W=Math.max(x,Math.min(m,Math.floor(U/2)));let G=f;if(w){const A=parseFloat(B.replace("px","")),P=parseFloat(M.replace("px","")),V=Math.min(R/(i.width*.8),D/(i.height*.8));G=`${Math.max(A,Math.min(P,j*V))}px`}const X=Math.min(i.width/1920,i.height/1080);let _,T;if(s>0&&a>0){const A=Math.max(s,a);_=Math.max(I,Math.min(b,A)),T=_}else{const A=Math.max(I,v),P=Math.min(b,S),V=Math.max(A,Math.min(P,Math.ceil(A+(P-A)*X)));_=V,T=V}if(_+T+1>H){const A=Math.max(2,H-1);if(Math.max(I,v)*2>A){const V=Math.max(1,Math.floor(A/2));_=V,T=V}else{const V=Math.max(I,v);_=V,T=V}}return console.log("Responsive Matrix Debug:",{windowSize:i,screenSizeRatio:X,minBlocksUp:I,minBlocksDown:v,maxBlocksUp:b,maxBlocksDown:S,blocksUp:s,blocksDown:a,calculatedBlocksUp:_,calculatedBlocksDown:T,totalVerticalBlocks:_+T+1,isSymmetric:_===T,availableHeight:D,maxBlocksVertical:H}),{blocksPerSide:L,blocksLeft:F,blocksRight:W,cellSize:G,blocksUp:_,blocksDown:T}},[i,n,r,o,s,a])},Co=({gap:n,cellSize:r,blocksLeft:o,blocksRight:s,blocksUp:a,blocksDown:i,totalBlocksLeft:c,totalBlocksRight:d,totalBlocksUp:l,totalBlocksDown:f,responsive:h,minBlocksPerSide:g,maxBlocksPerSide:p,minBlocksLeft:y,maxBlocksLeft:x,minBlocksRight:m,maxBlocksRight:I,minBlocksUp:b,maxBlocksUp:v,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:B,minCellSize:M,maxCellSize:C})=>{const j=u.useMemo(()=>c!==void 0||d!==void 0||l!==void 0||f!==void 0,[c,d,l,f]),R=ko({gap:n,cellSize:r,minBlocksPerSide:g,maxBlocksPerSide:p,minBlocksLeft:y,maxBlocksLeft:x,minBlocksRight:m,maxBlocksRight:I,minBlocksUp:b,maxBlocksUp:v,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:B,minCellSize:M,maxCellSize:C},o??0,s??0,a,i),D=u.useMemo(()=>{let H=h?R.blocksLeft:o??0,U=h?R.blocksRight:s??0,L=h?R.blocksUp:a??0,F=h?R.blocksDown:i??0;if(!h){const W=parseFloat(n.replace("px","")),G=parseFloat(r.replace("px","")),X=typeof window<"u"?window.innerWidth-W*4:1920,_=typeof window<"u"?window.innerHeight-W*4:1080,T=G+W,z=Math.floor(X/(2*T)),A=Math.floor(_/(2*T));H=Math.min(H,z),U=Math.min(U,z),L=Math.min(L,A),F=Math.min(F,A)}return{left:H,right:U,up:L,down:F}},[h,R,o,s,a,i,n,r]),O=u.useMemo(()=>{const H=j&&c?Math.min(D.left,c):D.left,U=j&&d?Math.min(D.right,d):D.right,L=j&&l?Math.min(D.up,l):D.up,F=j&&f?Math.min(D.down,f):D.down;return{left:H,right:U,up:L,down:F}},[j,D,c,d,l,f]),E=h?R.cellSize:r,N=u.useMemo(()=>{const H=(O.left>0?O.left:0)+1+(O.right>0?O.right:0),U=O.up>0||O.down>0?O.up+1+O.down:1,L=`${E} `.repeat(O.left)+"1fr "+`${E} `.repeat(O.right),F=O.up>0||O.down>0?`${E} `.repeat(O.up)+"1fr "+`${E} `.repeat(O.down):"1fr";return{totalColumns:H,totalRows:U,gridTemplateColumns:L.trim(),gridTemplateRows:F.trim()}},[O,E]);return{usePagination:j,visibleBlocks:D,finalBlocks:O,finalCellSize:E,gridDimensions:N}},Mo=({blockItems:n})=>{const r=u.useMemo(()=>n.reduce((a,i)=>(a[i.id]=i,a),{}),[n]);return{getBlockContent:(a,i)=>{const c=`${a}-${i}`,d=r[c];return d?d.content:u.createElement("div",{style:{padding:"4px",textAlign:"center",fontSize:"10px",writingMode:a==="left"||a==="right"?"vertical-rl":"horizontal-tb",textOrientation:"mixed",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"}})},getIntersectionText:(a,i,c,d)=>{const l=[];if(a!==null){const f=r[`left-${a}`];l.push(f?`left-${a}`:`left${a+1}`)}if(i!==null){const f=r[`right-${i}`];l.push(f?`right-${i}`:`right${i+1}`)}if(c!==null){const f=r[`up-${c}`];l.push(f?`up-${c}`:`up${c+1}`)}if(d!==null){const f=r[`down-${d}`];l.push(f?`down-${d}`:`down${d+1}`)}return l.join(", ")}}},To=({blockConnections:n})=>{const r=u.useMemo(()=>{const s=new Map;return n.forEach(a=>{const i=`${a.source}-${a.target}`,c=`${a.target}-${a.source}`;s.set(i,a),s.set(c,a)}),s},[n]);return{getConnectionStateFromText:s=>{const a=s.split(", ").map(i=>i.trim());for(let i=0;i<a.length;i++)for(let c=i+1;c<a.length;c++){const d=a[i],l=a[c],f=`${d}-${l}`,h=r.get(f);if(h)return h.type}return"empty"}}},Bo=({usePagination:n,totalBlocksLeft:r,totalBlocksRight:o,totalBlocksUp:s,totalBlocksDown:a,paginationActions:i,paginationState:c,paginationInfo:d})=>{const[l,f]=u.useState({left:!1,right:!1,up:!1,down:!1}),h=(p,y)=>{f(x=>({...x,[p]:y}))};return{hoverStates:l,handleHover:h,getNavigationControlProps:p=>{const y={left:r,right:o,up:s,down:a}[p],x={left:{prev:i.previousLeftPage,next:i.nextLeftPage},right:{prev:i.previousRightPage,next:i.nextRightPage},up:{prev:i.previousUpPage,next:i.nextUpPage},down:{prev:i.previousDownPage,next:i.nextDownPage}}[p],m={left:c.leftStartIndex,right:c.rightStartIndex,up:c.upStartIndex,down:c.downStartIndex}[p],I={left:d.leftTotalPages,right:d.rightTotalPages,up:d.upTotalPages,down:d.downTotalPages}[p];return{show:n&&!!y,totalBlocks:y,actions:x,currentPage:m+1,totalPages:I,disabled:!y,hoverState:l[p],onHover:b=>h(p,b)}}}},Oo=({blockItems:n,blockConnections:r})=>{const[o,s]=u.useState(null),[a,i]=u.useState(!1),c=u.useMemo(()=>{const m=new Map;return r.forEach(I=>{const b=`${I.source}-${I.target}`,v=`${I.target}-${I.source}`;m.set(b,I),m.set(v,I)}),m},[r]),d=u.useCallback(m=>{const I=[];return n.forEach(b=>{if(b.id!==m){const v=`${m}-${b.id}`;c.has(v)&&I.push(b.id)}}),I},[n,c]),l=u.useCallback(m=>{const I=n.find(S=>S.id===m);if(!I)return[];const b=d(m),v=[m];switch(I.type){case"up":b.forEach(S=>{const w=n.find(B=>B.id===S);w&&(w.type==="left"||w.type==="right")&&(v.push(S),d(S).forEach(M=>{const C=n.find(j=>j.id===M);C&&C.type==="down"&&v.push(M)}))});break;case"down":b.forEach(S=>{const w=n.find(B=>B.id===S);w&&(w.type==="left"||w.type==="right")&&(v.push(S),d(S).forEach(M=>{const C=n.find(j=>j.id===M);C&&C.type==="up"&&v.push(M)}))});break;case"left":b.forEach(S=>{const w=n.find(B=>B.id===S);w&&(w.type==="up"||w.type==="down")&&(v.push(S),d(S).forEach(M=>{const C=n.find(j=>j.id===M);C&&C.type==="right"&&v.push(M)}))});break;case"right":b.forEach(S=>{const w=n.find(B=>B.id===S);w&&(w.type==="up"||w.type==="down")&&(v.push(S),d(S).forEach(M=>{const C=n.find(j=>j.id===M);C&&C.type==="left"&&v.push(M)}))});break}return[...new Set(v)]},[n,d]),f=u.useCallback(m=>!0,[]),h=u.useCallback(m=>!a||!o?!1:!l(o).includes(m),[a,o,l]),g=u.useCallback(m=>!a||!o?!1:l(o).includes(m),[a,o,l]),p=u.useCallback(m=>{a&&o===m?(i(!1),s(null)):(s(m),i(!0))},[a,o]),y=u.useCallback(m=>{console.log(`Block clicked: ${m}`)},[]),x=u.useCallback(()=>{i(!1),s(null)},[]);return{selectedBlockId:o,isFiltering:a,isBlockVisible:f,isBlockDimmed:h,shouldShowBlueBorder:g,handleBlockPress:p,handleBlockClick:y,clearFiltering:x,getFilteredBlockIds:l}},nn=n=>parseInt(n.replace(/[^\d]/g,""),10)||0,zo=(n,r)=>{const[o,s]=u.useState({width:0,height:0}),a=u.useCallback(()=>{const{width:i,height:c}=o;if(i===0||c===0)return{blocksUp:r.minVerticalBlocks/2,blocksDown:r.minVerticalBlocks/2,blocksLeft:r.minHorizontalBlocks/2,blocksRight:r.minHorizontalBlocks/2,containerWidth:i,containerHeight:c};const d=nn(r.cellSize),l=nn(r.gap),f=d+l,h=i-l*2,g=c-l*2,p=Math.floor(g*r.verticalMaxPercent/100/f),y=Math.floor(h*r.horizontalMaxPercent/100/f),x=Math.floor(g*r.verticalMinPercent/100/f),m=Math.floor(h*r.horizontalMinPercent/100/f),I=Math.max(r.minVerticalBlocks,x),b=Math.max(r.minHorizontalBlocks,m),v=Math.max(I,p),S=Math.max(b,y),w=Math.floor(v/2),B=Math.floor(v/2),M=Math.floor(S/2),C=Math.floor(S/2);return{blocksUp:w,blocksDown:B,blocksLeft:M,blocksRight:C,containerWidth:i,containerHeight:c}},[o,r]);return u.useEffect(()=>{const i=()=>{if(n.current){const d=n.current.getBoundingClientRect();s({width:d.width,height:d.height})}};i();const c=new ResizeObserver(i);return n.current&&c.observe(n.current),()=>{c.disconnect()}},[n]),a()},Ro={verticalMinPercent:20,verticalMaxPercent:50,horizontalMinPercent:30,horizontalMaxPercent:50,minVerticalBlocks:2,minHorizontalBlocks:4,cellSize:"50px",gap:"8px"},Fn=({children:n,style:r,gap:o="8px",cellSize:s="50px",verticalBlocks:a,horizontalBlocks:i,responsiveConfig:c,enableResponsive:d=!1,blocksLeft:l,blocksRight:f,blocksUp:h=0,blocksDown:g=0,blockItems:p=[],blockConnections:y=[],enableFiltering:x=!1,onBlockClick:m,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:S,usePagination:w=!1,responsive:B=!1,minBlocksPerSide:M=2,maxBlocksPerSide:C=15,minBlocksHorizontal:j=2,maxBlocksHorizontal:R=16,minBlocksVertical:D=2,maxBlocksVertical:O=16,minBlocksLeft:E=1,maxBlocksLeft:N=8,minBlocksRight:H=1,maxBlocksRight:U=8,minBlocksUp:L=1,maxBlocksUp:F=8,minBlocksDown:W=1,maxBlocksDown:G=8,responsiveCellSize:X=!1,minCellSize:_="30px",maxCellSize:T="80px",directionTexts:z,...A})=>{const P=u.useRef(null),V=zo(P,{...Ro,cellSize:s,gap:o,...c});let ne=l,$=f,oe=h,Z=g;d?(ne=Math.floor(V.blocksLeft),$=Math.floor(V.blocksRight),oe=Math.floor(V.blocksUp),Z=Math.floor(V.blocksDown)):(a!==void 0||i!==void 0)&&(a!==void 0&&(oe=Math.floor(a/2),Z=Math.floor(a/2)),i!==void 0&&(ne=Math.floor(i/2),$=Math.floor(i/2)));const de=E!==1?E:Math.floor(j/2),Ee=N!==8?N:Math.floor(R/2),Ae=H!==1?H:Math.ceil(j/2),re=U!==8?U:Math.ceil(R/2),xe=L!==1?L:Math.floor(D/2),je=F!==8?F:Math.floor(O/2),Vn=W!==1?W:Math.ceil(D/2),_n=G!==8?G:Math.ceil(O/2),{usePagination:Qn,finalBlocks:Q,finalCellSize:ae,gridDimensions:be}=Co({gap:o,cellSize:s,blocksLeft:ne,blocksRight:$,blocksUp:oe,blocksDown:Z,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:S,responsive:B,minBlocksPerSide:M,maxBlocksPerSide:C,minBlocksLeft:de,maxBlocksLeft:Ee,minBlocksRight:Ae,maxBlocksRight:re,minBlocksUp:xe,maxBlocksUp:je,minBlocksDown:Vn,maxBlocksDown:_n,responsiveCellSize:X,minCellSize:_,maxCellSize:T}),{getBlockContent:we,getIntersectionText:Yn}=Mo({blockItems:p}),{getConnectionStateFromText:qn}=To({blockConnections:y}),Y=Oo({blockItems:p,blockConnections:y});u.useEffect(()=>{if(!x)return;const Le=K=>{K.key==="Escape"&&Y.clearFiltering()};return window.addEventListener("keydown",Le),()=>window.removeEventListener("keydown",Le)},[x,Y]);const[ie,Zn,Xn]=So({totalBlocksLeft:I??0,totalBlocksRight:b??0,totalBlocksUp:v??0,totalBlocksDown:S??0,visibleBlocksLeft:Q.left,visibleBlocksRight:Q.right,visibleBlocksUp:Q.up,visibleBlocksDown:Q.down}),{getNavigationControlProps:ue}=Bo({usePagination:Qn,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:S,paginationActions:Zn,paginationState:ie,paginationInfo:Xn});return e.jsxs(t.Box,{ref:P,style:{display:"grid",gridTemplateColumns:be.gridTemplateColumns,gridTemplateRows:be.gridTemplateRows,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",padding:o,boxSizing:"border-box",gap:o,overflow:"hidden",...r},...A,children:[Array.from({length:be.totalRows},(Le,K)=>Array.from({length:be.totalColumns},(er,te)=>{const Fe=Q.up>0?K===Q.up:K===0,Pe=te===Q.left;if(Fe&&Pe)return e.jsxs(Bn,{style:{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",position:"relative"},children:[n,e.jsx(ke,{direction:"left",text:z==null?void 0:z.left,...ue("left")}),e.jsx(ke,{direction:"right",text:z==null?void 0:z.right,...ue("right")}),e.jsx(ke,{direction:"up",text:z==null?void 0:z.up,...ue("up")}),e.jsx(ke,{direction:"down",text:z==null?void 0:z.down,...ue("down")}),w&&e.jsx(An,{showLeftControls:!!I,showRightControls:!!b,showUpControls:!!v,showDownControls:!!S,onLeftHover:q=>ue("left").onHover(q),onRightHover:q=>ue("right").onHover(q),onUpHover:q=>ue("up").onHover(q),onDownHover:q=>ue("down").onHover(q)})]},`center-${K}-${te}`);if(Fe&&te<Q.left){const q=w&&I?ie.leftStartIndex+te:te,J=`left-${q}`;return e.jsx(zn,{size:ae,blockId:x?J:void 0,isVisible:x?Y.isBlockVisible(J):!0,isDimmed:x?Y.isBlockDimmed(J):!1,shouldShowBlueBorder:x?Y.shouldShowBlueBorder(J):!1,onBlockClick:x?Y.handleBlockClick:m,onBlockPress:x?Y.handleBlockPress:void 0,children:we("left",q)},`left-${te}`)}if(Fe&&te>Q.left){const q=te-Q.left-1,J=w&&b?ie.rightStartIndex+(Q.right-1-q):Q.right-1-q,ce=`right-${J}`;return e.jsx(Rn,{size:ae,blockId:x?ce:void 0,isVisible:x?Y.isBlockVisible(ce):!0,isDimmed:x?Y.isBlockDimmed(ce):!1,shouldShowBlueBorder:x?Y.shouldShowBlueBorder(ce):!1,onBlockClick:x?Y.handleBlockClick:m,onBlockPress:x?Y.handleBlockPress:void 0,children:we("right",J)},`right-${q}`)}if(Pe&&K<Q.up){const q=w&&v?ie.upStartIndex+K:K,J=`up-${q}`;return e.jsx(Dn,{size:ae,blockId:x?J:void 0,isVisible:x?Y.isBlockVisible(J):!0,isDimmed:x?Y.isBlockDimmed(J):!1,shouldShowBlueBorder:x?Y.shouldShowBlueBorder(J):!1,onBlockClick:x?Y.handleBlockClick:m,onBlockPress:x?Y.handleBlockPress:void 0,children:we("up",q)},`up-${K}`)}if(Pe&&K>Q.up){const q=K-Q.up-1,J=w&&S?ie.downStartIndex+q:q,ce=`down-${J}`;return e.jsx(En,{size:ae,blockId:x?ce:void 0,isVisible:x?Y.isBlockVisible(ce):!0,isDimmed:x?Y.isBlockDimmed(ce):!1,shouldShowBlueBorder:x?Y.shouldShowBlueBorder(ce):!1,onBlockClick:x?Y.handleBlockClick:m,onBlockPress:x?Y.handleBlockPress:void 0,children:we("down",J)},`down-${q}`)}const Ue=te<Q.left?te:null,Se=te>Q.left?te-Q.left-1:null,Ne=K<Q.up?K:null,We=K>Q.up?K-Q.up-1:null,Kn=w&&I&&Ue!==null?ie.leftStartIndex+Ue:Ue,Jn=w&&b&&Se!==null?ie.rightStartIndex+(Q.right-1-Se):Se!==null?Q.right-1-Se:null,et=w&&v&&Ne!==null?ie.upStartIndex+Ne:Ne,nt=w&&S&&We!==null?ie.downStartIndex+We:We,$e=Yn(Kn,Jn,et,nt);if($e&&$e.length>0){const q=qn($e);return e.jsx(On,{size:ae,state:q,interactive:!1},`intersection-${K}-${te}`)}return e.jsx("div",{style:{width:ae,height:ae,minWidth:ae,minHeight:ae}},`empty-${K}-${te}`)})).flat(),x&&Y.isFiltering&&e.jsx(t.Box,{style:{position:"fixed",top:12,right:12,background:"rgba(255, 255, 255, 0.9)",color:"var(--mantine-color-dark-7)",padding:"8px 12px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.12)",fontSize:12,fontWeight:600,pointerEvents:"none",zIndex:1e3},children:"Press Esc to clear filter"})]})};Fn.displayName="Matrix";const fe=({editable:n=!1,children:r,label:o,icon:s,value:a,className:i,style:c,...d})=>{const l={className:i,style:c};return Ie.useMediaQuery("(max-width: 550px)",!1,{getInitialValueInEffect:!0})?e.jsxs(t.Stack,{gap:0,w:"100%",...l,children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:8},h:"auto",children:[s&&e.jsx(s,{size:20,style:{flexShrink:0},color:"var(--mantine-color-gray-6)",strokeWidth:2}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.6",children:o})]}),e.jsx(t.Box,{style:{display:"flex",alignItems:"flex-start"},w:"100%",children:n&&r?r:a})]}):e.jsxs(t.Group,{align:"flex-start",gap:0,w:"100%",...d,...l,children:[e.jsxs(t.Box,{w:"30%",style:{display:"flex",alignItems:"center",gap:8},h:"40px",children:[s&&e.jsx(s,{size:20,style:{flexShrink:0},color:"var(--mantine-color-gray-6)",strokeWidth:2}),e.jsx(t.Text,{size:"sm",fw:500,truncate:!0,c:"gray.6",children:o})]}),e.jsx(t.Box,{w:"70%",style:{display:"flex",alignItems:"flex-start"},mih:40,children:n&&r?r:a})]})},Do=({label:n,icon:r,value:o,onChange:s,editable:a=!1,placeholder:i,disabled:c=!1})=>a&&s?e.jsx(fe,{label:n,icon:r,value:e.jsx(Oe,{value:o,onChange:s,placeholder:i,disabled:c,size:"sm"})}):e.jsx(fe,{label:n,icon:r,value:e.jsx(t.Text,{size:"sm",c:o?void 0:"dimmed",fw:500,truncate:!0,children:o||i||"—"})}),Eo=({label:n,icon:r,href:o,text:s,target:a="_blank"})=>{const i=s||o;return e.jsx(fe,{label:n,icon:r,value:e.jsx(t.Anchor,{href:o,target:a,size:"sm",underline:"hover",children:i})})},Ao=({label:n,icon:r,value:o,onChange:s,editable:a=!1,format:i,placeholder:c})=>{const d=o??null,l=d!==null&&i?i(d):d!==null?d.toString():null,f=h=>{if(!s)return;const g=h.trim();if(g===""){s(null);return}const p=Number(g);isNaN(p)||s(p)};return a&&s?e.jsx(fe,{label:n,icon:r,value:e.jsx(Oe,{value:l||"",onChange:f,placeholder:c||"Enter number",size:"sm"})}):e.jsx(fe,{label:n,icon:r,value:e.jsx(t.Text,{size:"sm",c:d!==null?void 0:"dimmed",children:l||c||"—"})})},Lo=300,Fo=({users:n,onSearch:r,debounceSearch:o=!0,debounceDelay:s=Lo})=>{const[a,i]=u.useState(""),[c,d]=u.useState(n),[l,f]=u.useState(!1),h=u.useRef(null);return u.useEffect(()=>{if(!r){d(n);return}if(h.current&&clearTimeout(h.current),a.trim()){const g=async()=>{f(!0);try{const p=await r(a);d(p)}catch(p){console.error("Search error:",p)}finally{f(!1)}};o?h.current=setTimeout(g,s):g()}else d(n),f(!1);return()=>{h.current&&clearTimeout(h.current)}},[a,r,o,s,n]),u.useEffect(()=>{(!a.trim()||!r)&&d(n)},[n,a,r]),{searchQuery:a,setSearchQuery:i,displayedUsers:c,setDisplayedUsers:d,isSearching:l}},Po=({value:n,multiple:r,users:o,displayedUsers:s,searchQuery:a,onSearch:i})=>{const c=u.useMemo(()=>r?Array.isArray(n)?n:[]:n?[n]:[],[n,r]),d=u.useMemo(()=>o.filter(h=>c.includes(h.id)),[o,c]),l=u.useMemo(()=>{if(!a.trim()||i)return s;const h=a.toLowerCase();return s.filter(g=>g.name.toLowerCase().includes(h)||g.email.toLowerCase().includes(h))},[s,a,i]),f=u.useMemo(()=>{const h=l.filter(y=>c.includes(y.id)),g=l.filter(y=>!c.includes(y.id)),p=d.filter(y=>!l.some(x=>x.id===y.id));return[...h,...p,...g]},[l,c,d]);return{selectedIds:c,selectedUsers:d,sortedUsers:f}},Uo=({isFocused:n,dropdownRef:r})=>{const[o,s]=u.useState("bottom"),a=u.useCallback(i=>{if(r.current=i,i){const c=i.dataset.position;c==="top"||c==="bottom"?s(c):requestAnimationFrame(()=>{if(i.dataset.position){const d=i.dataset.position;(d==="top"||d==="bottom")&&s(d)}})}},[r]);return u.useLayoutEffect(()=>{if(!n||!r.current)return;const i=()=>{if(r.current){const l=r.current.dataset.position;(l==="top"||l==="bottom")&&s(l)}};i();const c=requestAnimationFrame(i),d=new MutationObserver(()=>{i()});return r.current&&d.observe(r.current,{attributes:!0,attributeFilter:["data-position"]}),()=>{cancelAnimationFrame(c),d.disconnect()}},[n,r]),{placement:o,dropdownRefCallback:a}},No=({onLoadMore:n,hasMore:r,loading:o,setDisplayedUsers:s})=>{const a=u.useRef(null);return u.useEffect(()=>{if(!n||!r||o)return;const i=new IntersectionObserver(c=>{c[0].isIntersecting&&r&&!o&&n().then(d=>{s(l=>[...l,...d])})},{threshold:.1});return a.current&&i.observe(a.current),()=>{i.disconnect()}},[n,r,o,s]),{loadMoreRef:a}},Wo=({combobox:n,dropdownRef:r})=>{const[o,s]=u.useState(!1),[a,i]=u.useState(!1),c=u.useCallback(()=>{s(!0),n.openDropdown()},[n]),d=u.useCallback(h=>{setTimeout(()=>{const g=h==null?void 0:h.relatedTarget;g&&r.current&&r.current.contains(g)||n.dropdownOpened||s(!1)},0)},[n,r]),l=u.useCallback(()=>{i(!0)},[]),f=u.useCallback(()=>{i(!1)},[]);return{isFocused:o,setIsFocused:s,isHovered:a,handleFocus:c,handleBlur:d,handleMouseEnter:l,handleMouseLeave:f}},$o=({multiple:n,value:r,onChange:o,combobox:s})=>{const a=u.useCallback(c=>{if(n){const d=Array.isArray(r)?r:[],l=d.includes(c)?d.filter(f=>f!==c):[...d,c];o==null||o(l)}else o==null||o(c),s.closeDropdown()},[n,r,o,s]),i=u.useCallback(c=>{if(n){const d=Array.isArray(r)?r:[];o==null||o(d.filter(l=>l!==c))}else o==null||o("")},[n,r,o]);return{handleSelect:a,handleRemove:i}},Ho="40px",Go=300,pe=({editable:n=!1,label:r,icon:o,value:s,users:a=[],onChange:i,placeholder:c="Select users",multiple:d=!1,disabled:l=!1,onSearch:f,debounceSearch:h=!0,debounceDelay:g=Go,onLoadMore:p,hasMore:y=!1,loading:x=!1})=>{const m=u.useRef(null),I=u.useRef(null),b=u.useRef(null),{searchQuery:v,setSearchQuery:S,displayedUsers:w,setDisplayedUsers:B,isSearching:M}=Fo({users:a,onSearch:f,debounceSearch:h,debounceDelay:g}),C=t.useCombobox({onDropdownClose:()=>{C.resetSelectedOption(),S(""),R(!1)},onDropdownOpen:()=>{C.updateSelectedOptionIndex("active"),R(!0)}}),{isFocused:j,setIsFocused:R,isHovered:D,handleFocus:O,handleBlur:E,handleMouseEnter:N,handleMouseLeave:H}=Wo({combobox:C,dropdownRef:b}),{placement:U,dropdownRefCallback:L}=Uo({isFocused:j,dropdownRef:b}),{selectedIds:F,selectedUsers:W,sortedUsers:G}=Po({value:s,multiple:d,users:a,displayedUsers:w,searchQuery:v,onSearch:f}),{loadMoreRef:X}=No({onLoadMore:p,hasMore:y,loading:x,setDisplayedUsers:B}),{handleSelect:_,handleRemove:T}=$o({multiple:d,value:s,onChange:i,combobox:C}),z=()=>{if(!d)return null;const $=5,oe=W.slice(0,$),Z=W.length-$;return e.jsxs(t.Group,{gap:"xs",children:[oe.map(de=>e.jsx(Ce,{avatar:de.avatar,name:de.name,withRemoveButton:j,onRemove:()=>T(de.id)},de.id)),Z>0&&e.jsx(t.Pill,{ml:"xs",radius:"md",size:"md",bg:"transparent",children:e.jsxs(t.Group,{gap:"2px",wrap:"nowrap",style:{alignItems:"center",display:"flex"},h:"24px",children:[e.jsx(k.IconPlus,{size:16,style:{color:"var(--mantine-color-blue-5)"}}),e.jsxs(t.Text,{size:"sm",fw:400,c:"var(--mantine-color-blue-5)",children:[Z," more"]})]})})]})},A=()=>{if(d)return null;const $=W[0];return $?e.jsx(Ce,{avatar:$.avatar,name:$.name}):null},P=()=>j?"var(--mantine-color-gray-2)":"var(--mantine-color-gray-0)",V=()=>({input:{position:j?"absolute":"relative",zIndex:j?1e3:1,fontWeight:"400",color:"var(--mantine-color-gray-9)",cursor:l?"not-allowed":"pointer",backgroundColor:j||D?"var(--mantine-color-gray-0)":"transparent",border:j?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:j&&U==="bottom"?"var(--mantine-radius-md) var(--mantine-radius-md) 0 0":j&&U==="top"?"0 0 var(--mantine-radius-md) var(--mantine-radius-md)":"var(--mantine-radius-md)",paddingY:"6px",display:"flex",alignItems:"center",padding:"6px 14px",minHeight:"40px",flexWrap:d?"wrap":"nowrap",boxShadow:j&&U==="bottom"?"0 -4px 10px 0 rgba(0, 0, 0, 0.1)":j&&U==="top"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"none"}}),ne={group:{alignItems:"center",gap:"4px",minHeight:"0",lineHeight:"normal"}};return e.jsx(fe,{editable:n,label:r,icon:o,value:e.jsx(t.Group,{gap:"sm",wrap:"nowrap",style:{alignItems:"center"},w:"100%",h:40,p:"14px",children:W.map($=>e.jsx(Ce,{avatar:$.avatar,name:$.name,withRemoveButton:j,onRemove:()=>T($.id)},$.id))}),children:e.jsxs(t.Combobox,{store:C,onOptionSubmit:_,withinPortal:!1,offset:-2,children:[e.jsx(t.Combobox.DropdownTarget,{children:e.jsx(t.PillsInput,{onClick:()=>!l&&C.openDropdown(),radius:"md",disabled:l,styles:V,onFocus:O,onBlur:E,onMouseEnter:()=>!l&&N(),onMouseLeave:H,w:"100%",children:e.jsxs(t.Pill.Group,{styles:ne,children:[d?z():A(),e.jsx(t.Combobox.EventsTarget,{children:e.jsx(t.PillsInput.Field,{ref:m,onFocus:O,onBlur:E,placeholder:W.length===0||j||v.length>0?c:"",value:v,onChange:$=>{C.updateSelectedOptionIndex(),S($.currentTarget.value)},onMouseDown:$=>{$.stopPropagation()},onKeyDown:$=>{$.key==="Backspace"&&v.length===0&&($.preventDefault(),d&&W.length>0?T(W[W.length-1].id):!d&&W.length>0&&T(W[0].id))},pointer:!0,disabled:l,styles:{field:{minWidth:j||v.length>0||W.length===0?"60px":"0px",width:j||v.length>0||W.length===0?"auto":"0px",flex:j||v.length>0||W.length===0?"1":"0",border:"none",outline:"none",background:"transparent",fontSize:"inherit",fontFamily:"inherit",padding:"0",margin:"0",overflow:"hidden",lineHeight:"24px",display:"flex",alignItems:"center",height:j||v.length>0||W.length===0?"auto":"0px",minHeight:j||v.length>0||W.length===0?"auto":"0px","&::placeholder":{opacity:W.length===0||j||v.length>0?1:0,display:W.length===0||j||v.length>0?"block":"none",color:"var(--mantine-color-gray-9)",lineHeight:"24px"}}}})})]})})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:U==="bottom"?"0 0 var(--mantine-radius-md) var(--mantine-radius-md)":"var(--mantine-radius-md) var(--mantine-radius-md) 0 0",borderTop:"none",border:`1px solid ${P()}`,marginTop:"0",padding:"4px",boxShadow:U==="bottom"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"0 -4px 10px 0 rgba(0, 0, 0, 0.1)"}},ref:L,children:e.jsx(t.Combobox.Options,{children:e.jsx(t.ScrollArea,{ref:I,h:Math.min(G.length*parseFloat(Ho),300),scrollbarSize:6,children:e.jsxs(t.Stack,{gap:2,children:[G.map($=>{const oe=F.includes($.id);return e.jsx(t.Combobox.Option,{value:$.id,active:oe,onMouseDown:Z=>{Z.preventDefault(),_($.id)},style:{borderRadius:"var(--mantine-radius-md)",height:"40px"},children:e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",style:{display:"flex",alignItems:"center"},h:"28px",children:[e.jsx(se,{avatar:$.avatar,size:24,placeholder:$.name,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:400,truncate:!0,children:$.name}),oe&&e.jsx(k.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"})]})},$.id)}),(M||x)&&e.jsx(t.Box,{style:{padding:"12px",display:"flex",justifyContent:"center"},children:e.jsx(t.Loader,{size:"sm"})}),p&&y&&!x&&e.jsx("div",{ref:X,style:{height:"20px"}}),G.length===0&&!M&&!x&&e.jsx(t.Box,{style:{padding:"24px",textAlign:"center"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:"No users found"})})]})})})})]})})},qe=({label:n,icon:r,value:o,onChange:s,editable:a=!1,placeholder:i,disabled:c=!1,minRows:d=1,maxRows:l,autosize:f=!0})=>{const[h,g]=u.useState(!1),[p,y]=u.useState(!1),x={wrapper:{...!f&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},borderRadius:"var(--mantine-radius-md)"},input:{backgroundColor:h||p?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-9)",border:h?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:"var(--mantine-radius-md)",width:"100%",cursor:"pointer",...!f&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},padding:"8px 14px",lineHeight:f?"1.5":"24px",fontWeight:450}};return e.jsx(fe,{editable:a,label:n,icon:r,value:e.jsx(t.Box,{w:"100%",style:{display:"flex",alignItems:"flex-start",minHeight:40},p:"xs",h:40,children:e.jsx(t.Text,{size:"sm",c:o?void 0:"dimmed",fw:400,style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o||i||"—"})}),children:e.jsx(t.Box,{w:"100%",style:{boxShadow:h?"var(--mantine-shadow-sm)":"none",borderRadius:"var(--mantine-radius-md)"},children:e.jsx(t.Textarea,{value:o,onChange:m=>s==null?void 0:s(m.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),placeholder:i,disabled:c,size:"sm",radius:"md",fw:400,minRows:h?1:d,maxRows:l,autosize:f,styles:{...x}})})})},Vo=({opened:n,onClose:r,children:o,...s})=>e.jsxs(t.Modal,{withCloseButton:!1,opened:n,onClose:r,size:"70%",centered:!0,overlayProps:{backgroundOpacity:.55},styles:{content:{minHeight:"100%"}},padding:"md",...s,children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:e.jsx(ee,{icon:k.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(t.Group,{justify:"space-between",gap:"xs",children:[e.jsx(ee,{icon:k.IconStar,size:"md",onClick:()=>{}}),e.jsx(ee,{icon:k.IconDots,size:"md",onClick:()=>{}})]})]}),o]}),Pn=({opened:n,onClose:r,editable:o,content:s,position:a="right",size:i="xl",onMaximize:c,rightCornerActions:d,headerProps:l,propertiesProps:f})=>{var w,B;const[h,g]=u.useState(!1),p=(f==null?void 0:f.hiddenProperties)&&f.hiddenProperties.length>0,[y,x]=u.useState(!1),[m,I]=u.useState(l==null?void 0:l.avatar),[b,v]=u.useState(!1);u.useEffect(()=>{I(l==null?void 0:l.avatar)},[l==null?void 0:l.avatar]);const S=e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var C;const M={type:"emoji",value:"😊"};I(M),(C=l==null?void 0:l.onAvatarChange)==null||C.call(l,M)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(k.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})});return e.jsxs(t.Drawer,{opened:n,onClose:r,position:a,size:i,padding:"md",withCloseButton:!1,overlayProps:{backgroundOpacity:0},shadow:"none",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:[e.jsx(ee,{icon:k.IconChevronsRight,size:"md",onClick:r}),e.jsx(ee,{icon:k.IconMaximize,size:"md",onClick:()=>c()})]}),e.jsx(t.Group,{justify:"space-between",gap:"xs",children:d})]}),e.jsxs(t.Box,{p:"3rem",children:[l&&e.jsxs(t.Box,{children:[e.jsx(t.Box,{onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),children:m?e.jsx(Ye,{editable:o,avatar:m,size:"xl",opened:b,onOpen:()=>v(!0),onClose:()=>v(!1),onAvatarSelect:M=>{var C;I(M),(C=l==null?void 0:l.onAvatarChange)==null||C.call(l,M)},onRemove:()=>{I(void 0)}}):e.jsx(t.Box,{h:24,children:y&&S})}),o?e.jsx(Oe,{value:l.title||"",onChange:M=>{var C;return(C=l.onTitleChange)==null?void 0:C.call(l,M)},pageTitle:!0,placeholder:l.placeholder}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:l.title})})]}),e.jsx(t.Stack,{gap:"sm",children:(w=f==null?void 0:f.visibleProperties)==null?void 0:w.map((M,C)=>e.jsx(t.Box,{children:M},C))}),p&&!h&&e.jsx(t.Box,{w:"100%",style:{display:"flex",justifyContent:"center"},children:e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray.4",onClick:()=>g(!0),children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-blue-5)",children:"Show"}),e.jsx(k.IconChevronDown,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),e.jsx(t.Collapse,{in:h,children:e.jsx(t.Stack,{gap:"sm",mt:"sm",children:(B=f==null?void 0:f.hiddenProperties)==null?void 0:B.map((M,C)=>e.jsx(t.Box,{children:M},C))})}),p&&h&&e.jsx(t.Box,{w:"100%",style:{display:"flex",justifyContent:"center"},mt:"sm",children:e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray.4",onClick:()=>g(!1),children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-blue-5)",children:"Hide"}),e.jsx(k.IconChevronUp,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),s]})]})},_o=({children:n})=>e.jsx(t.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:n}),Un=u.createContext(void 0),Nn=({children:n})=>{const[r,{toggle:o,open:s,close:a}]=Ie.useDisclosure(!0),[i,{toggle:c,open:d,close:l}]=Ie.useDisclosure(!1),[f,{open:h,close:g}]=Ie.useDisclosure(!1),[p,y]=u.useState(300),[x,m]=u.useState(500),I={opened:r,toggle:o,open:s,close:a,asideOpened:i,toggleAside:c,openAside:d,closeAside:l,sidebarWidth:p,setSidebarWidth:y,asideWidth:x,setAsideWidth:m,openedNotificationSidebar:f,openNotificationSidebar:h,closeNotificationSidebar:g};return e.jsx(Un.Provider,{value:I,children:n})},Ze=()=>{const n=u.useContext(Un);if(n===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return n},Wn=({header:n,navbar:r,aside:o,children:s,...a})=>{const{opened:i,asideOpened:c,sidebarWidth:d,asideWidth:l}=Ze();return e.jsxs(t.AppShell,{header:{height:n?60:0},navbar:{width:i?d:0,breakpoint:"sm",collapsed:{mobile:!0}},aside:{width:c?l:0,breakpoint:"sm",collapsed:{mobile:!0}},padding:0,...a,children:[n&&e.jsx(t.AppShell.Header,{children:n}),e.jsx(t.AppShell.Navbar,{style:{display:i?"block":"none",width:i?d:0,border:"none"},children:r}),e.jsx(t.AppShell.Aside,{style:{display:c?"block":"none",width:c?l:0},children:o}),e.jsx(t.AppShell.Main,{children:s})]})},Qo=({items:n,selectedId:r,onSelect:o})=>e.jsx(t.Stack,{gap:0,children:n.map(s=>{var a;return e.jsx(Ve,{label:s.label,isActive:r===s.id,noChild:!s.children||s.children.length===0,onClick:()=>(!s.children||s.children.length===0)&&(o==null?void 0:o(s.id)),children:(a=s.children)==null?void 0:a.map(i=>e.jsx(Ve,{label:i.label,noChild:!0,level:4,isActive:r===i.id,onClick:()=>o==null?void 0:o(i.id)},i.id))},s.id)})}),Yo=({items:n,selectedId:r,onSelect:o,headerLeft:s,headerRight:a,renderPreview:i,renderAside:c,sidebarTitle:d="Documentation",topNavItems:l,selectedTopNavId:f,onTopNavSelect:h})=>{const{opened:g,toggle:p}=Ze(),[y,x]=u.useState(r),m=r??y,I=b=>{o==null||o(b),r===void 0&&x(b)};return e.jsx(Wn,{header:l?e.jsx(_e,{withBorder:!0,bg:"transparent",position:"left",header:e.jsx(t.Group,{h:40,w:"100%",justify:"space-between",wrap:"nowrap",children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",children:g&&e.jsx(t.Text,{fw:600,size:"sm",children:d})})})}):void 0,navbar:e.jsx(_e,{withBorder:!0,bg:"transparent",position:"left",header:e.jsxs(t.Group,{h:40,w:"100%",justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Group,{gap:"xs",wrap:"nowrap",children:g&&e.jsx(t.Text,{fw:600,size:"sm",children:d})}),e.jsx(ee,{icon:g?k.IconChevronsLeft:k.IconChevronsRight,size:"md",onClick:p})]}),body:g&&e.jsx(t.ScrollArea,{h:"100%",type:"hover",scrollbarSize:10,styles:{scrollbar:{'&[data-state="visible"]':{background:"transparent"}},thumb:{backgroundColor:"var(--mantine-color-gray-4)",opacity:.3,"&:hover":{backgroundColor:"var(--mantine-color-gray-4)",opacity:.3}}},children:e.jsx(Qo,{items:n,selectedId:m,onSelect:I})}),footer:e.jsx(e.Fragment,{})}),aside:e.jsx(t.Box,{p:"md",h:"100%",children:c==null?void 0:c(m)}),children:e.jsxs(t.Box,{style:{height:"100vh",display:"flex",flexDirection:"column",background:"var(--mantine-color-body)"},children:[e.jsxs(t.Group,{p:"md",justify:"space-between",align:"center",children:[e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[!g&&e.jsx(ee,{icon:k.IconChevronsRight,size:"md",variant:"subtle",tooltip:"Open sidebar",onClick:p}),s??e.jsx(Be,{label:m||"Select a topic",onClick:()=>{}})]}),!l&&a]}),e.jsx(t.Box,{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"40px"},children:e.jsx(t.Box,{p:"xl",style:{borderRadius:"var(--mantine-radius-md)",width:"100%"},children:i(m)})})]})})},qo=n=>e.jsx(Nn,{children:e.jsx(Yo,{...n})}),Xe=(n,r)=>{const o=u.useCallback(i=>{const c=Array.isArray(i)?i:[i];n.onUserIdsChange(c)},[n]),s=u.useCallback(i=>{const c=Array.isArray(i)?i:[i],d=r.members.filter(y=>c.includes(y.id)),l=d.map(y=>y.id),f=c.filter(y=>!l.includes(y)),g=[...r.members,...n.users].filter(y=>f.includes(y.id)),p=[...d,...g];r.onMembersChange(p)},[r,n]);return{availableMembersUsers:u.useMemo(()=>{const i=[...r.members];return n.users.forEach(c=>{i.find(d=>d.id===c.id)||i.push(c)}),i},[r.members,n.users]),handleResponsibleChange:o,handleMembersChange:s}},Zo=({opened:n,onClose:r,onMaximize:o,editable:s,name:a,onNameChange:i,avatar:c,onAvatarChange:d,owner:l,responsibleProps:f,membersProps:h,descriptionProps:g})=>{const{availableMembersUsers:p,handleResponsibleChange:y,handleMembersChange:x}=Xe(f,h),m=u.useMemo(()=>[e.jsx(qe,{label:"Description",icon:k.IconAlignLeft,value:g.description,onChange:g.onDescriptionChange,editable:s},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:k.IconUserCircle,value:l.id,users:[l]},"owner"),e.jsx(pe,{multiple:!1,editable:s,label:"Team Leader",icon:k.IconUser,value:f.userIds.length>0?f.userIds[0]:void 0,users:f.users,onChange:y,onSearch:f.handleSearch,onLoadMore:f.handleLoadMore,hasMore:f.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:s,label:"Team Members",icon:k.IconUsers,value:h.members.map(I=>I.id),users:p,onChange:x,onSearch:h.handleSearch,onLoadMore:h.handleLoadMore,hasMore:h.hasMore},"members")],[g.description,g.onDescriptionChange,s,l,f.handleLoadMore,f.handleSearch,f.hasMore,f.userIds,f.users,y,h.handleLoadMore,h.handleSearch,h.hasMore,h.members,p,x]);return e.jsx(Pn,{opened:n,onClose:r,onMaximize:o,editable:s,headerProps:{avatar:c,onAvatarChange:I=>d==null?void 0:d(I),title:a,onTitleChange:i,placeholder:"Team name"},propertiesProps:{visibleProperties:m}})},$n=({isSidebarOpen:n,fullWidth:r=!1,editable:o,rightNavigation:s,headerProps:a,properties:i,children:c,footer:d})=>{const[l,f]=u.useState(a==null?void 0:a.avatar),[h,g]=u.useState(!1),[p,y]=u.useState(!1),x=r?"0":{base:"1rem",sm:"2rem",md:"4rem",lg:"8rem",xl:"10rem"},[m,I]=u.useState(n);u.useEffect(()=>{I(n)},[n]);const b=()=>{I(v=>!v)};return e.jsxs(t.Stack,{gap:"md",p:"md",children:[e.jsxs(t.Group,{justify:"space-between",children:[e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[e.jsx(ee,{icon:m?k.IconChevronsRight:k.IconMenu2,size:"md",color:"gray",changeIconOnHover:!0,iconHovered:m?k.IconMenu2:k.IconChevronsRight,variant:"subtle",onClick:b,"aria-pressed":m}),e.jsx(Be,{label:a.title,onClick:()=>{}})]}),e.jsx(t.Box,{children:s})]}),e.jsx(t.Box,{px:x,w:"100%",maw:{base:"100%",md:"80vw"},mx:"auto",children:e.jsxs(t.Stack,{gap:"md",children:[a&&e.jsxs(t.Stack,{gap:"md",children:[e.jsx(t.Box,{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),h:l?64:24,children:l?e.jsx(Ye,{editable:o,avatar:l,size:64,opened:h,onOpen:()=>g(!0),onClose:()=>g(!1),onAvatarSelect:v=>{var S;f(v),(S=a==null?void 0:a.onAvatarChange)==null||S.call(a,v)},onRemove:()=>{f(void 0)}}):e.jsx(t.Box,{h:24,children:p&&e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var S;const v={type:"emoji",value:"😊"};f(v),(S=a==null?void 0:a.onAvatarChange)==null||S.call(a,v)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(k.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})})})}),e.jsx(t.Box,{children:o?e.jsx(un,{value:a.title||"",onChange:v=>{var S;return(S=a.onTitleChange)==null?void 0:S.call(a,v)},placeholder:a.placeholder,pageTitle:!0}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:a.title})})})]}),i,c,d]})})]})},Hn=({editable:n,owner:r,descriptionProps:o,responsibleProps:s,membersProps:a})=>{const{availableMembersUsers:i,handleResponsibleChange:c,handleMembersChange:d}=Xe(s,a);return e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(qe,{label:"Description",icon:k.IconAlignLeft,value:o.description,onChange:o.onDescriptionChange,editable:n},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:k.IconUserCircle,value:r.id,users:[r]},"owner"),e.jsx(pe,{multiple:!1,editable:n,label:"Team Leader",icon:k.IconUser,value:s.userIds.length>0?s.userIds[0]:void 0,users:s.users,onChange:c,onSearch:s.handleSearch,onLoadMore:s.handleLoadMore,hasMore:s.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:n,label:"Team Members",icon:k.IconUsers,value:a.members.map(l=>l.id),users:i,onChange:d,onSearch:a.handleSearch,onLoadMore:a.handleLoadMore,hasMore:a.hasMore},"members")]})},Xo=({editable:n,headerProps:r,rightNavigation:o,properties:s,children:a,footer:i})=>e.jsx($n,{isSidebarOpen:!0,editable:n,rightNavigation:o,headerProps:r,properties:e.jsx(Hn,{...s}),children:a,footer:i}),Ko=({title:n,properties:r,children:o})=>e.jsxs(t.Stack,{gap:"sm",p:"3rem",children:[e.jsx(t.Text,{size:"2.5rem",fw:600,children:n}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Stack,{gap:"xs",children:r}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Box,{children:o})]}),Gn=t.createTheme({primaryColor:"blue",fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",fontFamilyMonospace:"Monaco, Courier, monospace",headings:{fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif"},colors:{gray:["#f6f5f4","#e8e8e8","#cfcfcf","#b5b5b5","#9f9e9d","#91908c","#8b8983","#787670","#6b6962","#37352f"]},components:{}});function Jo({children:n,theme:r}){return e.jsxs(t.MantineProvider,{theme:r||Gn,children:[e.jsx(ct.Notifications,{}),e.jsx(lt.ModalsProvider,{children:e.jsx(dt.DatesProvider,{settings:{firstDayOfWeek:0},children:n})})]})}exports.ActionButton=ee;exports.ActionIcon=me;exports.AppLayout=Wn;exports.AppLayoutProvider=Nn;exports.AvatarSelector=Ye;exports.BaseLayout=Ko;exports.BoxAvatar=se;exports.CenterPeek=Vo;exports.DocsTemplate=qo;exports.EditableText=Oe;exports.EditableTextarea=un;exports.EmojiAvatar=on;exports.ExpandableSearch=fn;exports.FilterDropdown=wt;exports.FilterDropdownButton=ze;exports.FilterDropdownFilters=Re;exports.FullPage=_o;exports.GenericTable=pn;exports.IconAvatar=an;exports.ImageAvatar=cn;exports.InvitedUserCard=ve;exports.LinkProperty=Eo;exports.Logo=dn;exports.Matrix=Fn;exports.Menu=ye;exports.ModalSettings=io;exports.NavButton=Qe;exports.NavLink=Ve;exports.Navbar=_e;exports.NavbarProvider=go;exports.NotificationSidebar=mo;exports.NumberProperty=Ao;exports.PageLayout=$n;exports.PageProperty=fe;exports.PlaceholderAvatar=Te;exports.PopoverItem=hn;exports.PopoverSelector=De;exports.SelectUserProperty=pe;exports.ShareButton=so;exports.ShareMenu=Cn;exports.ShareModal=ao;exports.SidePeek=Pn;exports.TeamPage=Xo;exports.TeamProperties=Hn;exports.TeamSidePeek=Zo;exports.TextButton=Be;exports.TextProperty=Do;exports.TextareaProperty=qe;exports.ThemeProvider=Jo;exports.UserChip=Ce;exports.WorkspaceSelector=wo;exports.WorkspaceSelectorItem=Tn;exports.getInitialsFromName=ln;exports.theme=Gn;exports.useAppLayout=Ze;exports.useNavbar=Io;exports.useTeamProperties=Xe;