obeyaka-ui 0.1.11 → 0.1.13

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 _e=Object.create;var he=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var Je=(o,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ye(r))!Ke.call(o,a)&&a!==t&&he(o,a,{get:()=>r[a],enumerable:!(s=Ze(r,a))||s.enumerable});return o};var le=(o,r,t)=>(t=o!=null?_e(Xe(o)):{},Je(r||!o||!o.__esModule?he(t,"default",{value:o,enumerable:!0}):t,o));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),n=require("@mantine/core"),w=require("@tabler/icons-react"),ae=require("@emoji-mart/data"),me=require("emoji-mart"),en=require("@mantine/hooks"),nn=require("@mantine/notifications"),on=require("@mantine/modals"),tn=require("@mantine/dates"),H=l.memo(({onClick:o,icon:r,changeIconOnHover:t=!1,iconHovered:s,iconColor:a="var(--mantine-color-gray-7)",size:c="md",variant:i="transparent",bg:u,disabled:d=!1,loading:f=!1,tooltip:I,"aria-label":y,className:h,style:b,onMouseEnter:j,onMouseLeave:x,...g})=>{const[v,m]=l.useState(!1),C=l.useCallback(()=>{d||f||(o==null||o(),console.log("Clicked"))},[d,f,o]),k=l.useMemo(()=>({xs:14,sm:16,md:20,lg:24,xl:28})[c]||20,[c]),O=l.useMemo(()=>({xs:2,sm:2,md:2,lg:2,xl:2.5})[c]||2,[c]),T=l.useCallback(B=>{m(!0),j==null||j(B)},[j]),M=l.useCallback(B=>{m(!1),x==null||x(B)},[x]),p=l.useMemo(()=>{if(u)return u;if(i==="transparent")return v?"var(--mantine-color-gray-2)":"transparent"},[u,i,v]),D=l.useMemo(()=>t&&s&&v?s:r,[t,s,v,r]),P=l.useMemo(()=>e.jsx(D,{size:k,strokeWidth:O,color:a}),[D,k,O,a]),R=e.jsx(n.ActionIcon,{onClick:C,bg:p,color:a,radius:"md",variant:i==="transparent"?"transparent":i,size:c,disabled:d||f,loading:f,onMouseEnter:T,onMouseLeave:M,"aria-label":y||I,className:h,style:b,...g,children:P});return I&&!d&&!f?e.jsx(n.Tooltip,{label:I,position:"top",withArrow:!0,children:R}):R});H.displayName="ActionButton";const rn=o=>{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:48}};return typeof o=="number"?{width:o,height:o,fontSize:o-8}:r[o]},ye=({emoji:o,size:r="lg",editable:t=!1,onClick:s,className:a,style:c})=>{const i=rn(r),u=t&&s;return e.jsx(n.Box,{className:a,style:{...i,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:u?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...c},onClick:u?s:void 0,onMouseEnter:d=>{u&&(d.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:d=>{u&&(d.currentTarget.style.backgroundColor="transparent")},children:e.jsx(n.Box,{style:{fontSize:i.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:o})})},_=o=>{if(typeof o=="number")return o;switch(o){case"xs":return 24;case"sm":return 32;case"md":return 48;case"lg":return 64;case"xl":return 80;default:return 64}},G=new Map,sn=["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"],an=async()=>{try{const o=await import("@tabler/icons-react");sn.forEach(r=>{if(!G.has(r)){const t=o[r];t&&G.set(r,t)}})}catch(o){console.warn("Error preloading common icons:",o)}};an();const cn=async o=>{if(G.has(o))return G.get(o);try{const s=(await import("@tabler/icons-react"))[o]||w.IconQuestionMark;return G.set(o,s),s}catch{return G.set(o,w.IconQuestionMark),w.IconQuestionMark}},ln=o=>o.replace(/^Icon/,"").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,t=>t.toUpperCase()),ve=l.memo(({iconName:o,onClick:r,size:t=20})=>{const[s,a]=l.useState(null),[c,i]=l.useState(!0),u=l.useRef(null),d=l.useRef(!0);l.useEffect(()=>(d.current=!0,(async()=>{try{const h=(await import("@tabler/icons-react"))[o];d.current&&(a(h?()=>h:w.IconQuestionMark),i(!1))}catch{d.current&&(a(()=>w.IconQuestionMark),i(!1))}})(),()=>{d.current=!1}),[o]);const f=()=>{c||r()};return c?e.jsx(n.Box,{ref:u,style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"var(--mantine-radius-sm)"},children:e.jsx(n.Skeleton,{width:t,height:t})}):e.jsx(n.Tooltip,{label:ln(o),position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(n.Box,{ref:u,onClick:f,style:{width:"40px",height:"40px",fontSize:`${t}px`,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",transition:"all 0.2s ease",cursor:c?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},onMouseEnter:I=>{c||(I.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",I.currentTarget.style.transform="scale(1.05)")},onMouseLeave:I=>{c||(I.currentTarget.style.backgroundColor="transparent",I.currentTarget.style.transform="scale(1)")},onMouseDown:I=>{c||(I.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)",I.currentTarget.style.transform="scale(0.95)")},onMouseUp:I=>{c||(I.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",I.currentTarget.style.transform="scale(1.05)")},children:s&&e.jsx(s,{size:t,color:"var(--mantine-color-gray-7)"})})})});ve.displayName="IconButton";const je=l.memo(({iconName:o,size:r="lg",style:t,withBorder:s=!1,radius:a="md",onClick:c,onMouseEnter:i,onMouseLeave:u})=>{const[d,f]=l.useState(!1),[I,y]=l.useState(()=>G.get(o)||null),h=_(r),b=Math.round(h*.9);l.useEffect(()=>{if(G.has(o)){y(()=>G.get(o));return}let x=!0;return cn(o).then(g=>{x&&y(()=>g)}),()=>{x=!1}},[o]);const j=()=>typeof a=="number"?a:`var(--mantine-radius-${a})`;return I?e.jsx(n.Box,{style:{width:`${h}px !important`,height:`${h}px !important`,minWidth:`${h}px`,minHeight:`${h}px`,maxWidth:`${h}px`,maxHeight:`${h}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:j(),cursor:c?"pointer":"default",border:s?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:d?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...t},onClick:c,onMouseEnter:x=>{f(!0),i==null||i(x)},onMouseLeave:x=>{f(!1),u==null||u(x)},children:e.jsx(I,{size:b,color:"var(--mantine-color-gray-8)"})}):e.jsx(n.Box,{style:{width:`${h}px !important`,height:`${h}px !important`,minWidth:`${h}px`,minHeight:`${h}px`,maxWidth:`${h}px`,maxHeight:`${h}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:j(),cursor:c?"pointer":"default",border:s?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:d?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...t},onClick:c,onMouseEnter:x=>{f(!0),i==null||i(x)},onMouseLeave:x=>{f(!1),u==null||u(x)}})});je.displayName="IconAvatar";const dn=o=>{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}};return typeof o=="number"?{width:o,height:o}:r[o]},be=({iconName:o,size:r="lg",editable:t=!1,onClick:s,className:a,style:c})=>{const i=dn(r),u=t&&s;return e.jsx(n.Box,{className:a,style:{...i,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:u?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...c},onClick:u?s:void 0,onMouseEnter:d=>{u&&(d.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:d=>{u&&(d.currentTarget.style.backgroundColor="transparent")},children:e.jsx(n.Box,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:e.jsx(je,{iconName:o,size:i.width,onClick:void 0})})})},un=o=>{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}};return typeof o=="number"?{width:o,height:o}:r[o]},we=({src:o,size:r="lg",editable:t=!1,onClick:s,className:a,style:c,loading:i=!1,alt:u="Avatar"})=>{const[d,f]=l.useState(!1),I=un(r),y=t&&s,h=()=>{f(!0)},b=()=>{f(!1)};return e.jsx(n.Box,{className:a,style:{...I,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:y?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...c},onClick:y?s:void 0,onMouseEnter:j=>{y&&(j.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:j=>{y&&(j.currentTarget.style.backgroundColor="transparent")},children:i?e.jsx(n.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):!d&&e.jsx("img",{src:o,alt:u,style:{width:"100%",height:"100%",objectFit:"cover"},onError:h,onLoad:b})})},fn=o=>{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}};return typeof o=="number"?{width:o,height:o,fontSize:o*.5}:r[o]},ie=({text:o="?",size:r="lg",editable:t=!1,onClick:s,className:a,style:c,loading:i=!1})=>{const u=fn(r),d=t&&s;return e.jsx(n.Box,{className:a,style:{...u,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:"var(--mantine-color-gray-2)",...c},onClick:d?s:void 0,onMouseEnter:f=>{d&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-3)")},onMouseLeave:f=>{d&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)")},children:i?e.jsx(n.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):e.jsx(n.Box,{style:{fontSize:u.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,color:"var(--mantine-color-gray-7)"},children:o})})},Se=o=>{if(!o)return"";const r=["de","del","la","las","los","y","el","en","con"],s=o.trim().split(/\s+/).filter(a=>!r.includes(a.toLowerCase())).map(a=>{var c;return((c=a[0])==null?void 0:c.toUpperCase())||""}).filter(Boolean).slice(0,2).join("");return s.length===1?s+s:s.length===0?o.slice(0,2).toUpperCase():s},Z=({avatar:o,size:r="lg",loading:t=!1,onClick:s,className:a,style:c,showPlaceholder:i=!0,placeholder:u,editable:d=!1})=>{const f=()=>{if(o)switch(o.type){case"emoji":return e.jsx(ye,{emoji:o.value,size:r,editable:d,onClick:s});case"icon":return e.jsx(be,{iconName:o.value,size:r,editable:d,onClick:s});case"image":return e.jsx(we,{src:o.value,size:r,editable:d,onClick:s})}if(i){const y=u?Se(u):"?";return e.jsx(ie,{text:y,size:r,editable:d,onClick:s})}return null};if(t)return e.jsx(ie,{size:r,loading:!0,className:a,style:c});const I=f();return I?e.jsx("div",{className:a,style:c,children:I}):null},Ce=({label:o,onClick:r,isActive:t=!1})=>{const[s,a]=l.useState(!1);return e.jsx(n.Box,{onClick:r,bg:s||t?"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(n.Text,{fw:500,fz:"sm",truncate:"end",c:"var(--mantine-color-gray-9)",children:o})})},In=new URL("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTUiIGhlaWdodD0iNTYiIHZpZXdCb3g9IjAgMCA1NSA1NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMC43NUg1NVY1NS43NUgwVjAuNzVaIiBmaWxsPSIjRjZGNUY0Ii8+CjxwYXRoIGQ9Ik04LjgwMDI5IDM0LjYzQzguODAwMjkgMzQuMTQ0IDkuMTk0MjggMzMuNzUgOS42ODAyOSAzMy43NUgxOC45MjAzQzE5LjQwNjMgMzMuNzUgMTkuODAwMyAzNC4xNDQgMTkuODAwMyAzNC42M1Y0My44N0MxOS44MDAzIDQ0LjM1NiAxOS40MDYzIDQ0Ljc1IDE4LjkyMDMgNDQuNzVIOS42ODAyOUM5LjE5NDI4IDQ0Ljc1IDguODAwMjkgNDQuMzU2IDguODAwMjkgNDMuODdWMzQuNjNaIiBmaWxsPSIjRkZDQTAwIi8+CjxwYXRoIGQ9Ik0yMi4wMDAyIDIzLjYzQzIyLjAwMDIgMjMuMTQ0IDIyLjM5NDIgMjIuNzUgMjIuODgwMiAyMi43NUgzMi4xMjAyQzMyLjYwNjMgMjIuNzUgMzMuMDAwMiAyMy4xNDQgMzMuMDAwMiAyMy42M1Y0My44N0MzMy4wMDAyIDQ0LjM1NiAzMi42MDYzIDQ0Ljc1IDMyLjEyMDIgNDQuNzVIMjIuODgwMkMyMi4zOTQyIDQ0Ljc1IDIyLjAwMDIgNDQuMzU2IDIyLjAwMDIgNDMuODdWMjMuNjNaIiBmaWxsPSIjMzdDRTkxIi8+CjxwYXRoIGQ9Ik0zNS4yMDAyIDEyLjYzQzM1LjIwMDIgMTIuMTQ0IDM1LjU5NDIgMTEuNzUgMzYuMDgwMiAxMS43NUg0NS4zMjAyQzQ1LjgwNjIgMTEuNzUgNDYuMjAwMiAxMi4xNDQgNDYuMjAwMiAxMi42M1Y0My44N0M0Ni4yMDAyIDQ0LjM1NiA0NS44MDYyIDQ0Ljc1IDQ1LjMyMDIgNDQuNzVIMzYuMDgwMkMzNS41OTQyIDQ0Ljc1IDM1LjIwMDIgNDQuMzU2IDM1LjIwMDIgNDMuODdWMTIuNjNaIiBmaWxsPSIjRkIzNzU3Ii8+CjxwYXRoIGQ9Ik04LjgwMDA1IDE3LjI1QzguODAwMDUgMTQuMjEyNCAxMS4yNjI1IDExLjc1IDE0LjMgMTEuNzVDMTcuMzM3NiAxMS43NSAxOS44IDE0LjIxMjQgMTkuOCAxNy4yNUMxOS44IDIwLjI4NzYgMTcuMzM3NiAyMi43NSAxNC4zIDIyLjc1QzExLjI2MjUgMjIuNzUgOC44MDAwNSAyMC4yODc2IDguODAwMDUgMTcuMjVaIiBmaWxsPSIjMDA3MkZGIi8+Cjwvc3ZnPgo=",self.location).href,ke=({appName:o="Obeyaka",size:r="md",showText:t=!0,color:s="var(--mantine-color-dark-6)",radius:a})=>{const c=()=>{switch(r){case"xs":return{icon:20,text:"xs"};case"sm":return{icon:28,text:"md"};case"md":return{icon:36,text:"lg"};case"lg":return{icon:44,text:"xl"};default:return{icon:36,text:"lg"}}},i=()=>{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:u,text:d}=c(),f=()=>{const I=u*56/55;return e.jsx("img",{src:In,alt:`${o} Logo`,width:u,height:I,style:{display:"block",flexShrink:0,borderRadius:i()}})};return e.jsxs(n.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[f(),t&&e.jsx(n.Text,{size:d,fw:700,c:s==="white"?"white":s,style:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, sans-serif"},children:o})]})},pn=({value:o,label:r,onChange:t,placeholder:s="Click to edit...",disabled:a=!1,bgColor:c="gray",size:i="md",radius:u="sm",className:d="",style:f,showEditBorder:I=!0,editBorderColor:y="#228be6",selectOnFocus:h=!1,...b})=>{const[j,x]=l.useState(!1),[g,v]=l.useState(o),m=l.useRef(null);l.useEffect(()=>{v(o)},[o]);const C=()=>{a||(x(!0),h&&m.current&&m.current.select())},k=()=>{x(!1),g!==o&&t(g)},O=D=>{v(D.target.value)},T=D=>{var P,R;D.key==="Enter"?(x(!1),t(g),(P=m.current)==null||P.blur()):D.key==="Escape"&&(v(o),x(!1),(R=m.current)==null||R.blur())},M={cursor:a?"not-allowed":"text"},p={backgroundColor:c==="gray"?"var(--mantine-color-gray-0)":c==="white"?"var(--mantine-color-white)":void 0,borderColor:j&&I?y:void 0,borderWidth:j&&I?"2px":void 0,transition:"border-color 0.2s ease-in-out, border-width 0.2s ease-in-out",color:"var(--mantine-color-gray-9)"};return e.jsx(n.InputWrapper,{label:r,c:"var(--mantine-color-gray-6)",size:i,children:e.jsx(n.Input,{ref:m,value:g,onChange:O,onFocus:C,onBlur:k,onKeyDown:T,placeholder:s,disabled:a,size:i,fw:500,radius:u,className:d,style:{...M,...f},styles:{input:{...p}},...b})})},Me=({expandDirection:o="right",placeholder:r="Type to search",value:t="",onChange:s,onSearch:a,onClear:c,size:i="md",disabled:u=!1,className:d})=>{const[f,I]=l.useState(!1),[y,h]=l.useState(!1),[b,j]=l.useState(t),x=l.useRef(null),g=l.useRef(null);l.useEffect(()=>{j(t)},[t]),l.useEffect(()=>{f&&x.current&&x.current.focus()},[f]),l.useEffect(()=>{const p=D=>{g.current&&!g.current.contains(D.target)&&v()};if(f)return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[f]);const v=()=>{h(!0),setTimeout(()=>{I(!1),h(!1)},200)},m=()=>{u||I(!0)},C=p=>{const D=p.target.value;j(D),s==null||s(D)},k=p=>{p.key==="Enter"&&(a==null||a(b)),p.key==="Escape"&&v()},O=()=>{j(""),s==null||s(""),c==null||c(),v()},M=(()=>{switch(i){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(n.Box,{ref:g,className:d,style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[e.jsxs(n.Group,{gap:0,style:{position:"relative",transition:"all 0.2s ease",borderRadius:"var(--mantine-radius-md)"},children:[e.jsx(n.Box,{onClick:m,style:{display:"flex",alignItems:"center",justifyContent:"center",width:M.inputHeight,height:M.inputHeight,cursor:u?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",opacity:u?.5:1},onMouseEnter:p=>{u||(p.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent"},children:e.jsx(w.IconSearch,{size:M.iconSize,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),f&&e.jsx(n.TextInput,{ref:x,value:b,onChange:C,onKeyDown:k,placeholder:r,disabled:u,height:M.inputHeight,fw:500,styles:{root:{position:"relative",animation:y?`shrink${o==="right"?"Right":"Left"} 0.2s ease forwards`:`expand${o==="right"?"Right":"Left"} 0.2s ease forwards`},input:{border:"none",outline:"none",backgroundColor:"transparent",padding:"0 8px",height:M.inputHeight,minHeight:M.inputHeight,fontSize:M.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:b&&e.jsx(n.Box,{onClick:O,style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"4px",borderRadius:"var(--mantine-radius-xl)",transition:"background-color 0.2s ease"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)"},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent"},children:e.jsx(w.IconX,{size:14,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),rightSectionWidth:b?24:0})]}),e.jsx("style",{children:`
1
+ "use strict";var Xe=Object.create;var xe=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var en=Object.getPrototypeOf,nn=Object.prototype.hasOwnProperty;var on=(o,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Je(r))!nn.call(o,a)&&a!==t&&xe(o,a,{get:()=>r[a],enumerable:!(s=Ke(r,a))||s.enumerable});return o};var de=(o,r,t)=>(t=o!=null?Xe(en(o)):{},on(r||!o||!o.__esModule?xe(t,"default",{value:o,enumerable:!0}):t,o));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),n=require("@mantine/core"),w=require("@tabler/icons-react"),ie=require("@emoji-mart/data"),ye=require("emoji-mart"),ae=require("@mantine/hooks"),tn=require("@mantine/notifications"),rn=require("@mantine/modals"),sn=require("@mantine/dates"),N=l.memo(({onClick:o,icon:r,changeIconOnHover:t=!1,iconHovered:s,iconColor:a="var(--mantine-color-gray-7)",size:c="md",variant:i="transparent",bg:u,disabled:d=!1,loading:f=!1,tooltip:p,"aria-label":m,className:I,style:b,onMouseEnter:v,onMouseLeave:g,...x})=>{const[j,y]=l.useState(!1),C=l.useCallback(()=>{d||f||(o==null||o(),console.log("Clicked"))},[d,f,o]),k=l.useMemo(()=>({xs:14,sm:16,md:20,lg:24,xl:28})[c]||20,[c]),O=l.useMemo(()=>({xs:2,sm:2,md:2,lg:2,xl:2.5})[c]||2,[c]),T=l.useCallback(B=>{y(!0),v==null||v(B)},[v]),M=l.useCallback(B=>{y(!1),g==null||g(B)},[g]),h=l.useMemo(()=>{if(u)return u;if(i==="transparent")return j?"var(--mantine-color-gray-2)":"transparent"},[u,i,j]),D=l.useMemo(()=>t&&s&&j?s:r,[t,s,j,r]),P=l.useMemo(()=>e.jsx(D,{size:k,strokeWidth:O,color:a}),[D,k,O,a]),R=e.jsx(n.ActionIcon,{onClick:C,bg:h,color:a,radius:"md",variant:i==="transparent"?"transparent":i,size:c,disabled:d||f,loading:f,onMouseEnter:T,onMouseLeave:M,"aria-label":m||p,className:I,style:b,...x,children:P});return p&&!d&&!f?e.jsx(n.Tooltip,{label:p,position:"top",withArrow:!0,children:R}):R});N.displayName="ActionButton";const an=o=>{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:48}};return typeof o=="number"?{width:o,height:o,fontSize:o-8}:r[o]},ve=({emoji:o,size:r="lg",editable:t=!1,onClick:s,className:a,style:c})=>{const i=an(r),u=t&&s;return e.jsx(n.Box,{className:a,style:{...i,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:u?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...c},onClick:u?s:void 0,onMouseEnter:d=>{u&&(d.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:d=>{u&&(d.currentTarget.style.backgroundColor="transparent")},children:e.jsx(n.Box,{style:{fontSize:i.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:o})})},_=o=>{if(typeof o=="number")return o;switch(o){case"xs":return 24;case"sm":return 32;case"md":return 48;case"lg":return 64;case"xl":return 80;default:return 64}},G=new Map,cn=["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"],ln=async()=>{try{const o=await import("@tabler/icons-react");cn.forEach(r=>{if(!G.has(r)){const t=o[r];t&&G.set(r,t)}})}catch(o){console.warn("Error preloading common icons:",o)}};ln();const dn=async o=>{if(G.has(o))return G.get(o);try{const s=(await import("@tabler/icons-react"))[o]||w.IconQuestionMark;return G.set(o,s),s}catch{return G.set(o,w.IconQuestionMark),w.IconQuestionMark}},un=o=>o.replace(/^Icon/,"").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,t=>t.toUpperCase()),je=l.memo(({iconName:o,onClick:r,size:t=20})=>{const[s,a]=l.useState(null),[c,i]=l.useState(!0),u=l.useRef(null),d=l.useRef(!0);l.useEffect(()=>(d.current=!0,(async()=>{try{const I=(await import("@tabler/icons-react"))[o];d.current&&(a(I?()=>I:w.IconQuestionMark),i(!1))}catch{d.current&&(a(()=>w.IconQuestionMark),i(!1))}})(),()=>{d.current=!1}),[o]);const f=()=>{c||r()};return c?e.jsx(n.Box,{ref:u,style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"var(--mantine-radius-sm)"},children:e.jsx(n.Skeleton,{width:t,height:t})}):e.jsx(n.Tooltip,{label:un(o),position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(n.Box,{ref:u,onClick:f,style:{width:"40px",height:"40px",fontSize:`${t}px`,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",transition:"all 0.2s ease",cursor:c?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},onMouseEnter:p=>{c||(p.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",p.currentTarget.style.transform="scale(1.05)")},onMouseLeave:p=>{c||(p.currentTarget.style.backgroundColor="transparent",p.currentTarget.style.transform="scale(1)")},onMouseDown:p=>{c||(p.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)",p.currentTarget.style.transform="scale(0.95)")},onMouseUp:p=>{c||(p.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",p.currentTarget.style.transform="scale(1.05)")},children:s&&e.jsx(s,{size:t,color:"var(--mantine-color-gray-7)"})})})});je.displayName="IconButton";const be=l.memo(({iconName:o,size:r="lg",style:t,withBorder:s=!1,radius:a="md",onClick:c,onMouseEnter:i,onMouseLeave:u})=>{const[d,f]=l.useState(!1),[p,m]=l.useState(()=>G.get(o)||null),I=_(r),b=Math.round(I*.9);l.useEffect(()=>{if(G.has(o)){m(()=>G.get(o));return}let g=!0;return dn(o).then(x=>{g&&m(()=>x)}),()=>{g=!1}},[o]);const v=()=>typeof a=="number"?a:`var(--mantine-radius-${a})`;return p?e.jsx(n.Box,{style:{width:`${I}px !important`,height:`${I}px !important`,minWidth:`${I}px`,minHeight:`${I}px`,maxWidth:`${I}px`,maxHeight:`${I}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:v(),cursor:c?"pointer":"default",border:s?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:d?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...t},onClick:c,onMouseEnter:g=>{f(!0),i==null||i(g)},onMouseLeave:g=>{f(!1),u==null||u(g)},children:e.jsx(p,{size:b,color:"var(--mantine-color-gray-8)"})}):e.jsx(n.Box,{style:{width:`${I}px !important`,height:`${I}px !important`,minWidth:`${I}px`,minHeight:`${I}px`,maxWidth:`${I}px`,maxHeight:`${I}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:v(),cursor:c?"pointer":"default",border:s?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:d?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...t},onClick:c,onMouseEnter:g=>{f(!0),i==null||i(g)},onMouseLeave:g=>{f(!1),u==null||u(g)}})});be.displayName="IconAvatar";const fn=o=>{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}};return typeof o=="number"?{width:o,height:o}:r[o]},we=({iconName:o,size:r="lg",editable:t=!1,onClick:s,className:a,style:c})=>{const i=fn(r),u=t&&s;return e.jsx(n.Box,{className:a,style:{...i,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:u?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...c},onClick:u?s:void 0,onMouseEnter:d=>{u&&(d.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:d=>{u&&(d.currentTarget.style.backgroundColor="transparent")},children:e.jsx(n.Box,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:e.jsx(be,{iconName:o,size:i.width,onClick:void 0})})})},pn=o=>{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}};return typeof o=="number"?{width:o,height:o}:r[o]},Se=({src:o,size:r="lg",editable:t=!1,onClick:s,className:a,style:c,loading:i=!1,alt:u="Avatar"})=>{const[d,f]=l.useState(!1),p=pn(r),m=t&&s,I=()=>{f(!0)},b=()=>{f(!1)};return e.jsx(n.Box,{className:a,style:{...p,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:m?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...c},onClick:m?s:void 0,onMouseEnter:v=>{m&&(v.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:v=>{m&&(v.currentTarget.style.backgroundColor="transparent")},children:i?e.jsx(n.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):!d&&e.jsx("img",{src:o,alt:u,style:{width:"100%",height:"100%",objectFit:"cover"},onError:I,onLoad:b})})},In=o=>{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}};return typeof o=="number"?{width:o,height:o,fontSize:o*.5}:r[o]},ce=({text:o="?",size:r="lg",editable:t=!1,onClick:s,className:a,style:c,loading:i=!1})=>{const u=In(r),d=t&&s;return e.jsx(n.Box,{className:a,style:{...u,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:"var(--mantine-color-gray-2)",...c},onClick:d?s:void 0,onMouseEnter:f=>{d&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-3)")},onMouseLeave:f=>{d&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)")},children:i?e.jsx(n.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):e.jsx(n.Box,{style:{fontSize:u.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,color:"var(--mantine-color-gray-7)"},children:o})})},Ce=o=>{if(!o)return"";const r=["de","del","la","las","los","y","el","en","con"],s=o.trim().split(/\s+/).filter(a=>!r.includes(a.toLowerCase())).map(a=>{var c;return((c=a[0])==null?void 0:c.toUpperCase())||""}).filter(Boolean).slice(0,2).join("");return s.length===1?s+s:s.length===0?o.slice(0,2).toUpperCase():s},Z=({avatar:o,size:r="lg",loading:t=!1,onClick:s,className:a,style:c,showPlaceholder:i=!0,placeholder:u,editable:d=!1})=>{const f=()=>{if(o)switch(o.type){case"emoji":return e.jsx(ve,{emoji:o.value,size:r,editable:d,onClick:s});case"icon":return e.jsx(we,{iconName:o.value,size:r,editable:d,onClick:s});case"image":return e.jsx(Se,{src:o.value,size:r,editable:d,onClick:s})}if(i){const m=u?Ce(u):"?";return e.jsx(ce,{text:m,size:r,editable:d,onClick:s})}return null};if(t)return e.jsx(ce,{size:r,loading:!0,className:a,style:c});const p=f();return p?e.jsx("div",{className:a,style:c,children:p}):null},ke=({label:o,onClick:r,isActive:t=!1})=>{const[s,a]=l.useState(!1);return e.jsx(n.Box,{onClick:r,bg:s||t?"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(n.Text,{fw:500,fz:"sm",truncate:"end",c:"var(--mantine-color-gray-9)",children:o})})},hn=new URL("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTUiIGhlaWdodD0iNTYiIHZpZXdCb3g9IjAgMCA1NSA1NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMC43NUg1NVY1NS43NUgwVjAuNzVaIiBmaWxsPSIjRjZGNUY0Ii8+CjxwYXRoIGQ9Ik04LjgwMDI5IDM0LjYzQzguODAwMjkgMzQuMTQ0IDkuMTk0MjggMzMuNzUgOS42ODAyOSAzMy43NUgxOC45MjAzQzE5LjQwNjMgMzMuNzUgMTkuODAwMyAzNC4xNDQgMTkuODAwMyAzNC42M1Y0My44N0MxOS44MDAzIDQ0LjM1NiAxOS40MDYzIDQ0Ljc1IDE4LjkyMDMgNDQuNzVIOS42ODAyOUM5LjE5NDI4IDQ0Ljc1IDguODAwMjkgNDQuMzU2IDguODAwMjkgNDMuODdWMzQuNjNaIiBmaWxsPSIjRkZDQTAwIi8+CjxwYXRoIGQ9Ik0yMi4wMDAyIDIzLjYzQzIyLjAwMDIgMjMuMTQ0IDIyLjM5NDIgMjIuNzUgMjIuODgwMiAyMi43NUgzMi4xMjAyQzMyLjYwNjMgMjIuNzUgMzMuMDAwMiAyMy4xNDQgMzMuMDAwMiAyMy42M1Y0My44N0MzMy4wMDAyIDQ0LjM1NiAzMi42MDYzIDQ0Ljc1IDMyLjEyMDIgNDQuNzVIMjIuODgwMkMyMi4zOTQyIDQ0Ljc1IDIyLjAwMDIgNDQuMzU2IDIyLjAwMDIgNDMuODdWMjMuNjNaIiBmaWxsPSIjMzdDRTkxIi8+CjxwYXRoIGQ9Ik0zNS4yMDAyIDEyLjYzQzM1LjIwMDIgMTIuMTQ0IDM1LjU5NDIgMTEuNzUgMzYuMDgwMiAxMS43NUg0NS4zMjAyQzQ1LjgwNjIgMTEuNzUgNDYuMjAwMiAxMi4xNDQgNDYuMjAwMiAxMi42M1Y0My44N0M0Ni4yMDAyIDQ0LjM1NiA0NS44MDYyIDQ0Ljc1IDQ1LjMyMDIgNDQuNzVIMzYuMDgwMkMzNS41OTQyIDQ0Ljc1IDM1LjIwMDIgNDQuMzU2IDM1LjIwMDIgNDMuODdWMTIuNjNaIiBmaWxsPSIjRkIzNzU3Ii8+CjxwYXRoIGQ9Ik04LjgwMDA1IDE3LjI1QzguODAwMDUgMTQuMjEyNCAxMS4yNjI1IDExLjc1IDE0LjMgMTEuNzVDMTcuMzM3NiAxMS43NSAxOS44IDE0LjIxMjQgMTkuOCAxNy4yNUMxOS44IDIwLjI4NzYgMTcuMzM3NiAyMi43NSAxNC4zIDIyLjc1QzExLjI2MjUgMjIuNzUgOC44MDAwNSAyMC4yODc2IDguODAwMDUgMTcuMjVaIiBmaWxsPSIjMDA3MkZGIi8+Cjwvc3ZnPgo=",self.location).href,Me=({appName:o="Obeyaka",size:r="md",showText:t=!0,color:s="var(--mantine-color-dark-6)",radius:a})=>{const c=()=>{switch(r){case"xs":return{icon:20,text:"xs"};case"sm":return{icon:28,text:"md"};case"md":return{icon:36,text:"lg"};case"lg":return{icon:44,text:"xl"};default:return{icon:36,text:"lg"}}},i=()=>{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:u,text:d}=c(),f=()=>{const p=u*56/55;return e.jsx("img",{src:hn,alt:`${o} Logo`,width:u,height:p,style:{display:"block",flexShrink:0,borderRadius:i()}})};return e.jsxs(n.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[f(),t&&e.jsx(n.Text,{size:d,fw:700,c:s==="white"?"white":s,style:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, sans-serif"},children:o})]})},xn=({value:o,label:r,onChange:t,placeholder:s="Click to edit...",disabled:a=!1,bgColor:c="gray",size:i="md",radius:u="sm",className:d="",style:f,showEditBorder:p=!0,editBorderColor:m="#228be6",selectOnFocus:I=!1,...b})=>{const[v,g]=l.useState(!1),[x,j]=l.useState(o),y=l.useRef(null);l.useEffect(()=>{j(o)},[o]);const C=()=>{a||(g(!0),I&&y.current&&y.current.select())},k=()=>{g(!1),x!==o&&t(x)},O=D=>{j(D.target.value)},T=D=>{var P,R;D.key==="Enter"?(g(!1),t(x),(P=y.current)==null||P.blur()):D.key==="Escape"&&(j(o),g(!1),(R=y.current)==null||R.blur())},M={cursor:a?"not-allowed":"text"},h={backgroundColor:c==="gray"?"var(--mantine-color-gray-0)":c==="white"?"var(--mantine-color-white)":void 0,borderColor:v&&p?m:void 0,borderWidth:v&&p?"2px":void 0,transition:"border-color 0.2s ease-in-out, border-width 0.2s ease-in-out",color:"var(--mantine-color-gray-9)"};return e.jsx(n.InputWrapper,{label:r,c:"var(--mantine-color-gray-6)",size:i,children:e.jsx(n.Input,{ref:y,value:x,onChange:O,onFocus:C,onBlur:k,onKeyDown:T,placeholder:s,disabled:a,size:i,fw:500,radius:u,className:d,style:{...M,...f},styles:{input:{...h}},...b})})},Oe=({expandDirection:o="right",placeholder:r="Type to search",value:t="",onChange:s,onSearch:a,onClear:c,size:i="md",disabled:u=!1,className:d})=>{const[f,p]=l.useState(!1),[m,I]=l.useState(!1),[b,v]=l.useState(t),g=l.useRef(null),x=l.useRef(null);l.useEffect(()=>{v(t)},[t]),l.useEffect(()=>{f&&g.current&&g.current.focus()},[f]),l.useEffect(()=>{const h=D=>{x.current&&!x.current.contains(D.target)&&j()};if(f)return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[f]);const j=()=>{I(!0),setTimeout(()=>{p(!1),I(!1)},200)},y=()=>{u||p(!0)},C=h=>{const D=h.target.value;v(D),s==null||s(D)},k=h=>{h.key==="Enter"&&(a==null||a(b)),h.key==="Escape"&&j()},O=()=>{v(""),s==null||s(""),c==null||c(),j()},M=(()=>{switch(i){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(n.Box,{ref:x,className:d,style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[e.jsxs(n.Group,{gap:0,style:{position:"relative",transition:"all 0.2s ease",borderRadius:"var(--mantine-radius-md)"},children:[e.jsx(n.Box,{onClick:y,style:{display:"flex",alignItems:"center",justifyContent:"center",width:M.inputHeight,height:M.inputHeight,cursor:u?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",opacity:u?.5:1},onMouseEnter:h=>{u||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent"},children:e.jsx(w.IconSearch,{size:M.iconSize,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),f&&e.jsx(n.TextInput,{ref:g,value:b,onChange:C,onKeyDown:k,placeholder:r,disabled:u,height:M.inputHeight,fw:500,styles:{root:{position:"relative",animation:m?`shrink${o==="right"?"Right":"Left"} 0.2s ease forwards`:`expand${o==="right"?"Right":"Left"} 0.2s ease forwards`},input:{border:"none",outline:"none",backgroundColor:"transparent",padding:"0 8px",height:M.inputHeight,minHeight:M.inputHeight,fontSize:M.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:b&&e.jsx(n.Box,{onClick:O,style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"4px",borderRadius:"var(--mantine-radius-xl)",transition:"background-color 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)"},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent"},children:e.jsx(w.IconX,{size:14,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),rightSectionWidth:b?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
- `})]})},ue=({activeFilters:o,onFiltersChange:r,availableFilters:t,size:s="md",filterButtonDropdownPosition:a="bottom-end"})=>{const c=n.useCombobox({onDropdownClose:()=>c.resetSelectedOption(),onDropdownOpen:()=>c.updateSelectedOptionIndex("active")}),[i,u]=l.useState(!1),d=o.length>0,f=x=>{if(x==="remove-filters")r([]);else{const g=t==null?void 0:t.find(v=>v.value===x);if(g){const v={id:`${g.value}-${Date.now()}`,filterOption:g};r([...o,v])}}c.closeDropdown()},I=(t||[]).filter(x=>!o.some(g=>g.filterOption.value===x.value)),y={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},b=(()=>{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}}})(),j=e.jsx(n.Box,{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:d||i?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",transition:"all 0.2s ease",...b},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:()=>c.toggleDropdown(),children:e.jsx(w.IconFilter,{size:20,stroke:2.3})});return e.jsxs(n.Combobox,{store:c,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,children:[e.jsx(n.Combobox.Target,{children:d?e.jsx(n.Indicator,{offset:2,position:"top-end",color:"var(--mantine-color-yellow-7)",children:j}):j}),e.jsx(n.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(n.Combobox.Options,{children:[I.map(x=>e.jsx(n.Combobox.Option,{value:x.value,style:{...y},children:e.jsxs(n.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[x.icon,x.label]})},x.value)),d&&e.jsx(n.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(n.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(w.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},hn=({filterTag:o,onUpdate:r,onRemove:t,options:s=[],filterTagDropdownPosition:a="bottom-start"})=>{var h;const c=n.useCombobox({onDropdownClose:()=>c.resetSelectedOption(),onDropdownOpen:()=>c.updateSelectedOptionIndex("active")}),i=!!o.selectedOption,u=i?`${o.filterOption.label}: ${(h=o.selectedOption)==null?void 0:h.label}`:o.filterOption.label,d=s&&s.length>0?s:[{value:"option-a",label:"TagFilterOptionA"},{value:"option-b",label:"TagFilterOptionB"},{value:"option-c",label:"TagFilterOptionC"}],f=b=>{if(b==="remove")t();else{const j=d.find(x=>x.value===b);j&&r({...o,selectedOption:j})}c.closeDropdown()},I={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},y={display:"inline-flex",alignItems:"center",gap:"4px",backgroundColor:i?"var(--mantine-color-blue-0)":"var(--mantine-color-gray-0)",color:i?"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(n.Combobox,{store:c,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,middlewares:{flip:!1,shift:!0},children:[e.jsx(n.Combobox.Target,{children:e.jsxs(n.Box,{style:{...y},onClick:()=>c.toggleDropdown(),fw:500,pl:"sm",children:[e.jsxs(n.Box,{style:{display:"flex",alignItems:"center",gap:"4px"},children:[o.filterOption.icon,u]}),e.jsx(w.IconChevronDown,{size:16,strokeWidth:2,color:"var(--mantine-color-gray-5)"})]})}),e.jsx(n.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(n.Combobox.Options,{children:[d.map(b=>{var j;return e.jsx(n.Combobox.Option,{value:b.value,active:((j=o.selectedOption)==null?void 0:j.value)===b.value,style:{...I},children:b.label},b.value)}),e.jsx(n.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"})]})})]})},gn=({activeFilters:o,onFiltersChange:r,availableFilters:t,addFilterButtonDropdownPosition:s="bottom-start"})=>{const a=n.useCombobox({onDropdownClose:()=>a.resetSelectedOption(),onDropdownOpen:()=>a.updateSelectedOptionIndex("active")}),[c,i]=l.useState(!1),u=h=>{const b=t==null?void 0:t.find(j=>j.value===h);if(b){const j={id:`${b.value}-${Date.now()}`,filterOption:b};r([...o,j])}a.closeDropdown()},d=(t||[]).filter(h=>!o.some(b=>b.filterOption.value===h.value)),f={display:"inline-flex",alignItems:"center",backgroundColor:c?"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"},I={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"}},y={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"};return e.jsxs(n.Combobox,{store:a,onOptionSubmit:u,withinPortal:!1,offset:4,position:s,children:[e.jsx(n.Combobox.Target,{children:e.jsx(n.Box,{style:{...f},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:()=>a.toggleDropdown(),children:e.jsx(n.Box,{style:{fontWeight:"500",color:"var(--mantine-color-blue-6)"},children:"Add filter"})})}),e.jsx(n.Combobox.Dropdown,{styles:{...I},children:e.jsx(n.Combobox.Options,{children:d.map(h=>e.jsx(n.Combobox.Option,{value:h.value,style:{...y},children:e.jsxs(n.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[h.icon,h.label]})},h.value))})})]})},fe=({activeFilters:o,onFiltersChange:r,availableFilters:t,size:s="sm",getFilterOptions:a,filterTagDropdownPosition:c="bottom-start"})=>{const i=f=>{const I=(o||[]).map(y=>y.id===f.id?f:y);r(I)},u=f=>{const I=(o||[]).filter(y=>y.id!==f);r(I)},d=(t||[]).filter(f=>!o.some(I=>I.filterOption.value===f.value));return!o||o.length===0?null:e.jsx("div",{style:{width:"100%"},children:e.jsxs(n.Group,{gap:"sm",align:"center",wrap:"wrap",children:[(o||[]).map(f=>{const I=a?a(f.filterOption.value)||[]:[];return e.jsx(hn,{filterTag:f,onUpdate:i,onRemove:()=>u(f.id),size:s,options:I,filterTagDropdownPosition:c},f.id)}),d.length>0&&e.jsx(gn,{activeFilters:o,onFiltersChange:r,availableFilters:d,size:s})]})})},xn=({activeFilters:o,onFiltersChange:r,availableFilters:t,size:s="md",getFilterOptions:a,filterTagDropdownPosition:c="bottom-start"})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsx(ue,{activeFilters:o,onFiltersChange:r,availableFilters:t,size:s}),e.jsx(fe,{activeFilters:o,onFiltersChange:r,availableFilters:t,size:"sm",getFilterOptions:a,filterTagDropdownPosition:c})]}),mn=Object.assign(xn,{Button:ue,Filters:fe}),yn=({children:o,danger:r,active:t,...s})=>e.jsx(n.MenuItem,{...s,style:{borderRadius:"8px",color:t?"var(--mantine-color-blue-7)":r?"var(--mantine-color-red-9)":"var(--mantine-color-gray-9)",backgroundColor:t?"var(--mantine-color-blue-0)":"transparent",...s.style},children:o}),ne=({trigger:o,menuItems:r,children:t,...s})=>{const a=l.useRef(null),[c,i]=l.useState(0);return l.useEffect(()=>{a.current&&i(a.current.offsetWidth)},[o]),e.jsxs(n.Menu,{...s,children:[e.jsx(n.Menu.Target,{children:e.jsx("div",{ref:a,onClick:u=>u.stopPropagation(),style:{cursor:"pointer",outline:"none",boxShadow:"none",display:"flex",alignItems:"center"},children:o})}),e.jsxs(n.Menu.Dropdown,{styles:{dropdown:{cursor:"pointer",borderRadius:"8px",minWidth:`${c}px`}},children:[t,r==null?void 0:r.map((u,d)=>e.jsx(yn,{...u},d))]})]})},Ie=({label:o,icon:r,onClick:t,color:s="gray",disabled:a=!1,"aria-label":c,indicator:i,fullWidth:u,isActive:d=!1,...f})=>{const[I,y]=l.useState(!1),h=()=>{a||t==null||t()};return e.jsx(n.Box,{style:{cursor:a?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},variant:"transparent",justify:"flex-start",display:"flex",color:s,radius:"md",w:u?"100%":"auto",px:6,h:40,onMouseEnter:()=>!a&&y(!0),onMouseLeave:()=>y(!1),onClick:h,bg:I||d?"gray.1":"transparent","aria-label":c||`${o} navigation button`,...f,children:e.jsxs(n.Group,{w:"100%",wrap:"nowrap",gap:8,justify:"left",align:"center",children:[r,e.jsx(n.Text,{ta:"left",size:"sm",fw:500,c:I?"gray.8":"gray.7",truncate:!0,style:{flex:1,opacity:a?.5:1},children:o}),i&&e.jsx(n.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:i})]})})},vn=({label:o,rightLabel:r,children:t,onAddChild:s,onMenuAction:a,menuItems:c,color:i="gray",defaultText:u="No items",level:d=0,disabled:f=!1,noChild:I=!1,isActive:y=!1,showAvatar:h=!1,avatar:b,placeholder:j,onClick:x,"aria-label":g,...v})=>{const[m,C]=l.useState(!1),[k,O]=l.useState(!1),[T,M]=l.useState(!1),p=l.Children.count(t)>0,D=T?w.IconChevronDown:w.IconChevronRight,P=!I&&p&&(h?k:!0),R=l.useCallback(L=>{f||(console.log("NavLink clicked",{hasChildren:p,noChild:I,isExpanded:m}),p&&!I&&(console.log("Toggling expansion"),C(!m)),x==null||x())},[x,f,p,I,m]),B=l.useCallback(L=>{L.stopPropagation(),!f&&(s==null||s())},[s,f]),F=l.useCallback(()=>{f||(p&&!I&&C(!m),x==null||x())},[f,p,I,m,x]),Q=l.useCallback(()=>{f||s==null||s()},[s,f]),V=l.useCallback(L=>{f||a==null||a(L)},[a,f,o]),U=l.useCallback(()=>p?l.Children.map(t,L=>l.isValidElement(L)?l.cloneElement(L,{...L.props,level:d+1}):L):null,[t,p,d]),Y=(c==null?void 0:c.map(L=>({children:e.jsxs(n.Group,{gap:"xs",wrap:"nowrap",children:[L.icon&&e.jsx(L.icon,{size:16}),e.jsx(n.Text,{size:"sm",children:L.label})]}),onClick:()=>V(L.action)})))||[],K=[{children:e.jsxs(n.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(w.IconPlus,{size:16}),e.jsx(n.Text,{size:"sm",children:"Add child"})]}),onClick:B}],J=Y.length>0?Y:K;return e.jsxs(n.Stack,{gap:0,children:[e.jsx(n.Box,{style:{cursor:f?"not-allowed":"pointer",borderRadius:"8px"},variant:"transparent",justify:"space-between",display:"flex",color:i,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!f&&O(!0),onMouseLeave:()=>O(!1),onClick:R,bg:y||k?"var(--mantine-color-gray-1)":"transparent","aria-expanded":m,"aria-label":g||`${o} navigation link`,...v,children:e.jsxs(n.Group,{w:"100%",wrap:"nowrap",gap:8,onClick:R,style:{paddingLeft:I&&!P?`${(d+1)*16}px`:d>0?`${d*16}px`:"0px"},children:[P?e.jsx(H,{icon:D,size:"md",color:i,onClick:F,disabled:f,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),"aria-label":p?`${m?"Collapse":"Expand"} ${o}`:void 0}):h?e.jsx(Z,{size:"xs",avatar:b,showPlaceholder:!0,placeholder:j}):null,e.jsx(n.Text,{size:"sm",fw:500,c:y?"black":k?"gray.9":"gray.8",truncate:!0,w:"100%",style:{opacity:f?.5:1},children:o}),e.jsxs(n.Group,{gap:"xs",align:"center",children:[r&&e.jsx(n.Text,{size:"xs",c:"dimmed",children:r}),k&&!f&&e.jsxs(n.Group,{gap:4,wrap:"nowrap",children:[s&&e.jsx(H,{icon:w.IconPlus,onClick:Q,"aria-label":`Add child to ${o}`}),(c&&c.length>0||s)&&e.jsx("div",{onClick:L=>L.stopPropagation(),children:e.jsx(ne,{menuItems:J,trigger:e.jsx(H,{icon:w.IconDots,"aria-label":`More options for ${o}`,size:"md"}),position:"bottom-end",shadow:"md"})})]})]})]})}),m&&!I&&e.jsx(n.Stack,{gap:0,style:{width:"100%"},children:p?U():e.jsx(n.Box,{style:{marginLeft:d>0?`${d*16}px`:"0px"},children:e.jsx(n.Text,{size:"sm",c:"dimmed",ta:"left",p:"sm",fw:500,children:u})})})]})},jn="200px",bn="4px 8px",wn=40,Sn="var(--mantine-radius-md)",Cn=16,Oe=({item:o,withAvatars:r,disabled:t=!1,onClick:s,selected:a=!1})=>{const[c,i]=l.useState(!1);return e.jsx(n.Box,{onMouseEnter:()=>!t&&i(!0),onMouseLeave:()=>!t&&i(!1),onClick:u=>{u.preventDefault(),u.stopPropagation(),t||s==null||s(o.value)},onMouseDown:u=>{u.stopPropagation()},style:{minWidth:jn,backgroundColor:t?"transparent":c?"var(--mantine-color-gray-1)":"transparent",cursor:t?"default":"pointer",borderRadius:Sn,padding:bn,transition:"background-color 0.2s ease",opacity:t?.5:1},children:e.jsxs(n.Group,{gap:"sm",wrap:"nowrap",align:"flex-start",style:{alignItems:"center"},h:wn,children:[r&&o.avatar&&e.jsx("img",{src:o.avatar,alt:o.label,style:{width:"24px",height:"24px",borderRadius:"var(--mantine-radius-sm)",objectFit:"cover"}}),e.jsxs(n.Stack,{gap:0,style:{flex:1},children:[e.jsx(n.Text,{size:"sm",fw:500,lh:-1,c:t?"var(--mantine-color-gray-5)":"var(--mantine-color-gray-9)",children:o.label}),e.jsx(n.Text,{size:"xs",c:t?"var(--mantine-color-gray-4)":"dimmed",children:o.description})]}),a&&e.jsx(w.IconCheck,{size:Cn,color:"var(--mantine-color-gray-9)"})]})})},kn="bottom-end",Mn=1e4,On="24px",Tn="0 8px",zn="6px",ge="var(--mantine-radius-md)",Dn="46px",ce=({value:o,onChange:r,data:t,withRemove:s=!1,withAvatars:a=!1,onRemove:c,disabledOptions:i=[],disabled:u=!1,defaultOption:d,popoverStyles:f,dropdownStyles:I,triggerStyles:y,textStyles:h})=>{const[b,j]=l.useState(!1),x=(t||[]).find(p=>p.value===o)||d,[g,v]=l.useState(!1),[m,C]=l.useState(!1),[k,O]=l.useState(!1),T=s?e.jsx(n.Group,{p:"sm",onClick:p=>{p.stopPropagation(),c==null||c(o)},style:{cursor:"pointer",height:Dn,display:"flex",alignItems:"center",borderRadius:ge,backgroundColor:m?"var(--mantine-color-red-0)":"transparent",transition:"background-color 0.2s ease"},onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:e.jsx(n.Text,{size:"sm",c:"var(--mantine-color-red-6)",fw:500,children:"Remove user"})}):null,M=e.jsxs(n.Box,{onMouseEnter:()=>!u&&v(!0),onMouseLeave:()=>!u&&v(!1),onClick:()=>{u||(j(!0),O(!0))},style:{height:On,cursor:u?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:ge,backgroundColor:u?"transparent":g||k?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:Tn,gap:zn,width:"auto",opacity:u?.6:1,...y},children:[e.jsx(n.Text,{size:"sm",fw:h!=null&&h.fontWeight?void 0:500,c:u?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",style:{color:u?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",lineHeight:"24px",whiteSpace:"nowrap",...h},children:(x==null?void 0:x.label)||"Select option"}),e.jsx(w.IconChevronDown,{size:16,style:{color:u?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(n.Popover,{opened:b,onChange:p=>{j(p),p||O(!1)},position:kn,shadow:"md",withinPortal:!0,zIndex:Mn,styles:f,children:[e.jsx(n.Popover.Target,{children:M}),e.jsx(n.Popover.Dropdown,{onClick:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",padding:"4px",...I}},children:e.jsxs(n.Stack,{gap:0,onClick:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),children:[(t||[]).map(p=>{const D=i.includes(p.value),P=p.value===o;return e.jsx(Oe,{item:p,withAvatars:a,disabled:D,selected:P,onClick:R=>{r==null||r(R),j(!1),O(!1)}},p.value)}),T]})})]})},Rn=(o,r,t,s)=>{const a=l.useRef(null),c=l.useRef(null),i=l.useCallback(d=>{d[0].isIntersecting&&t&&!s&&r&&r()},[t,s,r]),u=l.useCallback(()=>{if(!(!a.current||!o||!r)){c.current&&(c.current.disconnect(),c.current=null);try{const d=new IntersectionObserver(i,{threshold:.1,rootMargin:"50px"});d.observe(a.current),c.current=d}catch(d){console.error("Failed to setup intersection observer:",d)}}},[o,r,i]);return l.useEffect(()=>(u(),()=>{c.current&&(c.current.disconnect(),c.current=null)}),[u]),l.useEffect(()=>()=>{c.current&&(c.current.disconnect(),c.current=null)},[]),{loadMoreRef:a}},Te=({tableName:o,data:r,columns:t,onAddItem:s,addItemComponent:a,addItemLabel:c="Add item",loading:i=!1,emptyMessage:u="No data found",searchPlaceholder:d="Search...",enableAutoFilters:f=!0,customFilters:I=[],onCustomFilter:y,onSort:h,sortColumn:b,sortDirection:j,onSearch:x,onRowClick:g,size:v="md",striped:m=!1,highlightOnHover:C=!0,enableInfiniteScroll:k=!1,isLoadingMore:O=!1,hasMore:T=!1,onLoadMore:M})=>{const[p,D]=l.useState(""),[P,R]=l.useState([]),{loadMoreRef:B}=Rn(k,M||(()=>{}),T,O),F=l.useMemo(()=>[...f?t.filter(z=>z.type==="select"&&z.options).map(z=>({value:z.key,label:z.label})):[],...I],[t,f,I]),Q=l.useMemo(()=>{let S=r||[];if(p){const z=p.toLowerCase();S=S.filter(E=>t.some(A=>{if(!A.searchable)return!1;const W=E[A.key];return W==null?!1:String(W).toLowerCase().includes(z)}))}return P.forEach(z=>{if(z.filterTag.selectedOption){const E=t.find(A=>A.key===z.filterTag.filterOption.value);E&&(S=S.filter(A=>{var q;const W=A[E.key];return String(W)===((q=z.filterTag.selectedOption)==null?void 0:q.value)}))}}),S},[r,p,P,t]),V=S=>{D(S),x==null||x(S)},U=S=>{const z=t.find(A=>A.key===S);if(!(z!=null&&z.sortable))return;const E=b===S&&j==="asc"?"desc":"asc";h==null||h(S,E)},Y=S=>{const z=t.find(E=>E.key===S);return(z==null?void 0:z.type)==="select"&&z.options?z.options.map(E=>({value:E.value,label:E.label})):(z==null?void 0:z.type)==="badge"?[...new Set(r.map(A=>A[z.key]).filter(Boolean))].map(A=>({value:String(A),label:String(A).charAt(0).toUpperCase()+String(A).slice(1)})):z?[...new Set(r.map(A=>A[z.key]).filter(Boolean))].map(A=>({value:String(A),label:String(A).charAt(0).toUpperCase()+String(A).slice(1)})):[]},K=(S,z)=>{var A,W,q,te,re;const E=z[S.key];switch(S.type){case"text":return e.jsx(n.Text,{size:"sm",c:E?void 0:"dimmed",children:E||"—"});case"date":if(!E)return e.jsx(n.Text,{size:"sm",c:"dimmed",children:"—"});const N=new Date(E),Qe=S.format?N.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):N.toLocaleDateString();return e.jsx(n.Text,{size:"sm",c:"dimmed",children:Qe});case"select":return S.options?e.jsx(ce,{value:E,data:S.options,placeholder:S.label,onChange:$=>{var se;return(se=S.onSelectChange)==null?void 0:se.call(S,$,z)},disabled:(A=S.disabled)==null?void 0:A.call(S,z)}):e.jsx(n.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Ve=((W=S.badgeColors)==null?void 0:W[E])||"gray";return e.jsx(n.Badge,{color:Ve,variant:"light",size:"sm",radius:"md",fw:600,children:E||"Unknown"});case"avatar":const qe=((q=S.fallbackText)==null?void 0:q.call(S,z))||String(E).charAt(0).toUpperCase();return e.jsx(Z,{avatar:E,size:"xs",placeholder:qe,showPlaceholder:!0});case"custom":return((te=S.render)==null?void 0:te.call(S,E,z))||e.jsx(n.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(re=S.actions)!=null&&re.length?e.jsxs(n.Menu,{shadow:"md",width:200,position:"bottom-end",styles:{dropdown:{borderRadius:"var(--mantine-radius-md)"}},children:[e.jsx(n.Menu.Target,{children:e.jsx(n.ActionIcon,{variant:"subtle",size:"md",color:"gray",radius:"md",children:e.jsx(w.IconDots,{size:16})})}),e.jsx(n.Menu.Dropdown,{children:S.actions.map(($,se)=>{var pe;return e.jsx(n.Menu.Item,{color:$.color,leftSection:$.icon,disabled:(pe=$.disabled)==null?void 0:pe.call($,z),onClick:()=>$.onClick(z),styles:{item:{borderRadius:"var(--mantine-radius-md)"}},children:$.label},se)})})]}):null;default:return e.jsx(n.Text,{size:"sm",c:"dimmed",children:"—"})}},J=S=>{var z;return(z=t.find(E=>E.key===S))!=null&&z.sortable?b===S?j==="asc"?e.jsx(w.IconChevronUp,{size:14}):e.jsx(w.IconChevronDown,{size:14}):e.jsx(w.IconChevronUp,{size:14,style:{opacity:.3}}):null},X=(()=>{switch(v){case"sm":return{buttonSize:"xs",textSize:"sm"};case"lg":return{buttonSize:"md",textSize:"md"};default:return{buttonSize:"sm",textSize:"sm"}}})();return e.jsxs(n.Box,{pos:"relative",children:[e.jsx(n.LoadingOverlay,{visible:i}),e.jsxs(n.Stack,{gap:"sm",w:"100%",children:[e.jsxs(n.Group,{gap:"sm",wrap:"nowrap",justify:"space-between",children:[e.jsx(n.Text,{fw:600,c:"var(--mantine-color-gray-8)",children:o}),e.jsxs(n.Group,{gap:"xs",wrap:"nowrap",children:[e.jsxs(n.Group,{gap:4,wrap:"nowrap",children:[e.jsx(Me,{placeholder:d,value:p,onChange:V,onSearch:V,expandDirection:"right",size:X.buttonSize}),F.length>0&&e.jsx(ue,{activeFilters:P.map(S=>S.filterTag),onFiltersChange:S=>{R(S.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),y==null||y(S)},availableFilters:F,size:X.buttonSize})]}),s&&e.jsx(n.Button,{size:"compact-md",h:32,style:{fontSize:`var(--mantine-font-size-${X.textSize})`,border:"none"},radius:"md",onClick:s,children:c})]})]}),F.length>0&&e.jsx(fe,{activeFilters:P.map(S=>S.filterTag),onFiltersChange:S=>{R(S.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),y==null||y(S)},availableFilters:F,size:"md",getFilterOptions:Y})]}),a,e.jsxs(n.Table,{striped:m,highlightOnHover:C,highlightOnHoverColor:"var(--mantine-color-gray-0)",mt:"xs",children:[e.jsx(n.Table.Thead,{children:e.jsx(n.Table.Tr,{children:t.map(S=>e.jsx(n.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:S.width,textAlign:S.align||"left",cursor:S.sortable?"pointer":"default"},onClick:()=>S.sortable&&U(S.key),children:e.jsxs(n.Group,{gap:"xs",wrap:"nowrap",children:[S.icon&&e.jsx(n.Box,{style:{display:"flex",alignItems:"center"},children:S.icon}),e.jsx(n.Text,{size:X.textSize,fw:500,children:S.label}),J(S.key)]})},String(S.key)))})}),e.jsx(n.Table.Tbody,{children:Q.length===0?e.jsx(n.Table.Tr,{children:e.jsx(n.Table.Td,{colSpan:t.length,ta:"center",py:"xl",children:e.jsx(n.Text,{c:"dimmed",children:u})})}):Q.map((S,z)=>e.jsx(n.Table.Tr,{style:{cursor:g?"pointer":"default"},onClick:()=>g==null?void 0:g(S),children:t.map(E=>e.jsx(n.Table.Td,{style:{textAlign:E.align||"left"},children:K(E,S)},String(E.key)))},S.id||z))})]}),k&&e.jsx(n.Box,{ref:B,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:O&&e.jsxs(n.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(n.Loader,{size:"sm",color:"gray.5"}),e.jsx(n.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more..."})]})})]})};Object.assign(Te,{});const Bn=({onAvatarSelect:o,onEmojiSelect:r,onImageSelect:t,onIconSelect:s}={})=>{const[a,c]=l.useState("emoji"),[i,u]=l.useState(null),[d,f]=l.useState(null),[I,y]=l.useState(null),[h,b]=l.useState(null),[j,x]=l.useState(null),g=l.useCallback(p=>{c(p)},[]),v=l.useCallback(p=>{u(p)},[]),m=l.useCallback(p=>{x(p);const D=new FileReader;D.onload=P=>{var B;const R=(B=P.target)==null?void 0:B.result;f(R)},D.readAsDataURL(p)},[]),C=l.useCallback(p=>{y(p),f(null),x(null),b(null),o==null||o({type:"emoji",value:p}),r==null||r(p)},[o,r]),k=l.useCallback(p=>{b(p),f(null),x(null),y(null),o==null||o({type:"icon",value:p}),s==null||s(p)},[o,s]),O=l.useCallback(()=>{if(j&&d){const p=URL.createObjectURL(j);o==null||o({type:"image",value:p}),t==null||t(j)}},[j,d,o,t]),T=l.useCallback(()=>{f(null),x(null),y(null),b(null)},[]),M=l.useCallback(()=>{f(null),y(null),b(null),x(null),c("emoji"),u(null)},[]);return{selectedTab:a,tabHovered:i,previewImage:d,selectedEmoji:I,selectedIcon:h,selectedFile:j,handleTabChange:g,handleTabHover:v,handleImagePreview:m,handleImageAccept:O,handleEmojiSelect:C,handleIconSelect:k,clearImagePreview:T,resetState:M}},Pn=({opened:o,onClose:r,popoverRef:t})=>{const s=l.useCallback(c=>{o&&t.current&&!t.current.contains(c.target)&&(console.log("Click outside detected, closing popover"),r())},[o,r,t]),a=l.useCallback(c=>{c.key==="Escape"&&o&&(console.log("Escape key pressed, closing popover"),r())},[o,r]);return l.useEffect(()=>{if(o)return document.addEventListener("mousedown",s),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",a)}},[o,s,a]),{handleClickOutside:s,handleEscape:a}},En=({selectedTab:o,tabHovered:r,onTabChange:t,onTabHover:s,onRemove:a,hasAvatar:c=!1,children:i})=>{const[u,d]=l.useState(!1);return e.jsxs(n.Tabs,{color:"black",value:o,styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(n.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",w:"100%",children:[e.jsx(n.Tabs.Tab,{value:"emoji",p:0,pb:"xs",onClick:()=>t("emoji"),onMouseEnter:()=>s("emoji"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(n.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:o==="emoji"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(n.Group,{gap:4,children:"Emoji"})})}),e.jsx(n.Tabs.Tab,{value:"icons",p:0,pb:"xs",onClick:()=>t("icons"),onMouseEnter:()=>s("icons"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(n.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:o==="icons"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(n.Group,{gap:4,children:"Icons"})})}),e.jsx(n.Tabs.Tab,{value:"image",p:0,pb:"xs",onClick:()=>t("image"),onMouseEnter:()=>s("image"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(n.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:o==="image"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(n.Group,{gap:4,children:"Image"})})}),a&&c&&e.jsx(n.Group,{justify:"flex-end",display:"flex",flex:1,pb:"xs",children:e.jsx(n.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:u?"var(--mantine-color-red-0)":"transparent",color:u?"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:()=>d(!0),onMouseLeave:()=>d(!1),children:"Remove"})})]}),e.jsx(n.Tabs.Panel,{value:"emoji",children:o==="emoji"?i:null}),e.jsx(n.Tabs.Panel,{value:"icons",children:o==="icons"?i:null}),e.jsx(n.Tabs.Panel,{value:"image",children:o==="image"?i:null})]})};let xe=!1;xe||(me.init({data:ae}),xe=!0);const An=()=>{const o=[{id:"frequent",name:"Frequently Used",icon:e.jsx(w.IconClock,{size:20,strokeWidth:2.5})}];return ae.categories.forEach(r=>{if(r.emojis&&r.emojis.length>0){let t=e.jsx(w.IconMoodSmile,{size:20,strokeWidth:2}),s=r.name;switch(r.id){case"people":t=e.jsx(w.IconMoodSmile,{size:20,strokeWidth:2}),s="Smileys & People";break;case"nature":t=e.jsx(w.IconTrees,{size:20,strokeWidth:2}),s="Animals & Nature";break;case"foods":t=e.jsx(w.IconApple,{size:20,strokeWidth:2}),s="Food & Drink";break;case"activity":t=e.jsx(w.IconBallBasketball,{size:20,strokeWidth:2}),s="Activities";break;case"travel":t=e.jsx(w.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"places":t=e.jsx(w.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"objects":t=e.jsx(w.IconBulb,{size:20,strokeWidth:2}),s="Objects";break;case"symbols":t=e.jsx(w.IconHeart,{size:20,strokeWidth:2}),s="Symbols";break;case"flags":t=e.jsx(w.IconFlag,{size:20,strokeWidth:2}),s="Flags";break;case"frequent":return;default:t=e.jsx(w.IconMoodSmile,{size:20,strokeWidth:2}),s=`Category: ${r.id}`;break}o.push({id:r.id,name:s,icon:t})}}),o},Fn=({onEmojiSelect:o,height:r=200})=>{const[t,s]=l.useState(""),[a,c]=l.useState("people"),[i,u]=l.useState(()=>{if(typeof window<"u"){const g=localStorage.getItem("emoji-frequent");return g?JSON.parse(g):[]}return[]}),[d,f]=l.useState([]),[I,y]=l.useState(!1),h=An();l.useEffect(()=>{t.trim()?(y(!0),me.SearchIndex.search(t).then(g=>{f(g.map(v=>({id:v.id,native:v.skins[0].native,name:v.name,keywords:v.keywords}))),y(!1)})):f([])},[t]);const b=l.useMemo(()=>{if(t.trim())return d;if(a==="frequent")return i.map(v=>({id:v,native:v,name:"",keywords:[]}));const g=ae.categories.find(v=>v.id===a);return g?g.emojis.map(v=>{const m=ae.emojis[v];return{id:m.id,native:m.skins[0].native,name:m.name,keywords:m.keywords}}):[]},[t,a,i,d]),j=g=>{o(g),u(v=>{const m=v.filter(k=>k!==g),C=[g,...m].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(C)),C})},x=g=>{if(t.trim())return"Results";const v=h.find(m=>m.id===g);return v?v.name:g.charAt(0).toUpperCase()+g.slice(1)};return e.jsxs(n.Stack,{gap:0,style:{height:r,width:"100%"},children:[e.jsx(n.Box,{p:"sm",pb:"xs",children:e.jsxs(n.Stack,{gap:"xs",children:[e.jsx(n.TextInput,{placeholder:"Search emojis...",value:t,onChange:g=>s(g.target.value),leftSection:e.jsx(w.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(n.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:x(a)})]})}),e.jsx(n.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(n.ScrollArea,{h:"100%",type:"hover",offsetScrollbars:!1,children:e.jsx(n.Box,{style:{display:"grid",gridTemplateColumns:"repeat(9, 1fr)",gap:"0px",padding:"0px 12px 12px 12px"},children:I?e.jsx(n.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"Searching..."}):b.length>0?b.map(g=>e.jsx(n.Tooltip,{label:g.name||g.id,position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(n.Button,{variant:"subtle",size:"sm",p:0,onClick:()=>j(g.native),style:{width:"40px",height:"40px",fontSize:"22px",border:"none",backgroundColor:"transparent",borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:g.native})},g.id)):e.jsx(n.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"No emojis found"})})})}),e.jsx(n.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(n.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:h.map(g=>e.jsx(n.Tooltip,{label:g.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(n.Box,{onClick:()=>{c(g.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===g.id?"var(--mantine-color-gray-0)":"transparent",color:a===g.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.1s ease"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:g.icon})},g.id))})})]})},ze=["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"],De=["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"],Re=["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"],Be=["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"],Pe=["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"],Ee=["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"],Ae=["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"],Fe=["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"];[...ze,...De,...Re,...Be,...Pe,...Ee,...Ae,...Fe];const ee=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:ze},{id:"business",name:"Business & Work",icons:De},{id:"tech",name:"Technology",icons:Re},{id:"expressions",name:"Expressions",icons:Be},{id:"nature",name:"Nature & Animals",icons:Pe},{id:"shapes",name:"Shapes & Symbols",icons:Ee},{id:"actions",name:"Actions & Tools",icons:Ae},{id:"communication",name:"Communication",icons:Fe}],Ln={recent:e.jsx(w.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(w.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(w.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(w.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(w.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(w.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(w.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(w.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(w.IconMessage,{size:20,strokeWidth:2.5})},Hn=({selectedCategory:o,onCategoryChange:r})=>e.jsx(n.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:ee.map(t=>{const s=Ln[t.id];return e.jsx(n.Tooltip,{label:t.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(n.Box,{onClick:()=>r(t.id),style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",backgroundColor:o===t.id?"var(--mantine-color-gray-0)":"transparent",color:o===t.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=o===t.id?"var(--mantine-color-gray-0)":"transparent"},children:s})},t.id)})}),Le=l.memo(({onIconSelect:o,height:r=358})=>{var g,v;const[t,s]=l.useState(""),[a,c]=l.useState("recent"),[i,u]=l.useState(!1),[d,f]=l.useState([]);l.useLayoutEffect(()=>{if(typeof window<"u"){const m=localStorage.getItem("avatar-icon-recent");if(m)try{f(JSON.parse(m))}catch(C){console.warn("Error parsing recent icons from localStorage:",C)}}},[]);const I=l.useMemo(()=>ee.filter(m=>m.id!=="recent"&&!("isDynamic"in m)).flatMap(m=>m.icons),[]),y=l.useMemo(()=>{if(a==="recent"){const C=new Set(I);return d.filter(k=>C.has(k))}const m=ee.find(C=>C.id===a);return(m==null?void 0:m.icons)||[]},[a,d,I]),h=l.useCallback((m,C)=>{if(!m.trim())return C;const k=m.toLowerCase().trim(),O=k.split(/\s+/);return C.filter(T=>{const p=T.replace(/^Icon/,"").split(/(?=[A-Z])/).map(D=>D.toLowerCase().trim()).filter(D=>D.length>0);return!!(p.some(D=>O.some(P=>D===P))||k.length>2&&p.some(D=>O.some(P=>D.startsWith(P)))||k.length<=2&&p.some(D=>O.some(P=>D.includes(P)))||O.length>1&&O.every(D=>p.some(P=>P===D||P.startsWith(D))))})},[]),b=l.useMemo(()=>t.trim()?h(t,I):y,[t,y,I,h]),j=l.useCallback(m=>{I.includes(m)&&f(k=>{const O=[m,...k.filter(T=>T!==m)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(O)),O}),o(m)},[o,I]),x=l.useCallback(m=>{a!==m&&(s(""),c(m),requestAnimationFrame(()=>{u(!0),setTimeout(()=>u(!1),100)}))},[a]);return e.jsxs(n.Stack,{gap:0,style:{height:r,width:"100%"},children:[e.jsx(n.Box,{p:"sm",pb:"xs",children:e.jsxs(n.Stack,{gap:"xs",children:[e.jsx(n.TextInput,{placeholder:t.trim()?"Search all icons...":`Search in ${(g=ee.find(m=>m.id===a))==null?void 0:g.name}...`,value:t,onChange:m=>s(m.target.value),leftSection:e.jsx(w.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(n.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:t.trim()?"Results":(v=ee.find(m=>m.id===a))==null?void 0:v.name})]})}),e.jsx(n.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(n.ScrollArea,{h:"100%",type:"hover",children:e.jsx(n.Box,{style:{display:"grid",gridTemplateColumns:"repeat(8, 1fr)",gap:"4px",padding:"0 12px 12px 12px",opacity:i?.7:1,transition:"opacity 0.05s ease"},children:b.map(m=>e.jsx(ve,{iconName:m,onClick:()=>j(m),size:20},t.trim()?`search-${m}`:`${a}-${m}`))},`${a}-${t}`)})}),e.jsx(n.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(Hn,{selectedCategory:a,onCategoryChange:x})})]})});Le.displayName="IconGrid";const Un=({previewImage:o,fileInputRef:r,selectedEmoji:t,size:s,loading:a,onFileInputClick:c,onImageChange:i,onImageAccept:u,onClearImagePreview:d})=>e.jsx(n.Box,{p:"sm",style:{width:"384px"},children:e.jsxs(n.Stack,{gap:"md",align:"center",children:[o||t?e.jsxs(n.Box,{children:[e.jsx(n.Text,{size:"sm",fw:500,mb:"xs",children:"Preview"}),e.jsx(n.Avatar,{src:o,radius:"md",style:{width:`${_(s)}px !important`,height:`${_(s)}px !important`,minWidth:`${_(s)}px`,minHeight:`${_(s)}px`,maxWidth:`${_(s)}px`,maxHeight:`${_(s)}px`,border:"1px solid var(--mantine-color-gray-4)",objectFit:"cover",boxSizing:"border-box"},children:t})]}):e.jsx(n.Button,{variant:"subtle",bg:"gray.0",styles:{root:{height:"64px"}},leftSection:e.jsx(w.IconPhoto,{size:20}),onClick:c,loading:a,disabled:a,fullWidth:!0,children:"Choose Image"}),o||t?e.jsx(n.Button,{variant:"outline",leftSection:e.jsx(w.IconPhoto,{size:16}),onClick:c,loading:a,disabled:a,fullWidth:!0,children:o||t?"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 I;return i(((I=f.target.files)==null?void 0:I[0])||null)},style:{display:"none"},disabled:a}),(o||t)&&e.jsxs(n.Group,{gap:"sm",w:"100%",children:[e.jsx(n.Button,{variant:"outline",color:"gray",onClick:d,fullWidth:!0,children:"Back"}),e.jsx(n.Button,{color:"blue",onClick:u,loading:a,disabled:a,fullWidth:!0,children:"Accept"})]}),e.jsx(n.Text,{size:"xs",c:"var(--mantine-color-gray-6)",ta:"center",children:"Supported formats: JPG, PNG, GIF, WebP"})]})}),Nn=({onEmojiSelect:o})=>e.jsx(Fn,{onEmojiSelect:o,height:358}),Wn=({onIconSelect:o})=>e.jsx(Le,{onIconSelect:o,height:358}),$n=({previewImage:o,selectedEmoji:r,size:t,loading:s,onFileInputClick:a,onImageChange:c,onImageAccept:i,onClearImagePreview:u,fileInputRef:d})=>e.jsx(Un,{previewImage:o,fileInputRef:d,selectedEmoji:r,size:t,loading:s,onFileInputClick:a,onImageChange:c,onImageAccept:i,onClearImagePreview:u}),Gn=()=>e.jsx(n.Box,{style:{width:400,height:358,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs(n.Stack,{align:"center",gap:"sm",children:[e.jsx(n.Loader,{size:"sm"}),e.jsx(n.Text,{size:"sm",c:"gray.6",children:"Loading avatar options..."})]})}),Qn=({opened:o,onOpen:r,onClose:t,avatar:s,onAvatarSelect:a,onRemove:c,onEmojiSelect:i,onImageSelect:u,onIconSelect:d,size:f="lg",loading:I=!1,placeholder:y,showPlaceholder:h=!0,position:b="bottom-start",withinPortal:j=!0,zIndex:x=1e3})=>{const g=l.useRef(null),v=l.useRef(null),m=l.useRef(null),{selectedTab:C,tabHovered:k,previewImage:O,selectedEmoji:T,selectedIcon:M,selectedFile:p,handleTabChange:D,handleTabHover:P,handleImagePreview:R,handleImageAccept:B,handleEmojiSelect:F,handleIconSelect:Q,clearImagePreview:V,resetState:U}=Bn({onAvatarSelect:a,onEmojiSelect:i,onImageSelect:u,onIconSelect:d});Pn({opened:o,onClose:t,popoverRef:v}),l.useEffect(()=>{o||U()},[o,U]);const Y=N=>{console.log("Emoji clicked:",N),F(N),t()},K=N=>{console.log("Icon clicked:",N),Q(N),t()},J=N=>{N&&R(N)},L=()=>{p?(B(),t()):(T||M)&&t()},X=()=>{g.current&&g.current.click()},S=()=>{V()},z=()=>{console.log("Avatar removed"),c==null||c(),t()},E=()=>!!s,A=()=>I?e.jsx(ie,{size:f,loading:!0}):e.jsx(Z,{avatar:s,size:f,placeholder:y,showPlaceholder:h,editable:!0,onClick:()=>{!I&&!o&&r()}}),W=e.jsx(Nn,{onEmojiSelect:Y}),q=e.jsx(Wn,{onIconSelect:K}),te=e.jsx($n,{previewImage:O,selectedEmoji:T,size:f,loading:I,onFileInputClick:X,onImageChange:J,onImageAccept:L,onClearImagePreview:S,fileInputRef:g}),re=e.jsx(n.Box,{children:e.jsx(En,{selectedTab:C,tabHovered:k,onTabChange:D,onTabHover:P,onRemove:z,hasAvatar:E(),children:C==="emoji"?W:C==="icons"?q:te})});return e.jsx("div",{style:{position:"relative",display:"inline-block"},children:e.jsxs(n.Popover,{opened:o,onClose:()=>{console.log("Popover onClose called"),t()},position:b,withinPortal:j,withArrow:!0,shadow:"md",radius:"md",closeOnClickOutside:!1,closeOnEscape:!1,offset:8,transitionProps:{transition:"fade",duration:150},children:[e.jsx(n.Popover.Target,{children:e.jsx("div",{ref:m,style:{position:"relative"},children:A()})}),e.jsx(n.Popover.Dropdown,{ref:v,p:0,style:{width:"auto",overflow:"hidden",zIndex:x},children:e.jsx(l.Suspense,{fallback:e.jsx(Gn,{}),children:re})})]})})},Vn=o=>{if(!o||typeof o!="string")return!1;const r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return o.length<5||o.length>254?!1:r.test(o.trim())},qn=o=>{const r=[];return o.forEach(t=>{Vn(t)||r.push({email:t,error:"Please enter a valid email address"})}),{isValid:r.length===0,errors:r}},_n=o=>{const r=[],t=new Set;return o.forEach(s=>{const a=s.toLowerCase().trim();t.has(a)?r.push({email:s,error:"This email has already been added"}):t.add(a)}),r},Zn=o=>{const r=qn(o),t=_n(o),s=[...r.errors,...t];return{isValid:s.length===0,errors:s}},Yn=({value:o,onChange:r,onInputChange:t,suggestedUsers:s=[],tagDisplayMap:a={}})=>{const[c,i]=l.useState(""),[u,d]=l.useState([]),f=l.useRef(null),I=o.map(x=>{if(a[x])return a[x];const g=s.find(v=>v.email===x);return g&&g.name?g.name:x});l.useEffect(()=>{t&&t(c)},[c,t]),l.useEffect(()=>{if(o.length>0){const x=Zn(o);d(x.errors)}else d([])},[o]),l.useEffect(()=>{const x=f.current;if(!x)return;let g;const v=m=>{const k=m.target.value||"";clearTimeout(g),g=setTimeout(()=>{i(k)},150)};return x.addEventListener("input",v),()=>{x.removeEventListener("input",v),clearTimeout(g)}},[]);const y=l.useCallback(x=>{const g=s.map(m=>({name:m.name||m.email,email:m.email})),v=x.map(m=>{const C=g.find(k=>k.name.toLowerCase()===m.toLowerCase());return C?C.email:m}).filter(m=>m.includes("@")?!0:!g.some(k=>{const O=k.name.toLowerCase(),T=m.toLowerCase();return O.startsWith(T)&&T!==O}));r(v),i("")},[r,s]),h=l.useCallback(()=>{f.current&&(f.current.value="",i(""))},[]),b=u.length===0&&o.length>0,j=l.useCallback((x,g,v)=>{x&&o.length>0&&g&&(x(o,g,v),i(""))},[o]);return{inputText:c,tagsInputRef:f,displayValue:I,validationErrors:u,isValid:b,handleEmailChange:y,clearInput:h,handleInvite:j}},He=({onInvite:o,onUpdateRole:r,onRemoveUser:t,invitedUsers:s=[],suggestedUsers:a=[],roleOptions:c=[]})=>{const[i,u]=l.useState([]),[d,f]=l.useState([]),[I,y]=l.useState(""),[h,b]=l.useState({}),j=c.length>0?c[0].value:void 0,[x,g]=l.useState(j);l.useEffect(()=>{c.length>0&&!x&&g(c[0].value)},[c.length,x]),l.useEffect(()=>{const R=a.filter(B=>i.includes(B.email)).map(B=>B.id);f(B=>B.filter(F=>R.includes(F)))},[i,a.length]);const[v,m]=l.useState("invite"),[C,k]=l.useState(null),O=(R,B,F)=>{o&&o(R,B,F),u([]),y("")},T=(R,B)=>{r&&r(R,B)},M=R=>{t&&t(R)},p=R=>{f(B=>B.includes(R)?B.filter(F=>F!==R):[...B,R])},D=R=>{i.includes(R.email)||(u([...i,R.email]),b(B=>({...B,[R.email]:R.name||R.email})),d.includes(R.id)||f([...d,R.id]),y(""))},P=I.trim()?a.filter(R=>{var F;const B=I.toLowerCase();return R.email.toLowerCase().includes(B)||((F=R.name)==null?void 0:F.toLowerCase().includes(B))}):[];return{emails:i,setEmails:u,selectedUsers:d,setSelectedUsers:f,inputText:I,setInputText:y,tagDisplayMap:h,setTagDisplayMap:b,selectedRole:x,setSelectedRole:g,selectedTab:v,setSelectedTab:m,tabHovered:C,setTabHovered:k,filteredUsers:P,handleInvite:O,handleUpdateRole:T,handleRemoveUser:M,handleToggleUser:p,handleAddSuggestedUser:D}},Ue=l.forwardRef(({value:o,onChange:r,placeholder:t="Add one or more emails",onInvite:s,roleOptions:a=[],selectedRole:c,onRoleChange:i,onInputChange:u,suggestedUsers:d=[],tagDisplayMap:f={}},I)=>{const[y,h]=l.useState("Hello, I would like to invite you to join my workspace"),{tagsInputRef:b,displayValue:j,validationErrors:x,isValid:g,handleEmailChange:v,clearInput:m,handleInvite:C}=Yn({value:o,onChange:r,onInputChange:u,suggestedUsers:d,tagDisplayMap:f}),k=()=>{C(s,c,y),h("")};l.useImperativeHandle(I,()=>({clearInput:m}),[m]);const O=j.length>0,T=i&&a.length>0,M=x.length>0;return e.jsxs(n.Stack,{gap:"md",children:[e.jsxs(n.Box,{children:[e.jsx(n.Box,{style:{maxHeight:"120px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(n.TagsInput,{ref:b,value:j,onChange:v,placeholder:O?"":t,radius:"md",rightSection:T?e.jsx(n.Box,{style:{position:"absolute",right:"8px",top:"17px",transform:"translateY(-50%)",height:"24px",display:"flex",alignItems:"center"},children:e.jsx(ce,{value:c||"",onChange:p=>i(p),data:a,placeholder:"Select role",defaultOption:a[a.length-1],disabledOptions:["owner"]})}):null,rightSectionProps:{style:{width:T?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:T?"130px":"12px",minHeight:"36px",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",borderRadius:"var(--mantine-radius-md)",border:M?"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:M?"var(--mantine-color-red-1) !important":"var(--mantine-color-orange-1) !important",color:M?"var(--mantine-color-red-7) !important":"var(--mantine-color-gray-7) !important",fontSize:"var(--mantine-font-size-sm)"}}})}),M&&e.jsx(n.Stack,{gap:"xs",mt:"xs",children:x.map((p,D)=>e.jsxs(n.Text,{size:"xs",c:"red",children:[p.email,": ",p.error]},D))})]}),O&&e.jsxs(n.Stack,{gap:"sm",children:[e.jsx(n.Textarea,{size:"sm",value:y,onChange:p=>h(p.currentTarget.value),minRows:2,maxRows:4,radius:"md"}),e.jsx(n.Button,{variant:"filled",color:"blue",onClick:k,fullWidth:!0,radius:"md",disabled:!g,children:"Send invitations"})]})]})}),Xn=o=>{switch(o){case"member":return"green";case"invited":return"orange";case"declined":return"red";case"revoked":return"red";case"expired":return"red";default:return"gray"}},Kn=o=>{switch(o){case"member":return"Member";case"invited":return"Invited";case"declined":return"Declined";case"revoked":return"Revoked";case"expired":return"Expired";default:return"Unknown"}},Jn=o=>{if(o){if(typeof o=="object"&&"type"in o)return o;if(typeof o=="string")return{type:"image",value:o}}},oe=({user:o,isSelected:r=!1,onToggle:t,onUpdateRole:s,onRemoveUser:a,roleOptions:c=[],variant:i="invited",onClick:u})=>{var g;const d=((g=o.name)==null?void 0:g.trim())||o.email,f=()=>{t&&t(o.id)},I=v=>{if(s){const m=v;s(o.id,m)}},y=i==="suggested"||i==="read-only",h=i==="invited"&&c.length>0,[b,j]=l.useState(!1),x=()=>{u==null||u()};return e.jsxs(n.Group,{justify:"space-between",align:"center",wrap:"nowrap",w:"100%",style:{cursor:"pointer",borderRadius:"var(--mantine-radius-md)",padding:"6px"},onClick:x,bg:b?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),children:[e.jsxs(n.Group,{gap:"sm",w:"100%",align:"flex-start",wrap:"nowrap",children:[e.jsx(Z,{avatar:Jn(o.avatar),size:"md",placeholder:d,showPlaceholder:!0}),e.jsxs(n.Stack,{gap:0,w:"100%",justify:"flex-start",align:"flex-start",children:[e.jsxs(n.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsxs(n.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsx(n.Text,{size:"sm",fw:500,lineClamp:1,mb:-2,children:d}),o.isCurrentUser&&e.jsx(n.Badge,{size:"xs",variant:"light",color:"gray",radius:"sm",children:"Owner"})]}),o.status!=="member"&&e.jsx(n.Badge,{size:"xs",variant:"light",color:Xn(o.status),radius:"sm",children:Kn(o.status)})]}),e.jsx(n.Text,{size:"xs",c:"dimmed",lineClamp:1,children:o.email})]})]}),e.jsxs(n.Group,{gap:"sm",align:"center",children:[y&&i!=="read-only"&&e.jsx(n.Radio,{checked:r,onChange:f,size:"sm",onClick:v=>v.stopPropagation(),pr:4}),h&&!o.isCurrentUser&&e.jsx(ce,{value:o.role,onChange:I,data:c,placeholder:"Select role",defaultOption:c.find(v=>v.value===o.role),withRemove:!0,onRemove:()=>a==null?void 0:a(o.id)})]})]})},Ne=({opened:o,onClose:r,onInvite:t,onUpdateRole:s,onRemoveUser:a,invitedUsers:c=[],children:i,roleOptions:u=[],suggestedUsers:d=[]})=>{const f=l.useRef(null),{emails:I,setEmails:y,selectedUsers:h,inputText:b,setInputText:j,tagDisplayMap:x,selectedRole:g,setSelectedRole:v,selectedTab:m,setSelectedTab:C,tabHovered:k,setTabHovered:O,filteredUsers:T,handleInvite:M,handleUpdateRole:p,handleRemoveUser:D,handleToggleUser:P,handleAddSuggestedUser:R}=He({onInvite:t,onUpdateRole:s,onRemoveUser:a,invitedUsers:c,suggestedUsers:d,roleOptions:u}),B=U=>{R(U),f.current&&f.current.clearInput()},F=e.jsxs(e.Fragment,{children:[e.jsx(Ue,{ref:f,value:I,onChange:y,onInvite:M,roleOptions:u,selectedRole:g,onRoleChange:v,onInputChange:j,suggestedUsers:d,tagDisplayMap:x}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.ScrollArea,{mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(n.Box,{children:c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(n.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.Stack,{gap:"sm",children:c.map(U=>e.jsx(oe,{user:U,isSelected:h.includes(U.id),onToggle:P,onUpdateRole:p,onRemoveUser:D,roleOptions:u,variant:"invited"},U.id))})]})})}),T.length>0&&e.jsx(n.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(n.Box,{children:T.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(n.Text,{size:"sm",fw:500,children:["Suggested ",b.trim()&&`(filtered by "${b}")`]}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.Stack,{gap:"sm",children:T.map(U=>e.jsx(oe,{user:U,isSelected:h.includes(U.id),onToggle:P,onUpdateRole:p,onRemoveUser:D,roleOptions:u,variant:"suggested",onClick:()=>B(U)},U.id))})]}):null})})]}),Q=e.jsx(e.Fragment,{children:e.jsxs(n.Stack,{gap:"md",p:"sm",children:[e.jsxs(n.Stack,{gap:4,align:"center",children:[e.jsx(n.Text,{size:"sm",fw:500,ta:"center",children:"Publish to the web"}),e.jsx(n.Text,{size:"sm",fw:500,color:"var(--mantine-color-gray-6)",ta:"center",children:"Anyone with the link can view this page"})]}),e.jsx(n.Button,{variant:"filled",size:"xs",radius:"md",fw:500,fz:"var(--mantine-font-size-sm)",ta:"center",children:"Publish"})]})}),V=e.jsx(n.Box,{style:{width:"400px",maxHeight:"600px",overflow:"visible"},children:e.jsx(n.Stack,{gap:"lg",children:e.jsxs(n.Tabs,{color:"black",defaultValue:"invite",styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(n.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",children:[e.jsx(n.Tabs.Tab,{value:"invite",p:0,pb:6,onClick:()=>{C("invite")},onMouseEnter:()=>O("invite"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(n.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:k==="invite"?"var(--mantine-color-gray-1)":"transparent",color:m==="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(n.Tabs.Tab,{value:"publish",p:0,pb:6,onClick:()=>{C("publish")},onMouseEnter:()=>O("publish"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(n.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:k==="publish"?"var(--mantine-color-gray-1)":"transparent",color:m==="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(n.Tabs.Panel,{value:"invite",children:e.jsx(n.Box,{p:"sm",children:F})}),e.jsx(n.Tabs.Panel,{value:"publish",children:e.jsx(n.Box,{p:"sm",children:Q})})]})})});return e.jsx(ne,{trigger:i,menuItems:[],opened:o,onClose:r,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:V})},eo=({onInvite:o,onUpdateRole:r,onRemoveUser:t,invitedUsers:s,currentUser:a,roleOptions:c,suggestedUsers:i,label:u="Share"})=>{const[d,f]=l.useState(!1),I=()=>f(!1),y=e.jsx(Ce,{label:u,onClick:()=>f(!0),isActive:d});return e.jsx(Ne,{opened:d,onClose:I,onInvite:o,onUpdateRole:r,onRemoveUser:t,invitedUsers:s,currentUser:a,roleOptions:c,suggestedUsers:i,children:y})},no=({opened:o,onClose:r,onInvite:t,onUpdateRole:s,onRemoveUser:a,invitedUsers:c=[],roleOptions:i=[],suggestedUsers:u=[]})=>{const d=l.useRef(null),{emails:f,setEmails:I,selectedUsers:y,inputText:h,setInputText:b,tagDisplayMap:j,selectedRole:x,setSelectedRole:g,filteredUsers:v,handleInvite:m,handleUpdateRole:C,handleRemoveUser:k,handleToggleUser:O,handleAddSuggestedUser:T}=He({onInvite:t,onUpdateRole:s,onRemoveUser:a,invitedUsers:c,suggestedUsers:u,roleOptions:i}),M=p=>{T(p),d.current&&d.current.clearInput()};return e.jsx(n.Modal,{opened:o,onClose:r,size:"md",withCloseButton:!1,radius:"md",centered:!0,closeOnClickOutside:!1,closeOnEscape:!0,trapFocus:!1,zIndex:300,children:e.jsxs(n.Stack,{gap:"lg",children:[e.jsxs(n.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(n.Text,{size:"md",fw:500,c:"var(--mantine-color-gray-8)",children:"Share"}),e.jsx(H,{icon:w.IconX,size:"md",onClick:r,color:"var(--mantine-color-gray-8)"})]}),e.jsx(Ue,{ref:d,value:f,onChange:I,onInvite:m,roleOptions:i,selectedRole:x,onRoleChange:g,onInputChange:b,suggestedUsers:u,tagDisplayMap:j}),c.length>0&&e.jsxs(n.Box,{children:[e.jsx(n.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(n.Stack,{gap:"sm",children:c.map(p=>e.jsx(oe,{user:p,isSelected:y.includes(p.id),onToggle:O,onUpdateRole:C,onRemoveUser:k,roleOptions:i,variant:"invited"},p.id))})})]}),v.length>0&&e.jsxs(n.Box,{children:[e.jsxs(n.Text,{size:"sm",fw:500,children:["Suggested ",h.trim()&&`(filtered by "${h}")`]}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(n.Stack,{gap:"sm",children:v.map(p=>e.jsx(oe,{user:p,isSelected:y.includes(p.id),onToggle:O,onUpdateRole:C,onRemoveUser:k,roleOptions:i,variant:"suggested",onClick:()=>M(p)},p.id))})})]})]})})},oo=({opened:o,onClose:r,options:t=[],onSave:s,onCancel:a,groups:c=[],styles:i})=>{const[u,d]=l.useState("");l.useEffect(()=>{o&&t.length>0?d(t[0].id):o||d("")},[o,t]);const f=()=>{s&&s(),r()},I=()=>{a&&a(),r()},y=()=>{r()},h=t.find(b=>b.id===u);return e.jsxs(n.Modal,{opened:o,onClose:y,size:"90%",centered:!0,closeOnClickOutside:!0,closeOnEscape:!0,withCloseButton:!1,p:"none",styles:{body:{...i==null?void 0:i.body,padding:0,height:"80vh"}},radius:"md",children:[e.jsx(n.FocusTrap.InitialFocus,{}),e.jsxs(n.Box,{style:{display:"flex",height:"100%",...i==null?void 0:i.body},children:[e.jsx(n.Box,{style:{width:"240px",backgroundColor:"var(--mantine-color-gray-0)"},children:e.jsx(n.ScrollArea,{h:"100%",children:e.jsx(n.Stack,{gap:0,p:"sm",children:c.map(b=>e.jsx(n.Box,{mb:"md",children:e.jsxs(l.Fragment,{children:[e.jsx(n.Text,{size:"xs",fw:600,c:"dimmed",m:4,children:b}),t.filter(j=>j.group===b).map(j=>e.jsx(Ie,{label:j.label,icon:j.icon,onClick:()=>d(j.id),isActive:u===j.id},j.id))]},b)}))})})}),e.jsxs(n.Box,{style:{flex:1,display:"flex",flexDirection:"column"},children:[h?e.jsxs(e.Fragment,{children:[e.jsx(n.Box,{p:"md",children:e.jsx(n.Group,{gap:"md",wrap:"nowrap",children:e.jsxs(n.Stack,{gap:4,children:[e.jsx(n.Text,{size:"md",fw:600,children:h.alternateLabel||h.label}),h.description&&e.jsx(n.Text,{size:"sm",c:"var(--mantine-color-gray-6)",children:h.description})]})})}),e.jsx(n.ScrollArea,{style:{flex:1},children:e.jsx(n.Box,{px:"md",children:h.content})})]}):e.jsx(n.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:e.jsx(n.Text,{c:"var(--mantine-color-gray-6)",size:"lg",children:"Select an option from the sidebar"})}),(h==null?void 0:h.saveButton)&&e.jsx(n.Box,{p:"md",children:e.jsxs(n.Group,{justify:"flex-end",gap:"md",children:[e.jsx(n.Button,{variant:"subtle",onClick:I,color:"gray",children:"Cancel"}),e.jsx(n.Button,{onClick:f,color:"blue",children:"Save Changes"})]})})]})]})]})},to=(o,r="es")=>{const t=new Date,s=typeof o=="string"?new Date(o):o,a=Math.floor((t.getTime()-s.getTime())/1e3),c={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"}},i=c[r]||c.en;if(a<5)return i.now;if(a<60)return r==="es"?`${i.ago} ${a} ${a===1?i.second:i.seconds}`:`${a} ${a===1?i.second:i.seconds} ${i.ago}`;const u=Math.floor(a/60);if(u<60)return r==="es"?`${i.ago} ${u} ${u===1?i.minute:i.minutes}`:`${u} ${u===1?i.minute:i.minutes} ${i.ago}`;const d=Math.floor(u/60);if(d<24)return r==="es"?`${i.ago} ${d} ${d===1?i.hour:i.hours}`:`${d} ${d===1?i.hour:i.hours} ${i.ago}`;const f=Math.floor(d/24);if(f<7)return r==="es"?`${i.ago} ${f} ${f===1?i.day:i.days}`:`${f} ${f===1?i.day:i.days} ${i.ago}`;const I=Math.floor(f/7);if(I<4)return r==="es"?`${i.ago} ${I} ${I===1?i.week:i.weeks}`:`${I} ${I===1?i.week:i.weeks} ${i.ago}`;const y=Math.floor(f/30);if(y<12)return r==="es"?`${i.ago} ${y} ${y===1?i.month:i.months}`:`${y} ${y===1?i.month:i.months} ${i.ago}`;const h=Math.floor(f/365);return r==="es"?`${i.ago} ${h} ${h===1?i.year:i.years}`:`${h} ${h===1?i.year:i.years} ${i.ago}`},ro=(o,r="es")=>{const t=typeof o=="string"?new Date(o):o,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"]},c=(s[r]||s.en)[t.getMonth()],i=t.getDate();return r==="es"?`${i} ${c}`:`${c} ${i}`},so=o=>{const r=typeof o=="string"?new Date(o):o,t=new Date;return r.toDateString()===t.toDateString()},ao=o=>{const r=typeof o=="string"?new Date(o):o,t=new Date;return t.setDate(t.getDate()-1),r.toDateString()===t.toDateString()},io=(o,r="es")=>so(o)?r==="es"?"Hoy":"Today":ao(o)?r==="es"?"Ayer":"Yesterday":to(o,r),co=({notification:o,message:r,markAsRead:t,archiveNotification:s,children:a,actions:c})=>{var I,y,h,b,j;const i=new Date().getTime()-new Date(o.timestamp).getTime()<6048e5?io(o.timestamp,"en"):ro(o.timestamp,"en"),[u,d]=l.useState(!1),f=e.jsxs(n.Group,{bg:"var(--mantine-color-gray-1)",p:4,style:{borderRadius:"var(--mantine-radius-md)"},w:"auto",wrap:"nowrap",gap:0,children:[!o.isRead&&e.jsx(H,{onClick:()=>t(o.id),icon:w.IconCheck}),!o.isArchived&&e.jsx(H,{onClick:()=>s(o.id),icon:w.IconArchive})]});return e.jsxs(n.Box,{p:"sm",bg:u?"var(--mantine-color-gray-0)":"white",style:{cursor:"pointer",borderTop:"1px solid var(--mantine-color-gray-2)"},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[e.jsxs(n.Group,{justify:"space-between",align:"flex-start",gap:"sm",wrap:"nowrap",style:{margin:0},children:[(I=o.metadata)!=null&&I.avatar_url?e.jsx(n.Avatar,{name:(y=o.metadata)==null?void 0:y.fullname,size:"sm",radius:"md",src:(h=o.metadata)==null?void 0:h.avatar_url}):e.jsx(ke,{size:"xs",showText:!1,radius:"xs"}),e.jsxs(n.Stack,{gap:"xs",justify:"flex-start",w:"100%",children:[e.jsx(n.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(n.Text,{size:"xs",c:"dimmed",fw:500,style:{whiteSpace:"nowrap"},children:[o.category?((b=o.category)==null?void 0:b.charAt(0).toUpperCase())+((j=o.category)==null?void 0:j.slice(1)):""," ","• ",i]})]}),u?f:!o.isRead&&e.jsx(n.Indicator,{color:"var(--mantine-color-blue-6)",size:10,position:"top-end"})]}),a,c&&e.jsx(n.Group,{justify:"flex-start",align:"flex-start",gap:"xs",wrap:"nowrap",pl:36,pt:8,children:c})]})},lo=(o,r,t,s,a)=>{const[c,i]=l.useState(!1),u=l.useRef(null),d=l.useRef(null),f=l.useRef(null);l.useEffect(()=>{i(o)},[o]);const I=l.useCallback(h=>{h[0].isIntersecting&&s&&!a&&t&&t()},[s,a,t]),y=l.useCallback(()=>{if(!(!u.current||!o||!r||!t)){d.current&&(d.current.disconnect(),d.current=null);try{const h=new IntersectionObserver(I,{threshold:.1,rootMargin:"50px"});h.observe(u.current),d.current=h}catch(h){console.error("Failed to setup intersection observer:",h)}}},[o,r,t,I]);return l.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),!o||!r||!t){d.current&&(d.current.disconnect(),d.current=null);return}if(!u.current){f.current=setTimeout(()=>y(),50);return}return y(),()=>{f.current&&(clearTimeout(f.current),f.current=null),d.current&&(d.current.disconnect(),d.current=null)}},[o,r,t,y]),l.useEffect(()=>()=>{f.current&&clearTimeout(f.current),d.current&&d.current.disconnect()},[]),{isActive:c,loadMoreRef:u}},uo=({notifications:o,isLoading:r=!1,isLoadingMore:t=!1,hasMore:s=!1,unreadCount:a=0,markAllAsRead:c,archiveAllNotifications:i,markAsRead:u,archiveNotification:d,loadMore:f,onFilterChange:I,currentFilter:y="all",customRenderer:h,opened:b=!1,onOpen:j=()=>{},onClose:x=()=>{},enableInfiniteScroll:g=!0})=>{const v=[{children:"Mark all as read",leftSection:e.jsx(w.IconChecklist,{size:16}),onClick:()=>c()},{children:"Archive all",leftSection:e.jsx(w.IconArchive,{size:16}),onClick:()=>i()}],m=[{children:"All",leftSection:e.jsx(w.IconChecklist,{size:16}),onClick:()=>I==null?void 0:I("all"),active:y==="all"},{children:"Unread",leftSection:e.jsx(w.IconChecklist,{size:16}),onClick:()=>I==null?void 0:I("unread"),active:y==="unread"},{children:"Archived",leftSection:e.jsx(w.IconArchive,{size:16}),onClick:()=>I==null?void 0:I("archived"),active:y==="archived"}],C=T=>h&&T.category&&["welcome","upgrade"].includes(T.category)?h(T,u,d):e.jsx(co,{notification:T,markAsRead:u,archiveNotification:d,message:T.message,actions:T.actions},T.id),{isActive:k,loadMoreRef:O}=lo(b,g,f||(()=>{}),s,t);return e.jsxs(e.Fragment,{children:[e.jsx(Ie,{isActive:k,icon:e.jsx(w.IconBell,{strokeWidth:2,color:"var(--mantine-color-gray-7)"}),onClick:()=>{b?x():j()},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(n.Drawer,{opened:b,onClose:x,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(n.FocusTrap.InitialFocus,{}),e.jsxs(n.Box,{p:0,h:"100%",style:{display:"flex",flexDirection:"column"},children:[e.jsx(n.Box,{style:{position:"sticky",top:0,zIndex:10,backgroundColor:"var(--mantine-color-white)"},children:e.jsxs(n.Group,{justify:"space-between",align:"center",gap:"xs",style:{borderRadius:"var(--mantine-radius-md)"},px:"sm",py:"md",children:[e.jsx(n.Text,{size:"sm",fw:500,children:"Inbox"}),e.jsxs(n.Group,{gap:"xs",children:[e.jsx(ne,{position:"bottom-end",menuItems:m,trigger:e.jsx(H,{icon:w.IconFilter})}),e.jsx(ne,{position:"bottom-end",menuItems:v,trigger:e.jsx(H,{onClick:()=>{},icon:w.IconDots,changeIconOnHover:!0,iconHovered:w.IconDots})})]})]})}),e.jsxs(n.Box,{style:{flex:1,overflow:"auto"},children:[r&&o.length===0?e.jsx(n.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:e.jsx(n.Loader,{})}):o.length>0?e.jsx(n.Stack,{gap:0,children:o.map(T=>C(T))}):e.jsxs(n.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(w.IconInbox,{size:24,color:"var(--mantine-color-gray-6)"}),e.jsx(n.Text,{size:"sm",fw:500,c:"dimmed",ta:"center",mt:"sm",children:"No new updates"})]}),e.jsx(n.Box,{ref:O,style:{padding:"16px",display:g?"flex":"none",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:t&&e.jsxs(n.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(n.Loader,{size:"sm",color:"gray.5"}),e.jsx(n.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]})}),t&&!g&&e.jsxs(n.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(n.Loader,{size:"sm",color:"gray.5"}),e.jsx(n.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]}),!g&&s&&f&&e.jsx(n.Button,{color:"var(--mantine-color-gray-3)",variant:"subtle",onClick:f,loading:t,disabled:t,style:{alignSelf:"center"},children:t?"Loading...":"Load More"})]})]})]})]})},fo=({header:o,body:r,footer:t,withBorder:s=!0,position:a="left",bg:c="var(--mantine-color-gray-0)"})=>{const[i,u]=l.useState(!1),d=()=>{if(!s)return{};const f="var(--mantine-color-gray-3)",I="1px";return a==="left"?{borderRight:`${I} solid ${f}`}:a==="right"?{borderLeft:`${I} solid ${f}`}:{}};return e.jsxs(n.Stack,{gap:"sm",h:"100%",p:"sm",bg:c,style:d(),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[o&&e.jsx(n.Box,{children:typeof o=="function"?o({hovered:i}):o}),r&&e.jsx(n.Box,{style:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:typeof r=="function"?r({hovered:i}):r}),t&&e.jsx(n.Box,{children:typeof t=="function"?t({hovered:i}):t})]})},We=l.createContext(void 0),Io=({children:o})=>{const[r,{open:t,close:s}]=en.useDisclosure(!1),a={openedNotificationSidebar:r,openNotificationSidebar:t,closeNotificationSidebar:s};return e.jsx(We.Provider,{value:a,children:o})},po=()=>{const o=l.useContext(We);if(o===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return o},$e=({workspace:o,currentUserId:r,currentWorkspaceId:t,onClick:s})=>{const a=t===o.id,c=r&&o.ownerId===r;return e.jsxs(n.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:i=>{i.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)"},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent"},children:[e.jsx(Z,{size:"xs",avatar:typeof o.avatar=="string"?{type:"image",value:o.avatar}:o.avatar,placeholder:o.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(n.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:o.name}),e.jsxs(n.Box,{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0,paddingLeft:"8px"},children:[a&&e.jsx(w.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),c&&e.jsx(n.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},ho="_menuItem_3gic2_1",go="_workspaceButton_3gic2_14",xo="_workspaceText_3gic2_24",mo="_scrollWrapper_3gic2_30",de={menuItem:ho,workspaceButton:go,workspaceText:xo,scrollWrapper:mo},yo=({workspaces:o=[],currentWorkspace:r,currentUserId:t,isLoading:s=!1,error:a=null,onWorkspaceSelect:c,onCreateWorkspace:i,emptyMessage:u="No workspaces found",loadingMessage:d="Loading workspaces...",errorMessage:f="Failed to load workspaces",className:I,onCloseSidebar:y,sidebarHovered:h=!1,children:b,menuItems:j})=>{const[x,g]=l.useState(!1),[v,m]=l.useState(""),C=l.useMemo(()=>v?o.filter(M=>{var p;return M.name.toLowerCase().includes(v.toLowerCase())||((p=M.ownerEmail)==null?void 0:p.toLowerCase().includes(v.toLowerCase()))}):o,[o,v]),k=M=>{c==null||c(M.id),g(!1),m("")};if(s)return e.jsxs(n.Group,{gap:"xs",children:[e.jsx(n.Loader,{size:"sm"}),e.jsx(n.Text,{size:"sm",c:"dimmed",children:d})]});if(a)return e.jsx(n.Alert,{color:"red",title:"Error",children:f});const[O,T]=l.useState(h);return o.length===0&&!s&&!a?e.jsx(n.Box,{children:e.jsx(n.Text,{size:"sm",c:"dimmed",children:u})}):e.jsxs(n.Menu,{opened:x,onOpen:()=>g(!0),onClose:()=>g(!1),position:"bottom-start",styles:{dropdown:{width:"350px",overflow:"hidden"}},withinPortal:!0,children:[e.jsx(n.Menu.Target,{children:e.jsx(n.Box,{w:"100%",onClick:()=>g(!x),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${de.workspaceButton} ${I||""}`,bg:O||x?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),children:e.jsx(n.Group,{gap:"xs",wrap:"nowrap",style:{width:"100%",overflow:"hidden"},children:r?e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"xs",avatar:typeof r.avatar=="string"?{type:"image",value:r.avatar}:r.avatar,placeholder:r.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(n.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:r.name}),e.jsxs(n.Group,{gap:4,wrap:"nowrap",style:{flexShrink:0},children:[e.jsx(n.ActionIcon,{radius:"md",size:"md",color:"gray",variant:"subtle",onClick:()=>g(!x),children:e.jsx(w.IconChevronDown,{size:20,strokeWidth:2,color:"var(--mantine-color-gray-7)"})}),(O||h)&&e.jsx(H,{icon:w.IconChevronsLeft,size:"md",color:"gray",variant:"subtle",onClick:()=>{y==null||y()}})]})]}):e.jsx(n.Text,{size:"sm",c:"dimmed",children:"Select workspace"})})})}),e.jsx(n.Menu.Dropdown,{style:{borderRadius:"var(--mantine-radius-md)"},p:0,children:e.jsxs(n.Stack,{gap:0,children:[b,e.jsx(n.Menu.Divider,{style:{margin:"1px 0px"}}),e.jsx(n.Stack,{gap:0,px:4,children:C.length===0?e.jsx(n.Menu.Item,{disabled:!0,children:e.jsx(n.Text,{size:"sm",c:"dimmed",children:u})}):e.jsxs(e.Fragment,{children:[e.jsxs(n.Group,{justify:"space-between",align:"center",p:4,children:[e.jsx(n.Text,{size:"xs",c:"dimmed",fw:500,p:4,truncate:!0,children:"Workspaces"}),i&&e.jsx(n.Anchor,{onClick:()=>{i(),g(!1)},size:"xs",underline:"never",fw:500,p:4,truncate:!0,style:{display:"flex",alignItems:"center",gap:"4px"},children:"Add"})]}),e.jsx("div",{className:de.scrollWrapper,children:e.jsx(n.ScrollArea,{mah:150,scrollbarSize:6,scrollHideDelay:0,children:e.jsx(n.Stack,{gap:0,mb:6,children:C.map(M=>e.jsx(n.Box,{onClick:()=>k(M),className:de.menuItem,style:{padding:0,borderRadius:"var(--mantine-radius-md)",cursor:"pointer",overflow:"hidden"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent"},children:e.jsx($e,{workspace:M,currentUserId:t,currentWorkspaceId:r==null?void 0:r.id,onClick:()=>k(M)})},M.id))})})})]})}),j&&e.jsx(n.Menu.Divider,{style:{margin:"1px 0px"}}),j&&e.jsx(n.Box,{p:4,children:j==null?void 0:j.map(M=>e.jsx(n.MenuItem,{onClick:M.onClick,leftSection:M.icon,children:M.label,color:M.color,"data-danger":M.color,fw:500,style:{height:"40px",borderRadius:"var(--mantine-radius-md)",padding:"6px"}},M.label))})]})})]})},vo=({opened:o,onClose:r,children:t,...s})=>e.jsxs(n.Modal,{withCloseButton:!1,opened:o,onClose:r,size:"70%",centered:!0,overlayProps:{backgroundOpacity:.55},styles:{content:{minHeight:"100%"}},padding:"md",...s,children:[e.jsxs(n.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(n.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:e.jsx(H,{icon:w.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(n.Group,{justify:"space-between",gap:"xs",children:[e.jsx(H,{icon:w.IconStar,size:"md",onClick:()=>{}}),e.jsx(H,{icon:w.IconDots,size:"md",onClick:()=>{}})]})]}),t]}),jo=({opened:o,onClose:r,content:t,position:s="right",size:a="xl"})=>e.jsxs(n.Drawer,{opened:o,onClose:r,position:s,size:a,padding:"md",withCloseButton:!1,children:[e.jsxs(n.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(n.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:[e.jsx(H,{icon:w.IconChevronsRight,size:"md",onClick:r}),e.jsx(H,{icon:w.IconMaximize,size:"md",onClick:()=>{}})]}),e.jsxs(n.Group,{justify:"space-between",gap:"xs",children:[e.jsx(H,{icon:w.IconStar,size:"md",onClick:()=>{}}),e.jsx(H,{icon:w.IconDots,size:"md",onClick:()=>{}})]})]}),t]}),bo=({children:o})=>e.jsx(n.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:o}),Ge=n.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:{},components:{}});function wo({children:o,theme:r}){return e.jsxs(n.MantineProvider,{theme:r||Ge,children:[e.jsx(nn.Notifications,{}),e.jsx(on.ModalsProvider,{children:e.jsx(tn.DatesProvider,{settings:{firstDayOfWeek:0},children:o})})]})}exports.ActionButton=H;exports.AvatarSelector=Qn;exports.BoxAvatar=Z;exports.CenterPeek=vo;exports.EditableText=pn;exports.EmojiAvatar=ye;exports.ExpandableSearch=Me;exports.FilterDropdown=mn;exports.FullPage=bo;exports.GenericTable=Te;exports.IconAvatar=be;exports.ImageAvatar=we;exports.InvitedUserCard=oe;exports.Logo=ke;exports.Menu=ne;exports.ModalSettings=oo;exports.NavButton=Ie;exports.NavLink=vn;exports.Navbar=fo;exports.NavbarProvider=Io;exports.NotificationSidebar=uo;exports.PlaceholderAvatar=ie;exports.PopoverItem=Oe;exports.PopoverSelector=ce;exports.ShareButton=eo;exports.ShareMenu=Ne;exports.ShareModal=no;exports.SidePeek=jo;exports.TextButton=Ce;exports.ThemeProvider=wo;exports.WorkspaceSelector=yo;exports.WorkspaceSelectorItem=$e;exports.getInitialsFromName=Se;exports.theme=Ge;exports.useNavbar=po;
18
+ `})]})},fe=({activeFilters:o,onFiltersChange:r,availableFilters:t,size:s="md",filterButtonDropdownPosition:a="bottom-end"})=>{const c=n.useCombobox({onDropdownClose:()=>c.resetSelectedOption(),onDropdownOpen:()=>c.updateSelectedOptionIndex("active")}),[i,u]=l.useState(!1),d=o.length>0,f=g=>{if(g==="remove-filters")r([]);else{const x=t==null?void 0:t.find(j=>j.value===g);if(x){const j={id:`${x.value}-${Date.now()}`,filterOption:x};r([...o,j])}}c.closeDropdown()},p=(t||[]).filter(g=>!o.some(x=>x.filterOption.value===g.value)),m={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},b=(()=>{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}}})(),v=e.jsx(n.Box,{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:d||i?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",transition:"all 0.2s ease",...b},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:()=>c.toggleDropdown(),children:e.jsx(w.IconFilter,{size:20,stroke:2.3})});return e.jsxs(n.Combobox,{store:c,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,children:[e.jsx(n.Combobox.Target,{children:d?e.jsx(n.Indicator,{offset:2,position:"top-end",color:"var(--mantine-color-yellow-7)",children:v}):v}),e.jsx(n.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(n.Combobox.Options,{children:[p.map(g=>e.jsx(n.Combobox.Option,{value:g.value,style:{...m},children:e.jsxs(n.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[g.icon,g.label]})},g.value)),d&&e.jsx(n.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(n.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(w.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},gn=({filterTag:o,onUpdate:r,onRemove:t,options:s=[],filterTagDropdownPosition:a="bottom-start"})=>{var I;const c=n.useCombobox({onDropdownClose:()=>c.resetSelectedOption(),onDropdownOpen:()=>c.updateSelectedOptionIndex("active")}),i=!!o.selectedOption,u=i?`${o.filterOption.label}: ${(I=o.selectedOption)==null?void 0:I.label}`:o.filterOption.label,d=s&&s.length>0?s:[{value:"option-a",label:"TagFilterOptionA"},{value:"option-b",label:"TagFilterOptionB"},{value:"option-c",label:"TagFilterOptionC"}],f=b=>{if(b==="remove")t();else{const v=d.find(g=>g.value===b);v&&r({...o,selectedOption:v})}c.closeDropdown()},p={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},m={display:"inline-flex",alignItems:"center",gap:"4px",backgroundColor:i?"var(--mantine-color-blue-0)":"var(--mantine-color-gray-0)",color:i?"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(n.Combobox,{store:c,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,middlewares:{flip:!1,shift:!0},children:[e.jsx(n.Combobox.Target,{children:e.jsxs(n.Box,{style:{...m},onClick:()=>c.toggleDropdown(),fw:500,pl:"sm",children:[e.jsxs(n.Box,{style:{display:"flex",alignItems:"center",gap:"4px"},children:[o.filterOption.icon,u]}),e.jsx(w.IconChevronDown,{size:16,strokeWidth:2,color:"var(--mantine-color-gray-5)"})]})}),e.jsx(n.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(n.Combobox.Options,{children:[d.map(b=>{var v;return e.jsx(n.Combobox.Option,{value:b.value,active:((v=o.selectedOption)==null?void 0:v.value)===b.value,style:{...p},children:b.label},b.value)}),e.jsx(n.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"})]})})]})},mn=({activeFilters:o,onFiltersChange:r,availableFilters:t,addFilterButtonDropdownPosition:s="bottom-start"})=>{const a=n.useCombobox({onDropdownClose:()=>a.resetSelectedOption(),onDropdownOpen:()=>a.updateSelectedOptionIndex("active")}),[c,i]=l.useState(!1),u=I=>{const b=t==null?void 0:t.find(v=>v.value===I);if(b){const v={id:`${b.value}-${Date.now()}`,filterOption:b};r([...o,v])}a.closeDropdown()},d=(t||[]).filter(I=>!o.some(b=>b.filterOption.value===I.value)),f={display:"inline-flex",alignItems:"center",backgroundColor:c?"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"},p={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"}},m={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"};return e.jsxs(n.Combobox,{store:a,onOptionSubmit:u,withinPortal:!1,offset:4,position:s,children:[e.jsx(n.Combobox.Target,{children:e.jsx(n.Box,{style:{...f},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:()=>a.toggleDropdown(),children:e.jsx(n.Box,{style:{fontWeight:"500",color:"var(--mantine-color-blue-6)"},children:"Add filter"})})}),e.jsx(n.Combobox.Dropdown,{styles:{...p},children:e.jsx(n.Combobox.Options,{children:d.map(I=>e.jsx(n.Combobox.Option,{value:I.value,style:{...m},children:e.jsxs(n.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[I.icon,I.label]})},I.value))})})]})},pe=({activeFilters:o,onFiltersChange:r,availableFilters:t,size:s="sm",getFilterOptions:a,filterTagDropdownPosition:c="bottom-start"})=>{const i=f=>{const p=(o||[]).map(m=>m.id===f.id?f:m);r(p)},u=f=>{const p=(o||[]).filter(m=>m.id!==f);r(p)},d=(t||[]).filter(f=>!o.some(p=>p.filterOption.value===f.value));return!o||o.length===0?null:e.jsx("div",{style:{width:"100%"},children:e.jsxs(n.Group,{gap:"sm",align:"center",wrap:"wrap",children:[(o||[]).map(f=>{const p=a?a(f.filterOption.value)||[]:[];return e.jsx(gn,{filterTag:f,onUpdate:i,onRemove:()=>u(f.id),size:s,options:p,filterTagDropdownPosition:c},f.id)}),d.length>0&&e.jsx(mn,{activeFilters:o,onFiltersChange:r,availableFilters:d,size:s})]})})},yn=({activeFilters:o,onFiltersChange:r,availableFilters:t,size:s="md",getFilterOptions:a,filterTagDropdownPosition:c="bottom-start"})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsx(fe,{activeFilters:o,onFiltersChange:r,availableFilters:t,size:s}),e.jsx(pe,{activeFilters:o,onFiltersChange:r,availableFilters:t,size:"sm",getFilterOptions:a,filterTagDropdownPosition:c})]}),vn=Object.assign(yn,{Button:fe,Filters:pe}),jn=({children:o,danger:r,active:t,...s})=>e.jsx(n.MenuItem,{...s,style:{borderRadius:"8px",color:t?"var(--mantine-color-blue-7)":r?"var(--mantine-color-red-9)":"var(--mantine-color-gray-9)",backgroundColor:t?"var(--mantine-color-blue-0)":"transparent",...s.style},children:o}),ne=({trigger:o,menuItems:r,children:t,...s})=>{const a=l.useRef(null),[c,i]=l.useState(0);return l.useEffect(()=>{a.current&&i(a.current.offsetWidth)},[o]),e.jsxs(n.Menu,{...s,children:[e.jsx(n.Menu.Target,{children:e.jsx("div",{ref:a,onClick:u=>u.stopPropagation(),style:{cursor:"pointer",outline:"none",boxShadow:"none",display:"flex",alignItems:"center"},children:o})}),e.jsxs(n.Menu.Dropdown,{styles:{dropdown:{cursor:"pointer",borderRadius:"8px",minWidth:`${c}px`}},children:[t,r==null?void 0:r.map((u,d)=>e.jsx(jn,{...u},d))]})]})},Ie=({label:o,icon:r,onClick:t,color:s="gray",disabled:a=!1,"aria-label":c,indicator:i,fullWidth:u,isActive:d=!1,...f})=>{const[p,m]=l.useState(!1),I=()=>{a||t==null||t()};return e.jsx(n.Box,{style:{cursor:a?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},variant:"transparent",justify:"flex-start",display:"flex",color:s,radius:"md",w:u?"100%":"auto",px:6,h:40,onMouseEnter:()=>!a&&m(!0),onMouseLeave:()=>m(!1),onClick:I,bg:p||d?"gray.1":"transparent","aria-label":c||`${o} navigation button`,...f,children:e.jsxs(n.Group,{w:"100%",wrap:"nowrap",gap:8,justify:"left",align:"center",children:[r,e.jsx(n.Text,{ta:"left",size:"sm",fw:500,c:p?"gray.8":"gray.7",truncate:!0,style:{flex:1,opacity:a?.5:1},children:o}),i&&e.jsx(n.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:i})]})})},bn=({label:o,rightLabel:r,children:t,onAddChild:s,onMenuAction:a,menuItems:c,color:i="gray",defaultText:u="No items",level:d=0,disabled:f=!1,noChild:p=!1,isActive:m=!1,showAvatar:I=!1,avatar:b,placeholder:v,onClick:g,"aria-label":x,...j})=>{const[y,C]=l.useState(!1),[k,O]=l.useState(!1),[T,M]=l.useState(!1),h=l.Children.count(t)>0,D=T?w.IconChevronDown:w.IconChevronRight,P=!p&&h&&(I?k:!0),R=l.useCallback(F=>{f||(console.log("NavLink clicked",{hasChildren:h,noChild:p,isExpanded:y}),h&&!p&&(console.log("Toggling expansion"),C(!y)),g==null||g())},[g,f,h,p,y]),B=l.useCallback(F=>{F.stopPropagation(),!f&&(s==null||s())},[s,f]),L=l.useCallback(()=>{f||(h&&!p&&C(!y),g==null||g())},[f,h,p,y,g]),Q=l.useCallback(()=>{f||s==null||s()},[s,f]),V=l.useCallback(F=>{f||a==null||a(F)},[a,f,o]),H=l.useCallback(()=>h?l.Children.map(t,F=>l.isValidElement(F)?l.cloneElement(F,{...F.props,level:d+1}):F):null,[t,h,d]),Y=(c==null?void 0:c.map(F=>({children:e.jsxs(n.Group,{gap:"xs",wrap:"nowrap",children:[F.icon&&e.jsx(F.icon,{size:16}),e.jsx(n.Text,{size:"sm",children:F.label})]}),onClick:()=>V(F.action)})))||[],K=[{children:e.jsxs(n.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(w.IconPlus,{size:16}),e.jsx(n.Text,{size:"sm",children:"Add child"})]}),onClick:B}],J=Y.length>0?Y:K;return e.jsxs(n.Stack,{gap:0,children:[e.jsx(n.Box,{style:{cursor:f?"not-allowed":"pointer",borderRadius:"8px"},variant:"transparent",justify:"space-between",display:"flex",color:i,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!f&&O(!0),onMouseLeave:()=>O(!1),onClick:R,bg:m||k?"var(--mantine-color-gray-1)":"transparent","aria-expanded":y,"aria-label":x||`${o} navigation link`,...j,children:e.jsxs(n.Group,{w:"100%",wrap:"nowrap",gap:8,onClick:R,style:{paddingLeft:p&&!P?`${(d+1)*16}px`:d>0?`${d*16}px`:"0px"},children:[P?e.jsx(N,{icon:D,size:"md",color:i,onClick:L,disabled:f,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),"aria-label":h?`${y?"Collapse":"Expand"} ${o}`:void 0}):I?e.jsx(Z,{size:"xs",avatar:b,showPlaceholder:!0,placeholder:v}):null,e.jsx(n.Text,{size:"sm",fw:500,c:m?"black":k?"gray.9":"gray.8",truncate:!0,w:"100%",style:{opacity:f?.5:1},children:o}),e.jsxs(n.Group,{gap:"xs",align:"center",children:[r&&e.jsx(n.Text,{size:"xs",c:"dimmed",children:r}),k&&!f&&e.jsxs(n.Group,{gap:4,wrap:"nowrap",children:[s&&e.jsx(N,{icon:w.IconPlus,onClick:Q,"aria-label":`Add child to ${o}`}),(c&&c.length>0||s)&&e.jsx("div",{onClick:F=>F.stopPropagation(),children:e.jsx(ne,{menuItems:J,trigger:e.jsx(N,{icon:w.IconDots,"aria-label":`More options for ${o}`,size:"md"}),position:"bottom-end",shadow:"md"})})]})]})]})}),y&&!p&&e.jsx(n.Stack,{gap:0,style:{width:"100%"},children:h?H():e.jsx(n.Box,{style:{marginLeft:d>0?`${d*16}px`:"0px"},children:e.jsx(n.Text,{size:"sm",c:"dimmed",ta:"left",p:"sm",fw:500,children:u})})})]})},wn="200px",Sn="4px 8px",Cn=40,kn="var(--mantine-radius-md)",Mn=16,Te=({item:o,withAvatars:r,disabled:t=!1,onClick:s,selected:a=!1})=>{const[c,i]=l.useState(!1);return e.jsx(n.Box,{onMouseEnter:()=>!t&&i(!0),onMouseLeave:()=>!t&&i(!1),onClick:u=>{u.preventDefault(),u.stopPropagation(),t||s==null||s(o.value)},onMouseDown:u=>{u.stopPropagation()},style:{minWidth:wn,backgroundColor:t?"transparent":c?"var(--mantine-color-gray-1)":"transparent",cursor:t?"default":"pointer",borderRadius:kn,padding:Sn,transition:"background-color 0.2s ease",opacity:t?.5:1},children:e.jsxs(n.Group,{gap:"sm",wrap:"nowrap",align:"flex-start",style:{alignItems:"center"},h:Cn,children:[r&&o.avatar&&e.jsx("img",{src:o.avatar,alt:o.label,style:{width:"24px",height:"24px",borderRadius:"var(--mantine-radius-sm)",objectFit:"cover"}}),e.jsxs(n.Stack,{gap:0,style:{flex:1},children:[e.jsx(n.Text,{size:"sm",fw:500,lh:-1,c:t?"var(--mantine-color-gray-5)":"var(--mantine-color-gray-9)",children:o.label}),e.jsx(n.Text,{size:"xs",c:t?"var(--mantine-color-gray-4)":"dimmed",children:o.description})]}),a&&e.jsx(w.IconCheck,{size:Mn,color:"var(--mantine-color-gray-9)"})]})})},On="bottom-end",Tn=1e4,zn="24px",Dn="0 8px",Rn="6px",ge="var(--mantine-radius-md)",Bn="46px",le=({value:o,onChange:r,data:t,withRemove:s=!1,withAvatars:a=!1,onRemove:c,disabledOptions:i=[],disabled:u=!1,defaultOption:d,popoverStyles:f,dropdownStyles:p,triggerStyles:m,textStyles:I})=>{const[b,v]=l.useState(!1),g=(t||[]).find(h=>h.value===o)||d,[x,j]=l.useState(!1),[y,C]=l.useState(!1),[k,O]=l.useState(!1),T=s?e.jsx(n.Group,{p:"sm",onClick:h=>{h.stopPropagation(),c==null||c(o)},style:{cursor:"pointer",height:Bn,display:"flex",alignItems:"center",borderRadius:ge,backgroundColor:y?"var(--mantine-color-red-0)":"transparent",transition:"background-color 0.2s ease"},onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:e.jsx(n.Text,{size:"sm",c:"var(--mantine-color-red-6)",fw:500,children:"Remove user"})}):null,M=e.jsxs(n.Box,{onMouseEnter:()=>!u&&j(!0),onMouseLeave:()=>!u&&j(!1),onClick:()=>{u||(v(!0),O(!0))},style:{height:zn,cursor:u?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:ge,backgroundColor:u?"transparent":x||k?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:Dn,gap:Rn,width:"auto",opacity:u?.6:1,...m},children:[e.jsx(n.Text,{size:"sm",fw:I!=null&&I.fontWeight?void 0:500,c:u?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",style:{color:u?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",lineHeight:"24px",whiteSpace:"nowrap",...I},children:(g==null?void 0:g.label)||"Select option"}),e.jsx(w.IconChevronDown,{size:16,style:{color:u?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(n.Popover,{opened:b,onChange:h=>{v(h),h||O(!1)},position:On,shadow:"md",withinPortal:!0,zIndex:Tn,styles:f,children:[e.jsx(n.Popover.Target,{children:M}),e.jsx(n.Popover.Dropdown,{onClick:h=>h.stopPropagation(),onMouseDown:h=>h.stopPropagation(),styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",padding:"4px",...p}},children:e.jsxs(n.Stack,{gap:0,onClick:h=>h.stopPropagation(),onMouseDown:h=>h.stopPropagation(),children:[(t||[]).map(h=>{const D=i.includes(h.value),P=h.value===o;return e.jsx(Te,{item:h,withAvatars:a,disabled:D,selected:P,onClick:R=>{r==null||r(R),v(!1),O(!1)}},h.value)}),T]})})]})},Pn=(o,r,t,s)=>{const a=l.useRef(null),c=l.useRef(null),i=l.useCallback(d=>{d[0].isIntersecting&&t&&!s&&r&&r()},[t,s,r]),u=l.useCallback(()=>{if(!(!a.current||!o||!r)){c.current&&(c.current.disconnect(),c.current=null);try{const d=new IntersectionObserver(i,{threshold:.1,rootMargin:"50px"});d.observe(a.current),c.current=d}catch(d){console.error("Failed to setup intersection observer:",d)}}},[o,r,i]);return l.useEffect(()=>(u(),()=>{c.current&&(c.current.disconnect(),c.current=null)}),[u]),l.useEffect(()=>()=>{c.current&&(c.current.disconnect(),c.current=null)},[]),{loadMoreRef:a}},ze=({tableName:o,data:r,columns:t,onAddItem:s,addItemComponent:a,addItemLabel:c="Add item",loading:i=!1,emptyMessage:u="No data found",searchPlaceholder:d="Search...",enableAutoFilters:f=!0,customFilters:p=[],onCustomFilter:m,onSort:I,sortColumn:b,sortDirection:v,onSearch:g,onRowClick:x,size:j="md",striped:y=!1,highlightOnHover:C=!0,enableInfiniteScroll:k=!1,isLoadingMore:O=!1,hasMore:T=!1,onLoadMore:M})=>{const[h,D]=l.useState(""),[P,R]=l.useState([]),{loadMoreRef:B}=Pn(k,M||(()=>{}),T,O),L=l.useMemo(()=>[...f?t.filter(z=>z.type==="select"&&z.options).map(z=>({value:z.key,label:z.label})):[],...p],[t,f,p]),Q=l.useMemo(()=>{let S=r||[];if(h){const z=h.toLowerCase();S=S.filter(A=>t.some(E=>{if(!E.searchable)return!1;const W=A[E.key];return W==null?!1:String(W).toLowerCase().includes(z)}))}return P.forEach(z=>{if(z.filterTag.selectedOption){const A=t.find(E=>E.key===z.filterTag.filterOption.value);A&&(S=S.filter(E=>{var q;const W=E[A.key];return String(W)===((q=z.filterTag.selectedOption)==null?void 0:q.value)}))}}),S},[r,h,P,t]),V=S=>{D(S),g==null||g(S)},H=S=>{const z=t.find(E=>E.key===S);if(!(z!=null&&z.sortable))return;const A=b===S&&v==="asc"?"desc":"asc";I==null||I(S,A)},Y=S=>{const z=t.find(A=>A.key===S);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(E=>E[z.key]).filter(Boolean))].map(E=>({value:String(E),label:String(E).charAt(0).toUpperCase()+String(E).slice(1)})):z?[...new Set(r.map(E=>E[z.key]).filter(Boolean))].map(E=>({value:String(E),label:String(E).charAt(0).toUpperCase()+String(E).slice(1)})):[]},K=(S,z)=>{var E,W,q,te,re;const A=z[S.key];switch(S.type){case"text":return e.jsx(n.Text,{size:"sm",c:A?void 0:"dimmed",children:A||"—"});case"date":if(!A)return e.jsx(n.Text,{size:"sm",c:"dimmed",children:"—"});const U=new Date(A),_e=S.format?U.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):U.toLocaleDateString();return e.jsx(n.Text,{size:"sm",c:"dimmed",children:_e});case"select":return S.options?e.jsx(le,{value:A,data:S.options,placeholder:S.label,onChange:$=>{var se;return(se=S.onSelectChange)==null?void 0:se.call(S,$,z)},disabled:(E=S.disabled)==null?void 0:E.call(S,z)}):e.jsx(n.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Ze=((W=S.badgeColors)==null?void 0:W[A])||"gray";return e.jsx(n.Badge,{color:Ze,variant:"light",size:"sm",radius:"md",fw:600,children:A||"Unknown"});case"avatar":const Ye=((q=S.fallbackText)==null?void 0:q.call(S,z))||String(A).charAt(0).toUpperCase();return e.jsx(Z,{avatar:A,size:"xs",placeholder:Ye,showPlaceholder:!0});case"custom":return((te=S.render)==null?void 0:te.call(S,A,z))||e.jsx(n.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(re=S.actions)!=null&&re.length?e.jsxs(n.Menu,{shadow:"md",width:200,position:"bottom-end",styles:{dropdown:{borderRadius:"var(--mantine-radius-md)"}},children:[e.jsx(n.Menu.Target,{children:e.jsx(n.ActionIcon,{variant:"subtle",size:"md",color:"gray",radius:"md",children:e.jsx(w.IconDots,{size:16})})}),e.jsx(n.Menu.Dropdown,{children:S.actions.map(($,se)=>{var he;return e.jsx(n.Menu.Item,{color:$.color,leftSection:$.icon,disabled:(he=$.disabled)==null?void 0:he.call($,z),onClick:()=>$.onClick(z),styles:{item:{borderRadius:"var(--mantine-radius-md)"}},children:$.label},se)})})]}):null;default:return e.jsx(n.Text,{size:"sm",c:"dimmed",children:"—"})}},J=S=>{var z;return(z=t.find(A=>A.key===S))!=null&&z.sortable?b===S?v==="asc"?e.jsx(w.IconChevronUp,{size:14}):e.jsx(w.IconChevronDown,{size:14}):e.jsx(w.IconChevronUp,{size:14,style:{opacity:.3}}):null},X=(()=>{switch(j){case"sm":return{buttonSize:"xs",textSize:"sm"};case"lg":return{buttonSize:"md",textSize:"md"};default:return{buttonSize:"sm",textSize:"sm"}}})();return e.jsxs(n.Box,{pos:"relative",children:[e.jsx(n.LoadingOverlay,{visible:i}),e.jsxs(n.Stack,{gap:"sm",w:"100%",children:[e.jsxs(n.Group,{gap:"sm",wrap:"nowrap",justify:"space-between",children:[e.jsx(n.Text,{fw:600,c:"var(--mantine-color-gray-8)",children:o}),e.jsxs(n.Group,{gap:"xs",wrap:"nowrap",children:[e.jsxs(n.Group,{gap:4,wrap:"nowrap",children:[e.jsx(Oe,{placeholder:d,value:h,onChange:V,onSearch:V,expandDirection:"right",size:X.buttonSize}),L.length>0&&e.jsx(fe,{activeFilters:P.map(S=>S.filterTag),onFiltersChange:S=>{R(S.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(S)},availableFilters:L,size:X.buttonSize})]}),s&&e.jsx(n.Button,{size:"compact-md",h:32,style:{fontSize:`var(--mantine-font-size-${X.textSize})`,border:"none"},radius:"md",onClick:s,children:c})]})]}),L.length>0&&e.jsx(pe,{activeFilters:P.map(S=>S.filterTag),onFiltersChange:S=>{R(S.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(S)},availableFilters:L,size:"md",getFilterOptions:Y})]}),a,e.jsxs(n.Table,{striped:y,highlightOnHover:C,highlightOnHoverColor:"var(--mantine-color-gray-0)",mt:"xs",children:[e.jsx(n.Table.Thead,{children:e.jsx(n.Table.Tr,{children:t.map(S=>e.jsx(n.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:S.width,textAlign:S.align||"left",cursor:S.sortable?"pointer":"default"},onClick:()=>S.sortable&&H(S.key),children:e.jsxs(n.Group,{gap:"xs",wrap:"nowrap",children:[S.icon&&e.jsx(n.Box,{style:{display:"flex",alignItems:"center"},children:S.icon}),e.jsx(n.Text,{size:X.textSize,fw:500,children:S.label}),J(S.key)]})},String(S.key)))})}),e.jsx(n.Table.Tbody,{children:Q.length===0?e.jsx(n.Table.Tr,{children:e.jsx(n.Table.Td,{colSpan:t.length,ta:"center",py:"xl",children:e.jsx(n.Text,{c:"dimmed",children:u})})}):Q.map((S,z)=>e.jsx(n.Table.Tr,{style:{cursor:x?"pointer":"default"},onClick:()=>x==null?void 0:x(S),children:t.map(A=>e.jsx(n.Table.Td,{style:{textAlign:A.align||"left"},children:K(A,S)},String(A.key)))},S.id||z))})]}),k&&e.jsx(n.Box,{ref:B,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:O&&e.jsxs(n.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(n.Loader,{size:"sm",color:"gray.5"}),e.jsx(n.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more..."})]})})]})};Object.assign(ze,{});const An=({onAvatarSelect:o,onEmojiSelect:r,onImageSelect:t,onIconSelect:s}={})=>{const[a,c]=l.useState("emoji"),[i,u]=l.useState(null),[d,f]=l.useState(null),[p,m]=l.useState(null),[I,b]=l.useState(null),[v,g]=l.useState(null),x=l.useCallback(h=>{c(h)},[]),j=l.useCallback(h=>{u(h)},[]),y=l.useCallback(h=>{g(h);const D=new FileReader;D.onload=P=>{var B;const R=(B=P.target)==null?void 0:B.result;f(R)},D.readAsDataURL(h)},[]),C=l.useCallback(h=>{m(h),f(null),g(null),b(null),o==null||o({type:"emoji",value:h}),r==null||r(h)},[o,r]),k=l.useCallback(h=>{b(h),f(null),g(null),m(null),o==null||o({type:"icon",value:h}),s==null||s(h)},[o,s]),O=l.useCallback(()=>{if(v&&d){const h=URL.createObjectURL(v);o==null||o({type:"image",value:h}),t==null||t(v)}},[v,d,o,t]),T=l.useCallback(()=>{f(null),g(null),m(null),b(null)},[]),M=l.useCallback(()=>{f(null),m(null),b(null),g(null),c("emoji"),u(null)},[]);return{selectedTab:a,tabHovered:i,previewImage:d,selectedEmoji:p,selectedIcon:I,selectedFile:v,handleTabChange:x,handleTabHover:j,handleImagePreview:y,handleImageAccept:O,handleEmojiSelect:C,handleIconSelect:k,clearImagePreview:T,resetState:M}},En=({opened:o,onClose:r,popoverRef:t})=>{const s=l.useCallback(c=>{o&&t.current&&!t.current.contains(c.target)&&(console.log("Click outside detected, closing popover"),r())},[o,r,t]),a=l.useCallback(c=>{c.key==="Escape"&&o&&(console.log("Escape key pressed, closing popover"),r())},[o,r]);return l.useEffect(()=>{if(o)return document.addEventListener("mousedown",s),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",a)}},[o,s,a]),{handleClickOutside:s,handleEscape:a}},Ln=({selectedTab:o,tabHovered:r,onTabChange:t,onTabHover:s,onRemove:a,hasAvatar:c=!1,children:i})=>{const[u,d]=l.useState(!1);return e.jsxs(n.Tabs,{color:"black",value:o,styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(n.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",w:"100%",children:[e.jsx(n.Tabs.Tab,{value:"emoji",p:0,pb:"xs",onClick:()=>t("emoji"),onMouseEnter:()=>s("emoji"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(n.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:o==="emoji"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(n.Group,{gap:4,children:"Emoji"})})}),e.jsx(n.Tabs.Tab,{value:"icons",p:0,pb:"xs",onClick:()=>t("icons"),onMouseEnter:()=>s("icons"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(n.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:o==="icons"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(n.Group,{gap:4,children:"Icons"})})}),e.jsx(n.Tabs.Tab,{value:"image",p:0,pb:"xs",onClick:()=>t("image"),onMouseEnter:()=>s("image"),onMouseLeave:()=>s(null),style:{backgroundColor:"transparent"},children:e.jsx(n.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:o==="image"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(n.Group,{gap:4,children:"Image"})})}),a&&c&&e.jsx(n.Group,{justify:"flex-end",display:"flex",flex:1,pb:"xs",children:e.jsx(n.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:u?"var(--mantine-color-red-0)":"transparent",color:u?"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:()=>d(!0),onMouseLeave:()=>d(!1),children:"Remove"})})]}),e.jsx(n.Tabs.Panel,{value:"emoji",children:o==="emoji"?i:null}),e.jsx(n.Tabs.Panel,{value:"icons",children:o==="icons"?i:null}),e.jsx(n.Tabs.Panel,{value:"image",children:o==="image"?i:null})]})};let me=!1;me||(ye.init({data:ie}),me=!0);const Fn=()=>{const o=[{id:"frequent",name:"Frequently Used",icon:e.jsx(w.IconClock,{size:20,strokeWidth:2.5})}];return ie.categories.forEach(r=>{if(r.emojis&&r.emojis.length>0){let t=e.jsx(w.IconMoodSmile,{size:20,strokeWidth:2}),s=r.name;switch(r.id){case"people":t=e.jsx(w.IconMoodSmile,{size:20,strokeWidth:2}),s="Smileys & People";break;case"nature":t=e.jsx(w.IconTrees,{size:20,strokeWidth:2}),s="Animals & Nature";break;case"foods":t=e.jsx(w.IconApple,{size:20,strokeWidth:2}),s="Food & Drink";break;case"activity":t=e.jsx(w.IconBallBasketball,{size:20,strokeWidth:2}),s="Activities";break;case"travel":t=e.jsx(w.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"places":t=e.jsx(w.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"objects":t=e.jsx(w.IconBulb,{size:20,strokeWidth:2}),s="Objects";break;case"symbols":t=e.jsx(w.IconHeart,{size:20,strokeWidth:2}),s="Symbols";break;case"flags":t=e.jsx(w.IconFlag,{size:20,strokeWidth:2}),s="Flags";break;case"frequent":return;default:t=e.jsx(w.IconMoodSmile,{size:20,strokeWidth:2}),s=`Category: ${r.id}`;break}o.push({id:r.id,name:s,icon:t})}}),o},Nn=({onEmojiSelect:o,height:r=200})=>{const[t,s]=l.useState(""),[a,c]=l.useState("people"),[i,u]=l.useState(()=>{if(typeof window<"u"){const x=localStorage.getItem("emoji-frequent");return x?JSON.parse(x):[]}return[]}),[d,f]=l.useState([]),[p,m]=l.useState(!1),I=Fn();l.useEffect(()=>{t.trim()?(m(!0),ye.SearchIndex.search(t).then(x=>{f(x.map(j=>({id:j.id,native:j.skins[0].native,name:j.name,keywords:j.keywords}))),m(!1)})):f([])},[t]);const b=l.useMemo(()=>{if(t.trim())return d;if(a==="frequent")return i.map(j=>({id:j,native:j,name:"",keywords:[]}));const x=ie.categories.find(j=>j.id===a);return x?x.emojis.map(j=>{const y=ie.emojis[j];return{id:y.id,native:y.skins[0].native,name:y.name,keywords:y.keywords}}):[]},[t,a,i,d]),v=x=>{o(x),u(j=>{const y=j.filter(k=>k!==x),C=[x,...y].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(C)),C})},g=x=>{if(t.trim())return"Results";const j=I.find(y=>y.id===x);return j?j.name:x.charAt(0).toUpperCase()+x.slice(1)};return e.jsxs(n.Stack,{gap:0,style:{height:r,width:"100%"},children:[e.jsx(n.Box,{p:"sm",pb:"xs",children:e.jsxs(n.Stack,{gap:"xs",children:[e.jsx(n.TextInput,{placeholder:"Search emojis...",value:t,onChange:x=>s(x.target.value),leftSection:e.jsx(w.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(n.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:g(a)})]})}),e.jsx(n.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(n.ScrollArea,{h:"100%",type:"hover",offsetScrollbars:!1,children:e.jsx(n.Box,{style:{display:"grid",gridTemplateColumns:"repeat(9, 1fr)",gap:"0px",padding:"0px 12px 12px 12px"},children:p?e.jsx(n.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"Searching..."}):b.length>0?b.map(x=>e.jsx(n.Tooltip,{label:x.name||x.id,position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(n.Button,{variant:"subtle",size:"sm",p:0,onClick:()=>v(x.native),style:{width:"40px",height:"40px",fontSize:"22px",border:"none",backgroundColor:"transparent",borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:j=>{j.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:x.native})},x.id)):e.jsx(n.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"No emojis found"})})})}),e.jsx(n.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(n.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:I.map(x=>e.jsx(n.Tooltip,{label:x.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(n.Box,{onClick:()=>{c(x.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===x.id?"var(--mantine-color-gray-0)":"transparent",color:a===x.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.1s ease"},onMouseEnter:j=>{j.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:x.icon})},x.id))})})]})},De=["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"],Re=["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"],Be=["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"],Pe=["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"],Ae=["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"],Ee=["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"],Le=["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"],Fe=["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"];[...De,...Re,...Be,...Pe,...Ae,...Ee,...Le,...Fe];const ee=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:De},{id:"business",name:"Business & Work",icons:Re},{id:"tech",name:"Technology",icons:Be},{id:"expressions",name:"Expressions",icons:Pe},{id:"nature",name:"Nature & Animals",icons:Ae},{id:"shapes",name:"Shapes & Symbols",icons:Ee},{id:"actions",name:"Actions & Tools",icons:Le},{id:"communication",name:"Communication",icons:Fe}],Hn={recent:e.jsx(w.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(w.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(w.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(w.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(w.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(w.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(w.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(w.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(w.IconMessage,{size:20,strokeWidth:2.5})},Un=({selectedCategory:o,onCategoryChange:r})=>e.jsx(n.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:ee.map(t=>{const s=Hn[t.id];return e.jsx(n.Tooltip,{label:t.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(n.Box,{onClick:()=>r(t.id),style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",backgroundColor:o===t.id?"var(--mantine-color-gray-0)":"transparent",color:o===t.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=o===t.id?"var(--mantine-color-gray-0)":"transparent"},children:s})},t.id)})}),Ne=l.memo(({onIconSelect:o,height:r=358})=>{var x,j;const[t,s]=l.useState(""),[a,c]=l.useState("recent"),[i,u]=l.useState(!1),[d,f]=l.useState([]);l.useLayoutEffect(()=>{if(typeof window<"u"){const y=localStorage.getItem("avatar-icon-recent");if(y)try{f(JSON.parse(y))}catch(C){console.warn("Error parsing recent icons from localStorage:",C)}}},[]);const p=l.useMemo(()=>ee.filter(y=>y.id!=="recent"&&!("isDynamic"in y)).flatMap(y=>y.icons),[]),m=l.useMemo(()=>{if(a==="recent"){const C=new Set(p);return d.filter(k=>C.has(k))}const y=ee.find(C=>C.id===a);return(y==null?void 0:y.icons)||[]},[a,d,p]),I=l.useCallback((y,C)=>{if(!y.trim())return C;const k=y.toLowerCase().trim(),O=k.split(/\s+/);return C.filter(T=>{const h=T.replace(/^Icon/,"").split(/(?=[A-Z])/).map(D=>D.toLowerCase().trim()).filter(D=>D.length>0);return!!(h.some(D=>O.some(P=>D===P))||k.length>2&&h.some(D=>O.some(P=>D.startsWith(P)))||k.length<=2&&h.some(D=>O.some(P=>D.includes(P)))||O.length>1&&O.every(D=>h.some(P=>P===D||P.startsWith(D))))})},[]),b=l.useMemo(()=>t.trim()?I(t,p):m,[t,m,p,I]),v=l.useCallback(y=>{p.includes(y)&&f(k=>{const O=[y,...k.filter(T=>T!==y)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(O)),O}),o(y)},[o,p]),g=l.useCallback(y=>{a!==y&&(s(""),c(y),requestAnimationFrame(()=>{u(!0),setTimeout(()=>u(!1),100)}))},[a]);return e.jsxs(n.Stack,{gap:0,style:{height:r,width:"100%"},children:[e.jsx(n.Box,{p:"sm",pb:"xs",children:e.jsxs(n.Stack,{gap:"xs",children:[e.jsx(n.TextInput,{placeholder:t.trim()?"Search all icons...":`Search in ${(x=ee.find(y=>y.id===a))==null?void 0:x.name}...`,value:t,onChange:y=>s(y.target.value),leftSection:e.jsx(w.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(n.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:t.trim()?"Results":(j=ee.find(y=>y.id===a))==null?void 0:j.name})]})}),e.jsx(n.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(n.ScrollArea,{h:"100%",type:"hover",children:e.jsx(n.Box,{style:{display:"grid",gridTemplateColumns:"repeat(8, 1fr)",gap:"4px",padding:"0 12px 12px 12px",opacity:i?.7:1,transition:"opacity 0.05s ease"},children:b.map(y=>e.jsx(je,{iconName:y,onClick:()=>v(y),size:20},t.trim()?`search-${y}`:`${a}-${y}`))},`${a}-${t}`)})}),e.jsx(n.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(Un,{selectedCategory:a,onCategoryChange:g})})]})});Ne.displayName="IconGrid";const Wn=({previewImage:o,fileInputRef:r,selectedEmoji:t,size:s,loading:a,onFileInputClick:c,onImageChange:i,onImageAccept:u,onClearImagePreview:d})=>e.jsx(n.Box,{p:"sm",style:{width:"384px"},children:e.jsxs(n.Stack,{gap:"md",align:"center",children:[o||t?e.jsxs(n.Box,{children:[e.jsx(n.Text,{size:"sm",fw:500,mb:"xs",children:"Preview"}),e.jsx(n.Avatar,{src:o,radius:"md",style:{width:`${_(s)}px !important`,height:`${_(s)}px !important`,minWidth:`${_(s)}px`,minHeight:`${_(s)}px`,maxWidth:`${_(s)}px`,maxHeight:`${_(s)}px`,border:"1px solid var(--mantine-color-gray-4)",objectFit:"cover",boxSizing:"border-box"},children:t})]}):e.jsx(n.Button,{variant:"subtle",bg:"gray.0",styles:{root:{height:"64px"}},leftSection:e.jsx(w.IconPhoto,{size:20}),onClick:c,loading:a,disabled:a,fullWidth:!0,children:"Choose Image"}),o||t?e.jsx(n.Button,{variant:"outline",leftSection:e.jsx(w.IconPhoto,{size:16}),onClick:c,loading:a,disabled:a,fullWidth:!0,children:o||t?"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 p;return i(((p=f.target.files)==null?void 0:p[0])||null)},style:{display:"none"},disabled:a}),(o||t)&&e.jsxs(n.Group,{gap:"sm",w:"100%",children:[e.jsx(n.Button,{variant:"outline",color:"gray",onClick:d,fullWidth:!0,children:"Back"}),e.jsx(n.Button,{color:"blue",onClick:u,loading:a,disabled:a,fullWidth:!0,children:"Accept"})]}),e.jsx(n.Text,{size:"xs",c:"var(--mantine-color-gray-6)",ta:"center",children:"Supported formats: JPG, PNG, GIF, WebP"})]})}),$n=({onEmojiSelect:o})=>e.jsx(Nn,{onEmojiSelect:o,height:358}),Gn=({onIconSelect:o})=>e.jsx(Ne,{onIconSelect:o,height:358}),Qn=({previewImage:o,selectedEmoji:r,size:t,loading:s,onFileInputClick:a,onImageChange:c,onImageAccept:i,onClearImagePreview:u,fileInputRef:d})=>e.jsx(Wn,{previewImage:o,fileInputRef:d,selectedEmoji:r,size:t,loading:s,onFileInputClick:a,onImageChange:c,onImageAccept:i,onClearImagePreview:u}),Vn=()=>e.jsx(n.Box,{style:{width:400,height:358,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs(n.Stack,{align:"center",gap:"sm",children:[e.jsx(n.Loader,{size:"sm"}),e.jsx(n.Text,{size:"sm",c:"gray.6",children:"Loading avatar options..."})]})}),qn=({opened:o,onOpen:r,onClose:t,avatar:s,onAvatarSelect:a,onRemove:c,onEmojiSelect:i,onImageSelect:u,onIconSelect:d,size:f="lg",loading:p=!1,placeholder:m,showPlaceholder:I=!0,position:b="bottom-start",withinPortal:v=!0,zIndex:g=1e3})=>{const x=l.useRef(null),j=l.useRef(null),y=l.useRef(null),{selectedTab:C,tabHovered:k,previewImage:O,selectedEmoji:T,selectedIcon:M,selectedFile:h,handleTabChange:D,handleTabHover:P,handleImagePreview:R,handleImageAccept:B,handleEmojiSelect:L,handleIconSelect:Q,clearImagePreview:V,resetState:H}=An({onAvatarSelect:a,onEmojiSelect:i,onImageSelect:u,onIconSelect:d});En({opened:o,onClose:t,popoverRef:j}),l.useEffect(()=>{o||H()},[o,H]);const Y=U=>{console.log("Emoji clicked:",U),L(U),t()},K=U=>{console.log("Icon clicked:",U),Q(U),t()},J=U=>{U&&R(U)},F=()=>{h?(B(),t()):(T||M)&&t()},X=()=>{x.current&&x.current.click()},S=()=>{V()},z=()=>{console.log("Avatar removed"),c==null||c(),t()},A=()=>!!s,E=()=>p?e.jsx(ce,{size:f,loading:!0}):e.jsx(Z,{avatar:s,size:f,placeholder:m,showPlaceholder:I,editable:!0,onClick:()=>{!p&&!o&&r()}}),W=e.jsx($n,{onEmojiSelect:Y}),q=e.jsx(Gn,{onIconSelect:K}),te=e.jsx(Qn,{previewImage:O,selectedEmoji:T,size:f,loading:p,onFileInputClick:X,onImageChange:J,onImageAccept:F,onClearImagePreview:S,fileInputRef:x}),re=e.jsx(n.Box,{children:e.jsx(Ln,{selectedTab:C,tabHovered:k,onTabChange:D,onTabHover:P,onRemove:z,hasAvatar:A(),children:C==="emoji"?W:C==="icons"?q:te})});return e.jsx("div",{style:{position:"relative",display:"inline-block"},children:e.jsxs(n.Popover,{opened:o,onClose:()=>{console.log("Popover onClose called"),t()},position:b,withinPortal:v,withArrow:!0,shadow:"md",radius:"md",closeOnClickOutside:!1,closeOnEscape:!1,offset:8,transitionProps:{transition:"fade",duration:150},children:[e.jsx(n.Popover.Target,{children:e.jsx("div",{ref:y,style:{position:"relative"},children:E()})}),e.jsx(n.Popover.Dropdown,{ref:j,p:0,style:{width:"auto",overflow:"hidden",zIndex:g},children:e.jsx(l.Suspense,{fallback:e.jsx(Vn,{}),children:re})})]})})},_n=o=>{if(!o||typeof o!="string")return!1;const r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return o.length<5||o.length>254?!1:r.test(o.trim())},Zn=o=>{const r=[];return o.forEach(t=>{_n(t)||r.push({email:t,error:"Please enter a valid email address"})}),{isValid:r.length===0,errors:r}},Yn=o=>{const r=[],t=new Set;return o.forEach(s=>{const a=s.toLowerCase().trim();t.has(a)?r.push({email:s,error:"This email has already been added"}):t.add(a)}),r},Xn=o=>{const r=Zn(o),t=Yn(o),s=[...r.errors,...t];return{isValid:s.length===0,errors:s}},Kn=({value:o,onChange:r,onInputChange:t,suggestedUsers:s=[],tagDisplayMap:a={}})=>{const[c,i]=l.useState(""),[u,d]=l.useState([]),f=l.useRef(null),p=o.map(g=>{if(a[g])return a[g];const x=s.find(j=>j.email===g);return x&&x.name?x.name:g});l.useEffect(()=>{t&&t(c)},[c,t]),l.useEffect(()=>{if(o.length>0){const g=Xn(o);d(g.errors)}else d([])},[o]),l.useEffect(()=>{const g=f.current;if(!g)return;let x;const j=y=>{const k=y.target.value||"";clearTimeout(x),x=setTimeout(()=>{i(k)},150)};return g.addEventListener("input",j),()=>{g.removeEventListener("input",j),clearTimeout(x)}},[]);const m=l.useCallback(g=>{const x=s.map(y=>({name:y.name||y.email,email:y.email})),j=g.map(y=>{const C=x.find(k=>k.name.toLowerCase()===y.toLowerCase());return C?C.email:y}).filter(y=>y.includes("@")?!0:!x.some(k=>{const O=k.name.toLowerCase(),T=y.toLowerCase();return O.startsWith(T)&&T!==O}));r(j),i("")},[r,s]),I=l.useCallback(()=>{f.current&&(f.current.value="",i(""))},[]),b=u.length===0&&o.length>0,v=l.useCallback((g,x,j)=>{g&&o.length>0&&x&&(g(o,x,j),i(""))},[o]);return{inputText:c,tagsInputRef:f,displayValue:p,validationErrors:u,isValid:b,handleEmailChange:m,clearInput:I,handleInvite:v}},He=({onInvite:o,onUpdateRole:r,onRemoveUser:t,invitedUsers:s=[],suggestedUsers:a=[],roleOptions:c=[]})=>{const[i,u]=l.useState([]),[d,f]=l.useState([]),[p,m]=l.useState(""),[I,b]=l.useState({}),v=c.length>0?c[0].value:void 0,[g,x]=l.useState(v);l.useEffect(()=>{c.length>0&&!g&&x(c[0].value)},[c.length,g]),l.useEffect(()=>{const R=a.filter(B=>i.includes(B.email)).map(B=>B.id);f(B=>B.filter(L=>R.includes(L)))},[i,a.length]);const[j,y]=l.useState("invite"),[C,k]=l.useState(null),O=(R,B,L)=>{o&&o(R,B,L),u([]),m("")},T=(R,B)=>{r&&r(R,B)},M=R=>{t&&t(R)},h=R=>{f(B=>B.includes(R)?B.filter(L=>L!==R):[...B,R])},D=R=>{i.includes(R.email)||(u([...i,R.email]),b(B=>({...B,[R.email]:R.name||R.email})),d.includes(R.id)||f([...d,R.id]),m(""))},P=p.trim()?a.filter(R=>{var L;const B=p.toLowerCase();return R.email.toLowerCase().includes(B)||((L=R.name)==null?void 0:L.toLowerCase().includes(B))}):[];return{emails:i,setEmails:u,selectedUsers:d,setSelectedUsers:f,inputText:p,setInputText:m,tagDisplayMap:I,setTagDisplayMap:b,selectedRole:g,setSelectedRole:x,selectedTab:j,setSelectedTab:y,tabHovered:C,setTabHovered:k,filteredUsers:P,handleInvite:O,handleUpdateRole:T,handleRemoveUser:M,handleToggleUser:h,handleAddSuggestedUser:D}},Ue=l.forwardRef(({value:o,onChange:r,placeholder:t="Add one or more emails",onInvite:s,roleOptions:a=[],selectedRole:c,onRoleChange:i,onInputChange:u,suggestedUsers:d=[],tagDisplayMap:f={}},p)=>{const[m,I]=l.useState("Hello, I would like to invite you to join my workspace"),{tagsInputRef:b,displayValue:v,validationErrors:g,isValid:x,handleEmailChange:j,clearInput:y,handleInvite:C}=Kn({value:o,onChange:r,onInputChange:u,suggestedUsers:d,tagDisplayMap:f}),k=()=>{C(s,c,m),I("")};l.useImperativeHandle(p,()=>({clearInput:y}),[y]);const O=v.length>0,T=i&&a.length>0,M=g.length>0;return e.jsxs(n.Stack,{gap:"md",children:[e.jsxs(n.Box,{children:[e.jsx(n.Box,{style:{maxHeight:"120px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(n.TagsInput,{ref:b,value:v,onChange:j,placeholder:O?"":t,radius:"md",rightSection:T?e.jsx(n.Box,{style:{position:"absolute",right:"8px",top:"17px",transform:"translateY(-50%)",height:"24px",display:"flex",alignItems:"center"},children:e.jsx(le,{value:c||"",onChange:h=>i(h),data:a,placeholder:"Select role",defaultOption:a[a.length-1],disabledOptions:["owner"]})}):null,rightSectionProps:{style:{width:T?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:T?"130px":"12px",minHeight:"36px",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",borderRadius:"var(--mantine-radius-md)",border:M?"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:M?"var(--mantine-color-red-1) !important":"var(--mantine-color-orange-1) !important",color:M?"var(--mantine-color-red-7) !important":"var(--mantine-color-gray-7) !important",fontSize:"var(--mantine-font-size-sm)"}}})}),M&&e.jsx(n.Stack,{gap:"xs",mt:"xs",children:g.map((h,D)=>e.jsxs(n.Text,{size:"xs",c:"red",children:[h.email,": ",h.error]},D))})]}),O&&e.jsxs(n.Stack,{gap:"sm",children:[e.jsx(n.Textarea,{size:"sm",value:m,onChange:h=>I(h.currentTarget.value),minRows:2,maxRows:4,radius:"md"}),e.jsx(n.Button,{variant:"filled",color:"blue",onClick:k,fullWidth:!0,radius:"md",disabled:!x,children:"Send invitations"})]})]})}),Jn=o=>{switch(o){case"member":return"green";case"invited":return"orange";case"declined":return"red";case"revoked":return"red";case"expired":return"red";default:return"gray"}},eo=o=>{switch(o){case"member":return"Member";case"invited":return"Invited";case"declined":return"Declined";case"revoked":return"Revoked";case"expired":return"Expired";default:return"Unknown"}},no=o=>{if(o){if(typeof o=="object"&&"type"in o)return o;if(typeof o=="string")return{type:"image",value:o}}},oe=({user:o,isSelected:r=!1,onToggle:t,onUpdateRole:s,onRemoveUser:a,roleOptions:c=[],variant:i="invited",onClick:u})=>{var x;const d=((x=o.name)==null?void 0:x.trim())||o.email,f=()=>{t&&t(o.id)},p=j=>{if(s){const y=j;s(o.id,y)}},m=i==="suggested"||i==="read-only",I=i==="invited"&&c.length>0,[b,v]=l.useState(!1),g=()=>{u==null||u()};return e.jsxs(n.Group,{justify:"space-between",align:"center",wrap:"nowrap",w:"100%",style:{cursor:"pointer",borderRadius:"var(--mantine-radius-md)",padding:"6px"},onClick:g,bg:b?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[e.jsxs(n.Group,{gap:"sm",w:"100%",align:"flex-start",wrap:"nowrap",children:[e.jsx(Z,{avatar:no(o.avatar),size:"md",placeholder:d,showPlaceholder:!0}),e.jsxs(n.Stack,{gap:0,w:"100%",justify:"flex-start",align:"flex-start",children:[e.jsxs(n.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsxs(n.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsx(n.Text,{size:"sm",fw:500,lineClamp:1,mb:-2,children:d}),o.isCurrentUser&&e.jsx(n.Badge,{size:"xs",variant:"light",color:"gray",radius:"sm",children:"Owner"})]}),o.status!=="member"&&e.jsx(n.Badge,{size:"xs",variant:"light",color:Jn(o.status),radius:"sm",children:eo(o.status)})]}),e.jsx(n.Text,{size:"xs",c:"dimmed",lineClamp:1,children:o.email})]})]}),e.jsxs(n.Group,{gap:"sm",align:"center",children:[m&&i!=="read-only"&&e.jsx(n.Radio,{checked:r,onChange:f,size:"sm",onClick:j=>j.stopPropagation(),pr:4}),I&&!o.isCurrentUser&&e.jsx(le,{value:o.role,onChange:p,data:c,placeholder:"Select role",defaultOption:c.find(j=>j.value===o.role),withRemove:!0,onRemove:()=>a==null?void 0:a(o.id)})]})]})},We=({opened:o,onClose:r,onInvite:t,onUpdateRole:s,onRemoveUser:a,invitedUsers:c=[],children:i,roleOptions:u=[],suggestedUsers:d=[]})=>{const f=l.useRef(null),{emails:p,setEmails:m,selectedUsers:I,inputText:b,setInputText:v,tagDisplayMap:g,selectedRole:x,setSelectedRole:j,selectedTab:y,setSelectedTab:C,tabHovered:k,setTabHovered:O,filteredUsers:T,handleInvite:M,handleUpdateRole:h,handleRemoveUser:D,handleToggleUser:P,handleAddSuggestedUser:R}=He({onInvite:t,onUpdateRole:s,onRemoveUser:a,invitedUsers:c,suggestedUsers:d,roleOptions:u}),B=H=>{R(H),f.current&&f.current.clearInput()},L=e.jsxs(e.Fragment,{children:[e.jsx(Ue,{ref:f,value:p,onChange:m,onInvite:M,roleOptions:u,selectedRole:x,onRoleChange:j,onInputChange:v,suggestedUsers:d,tagDisplayMap:g}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.ScrollArea,{mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(n.Box,{children:c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(n.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.Stack,{gap:"sm",children:c.map(H=>e.jsx(oe,{user:H,isSelected:I.includes(H.id),onToggle:P,onUpdateRole:h,onRemoveUser:D,roleOptions:u,variant:"invited"},H.id))})]})})}),T.length>0&&e.jsx(n.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(n.Box,{children:T.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(n.Text,{size:"sm",fw:500,children:["Suggested ",b.trim()&&`(filtered by "${b}")`]}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.Stack,{gap:"sm",children:T.map(H=>e.jsx(oe,{user:H,isSelected:I.includes(H.id),onToggle:P,onUpdateRole:h,onRemoveUser:D,roleOptions:u,variant:"suggested",onClick:()=>B(H)},H.id))})]}):null})})]}),Q=e.jsx(e.Fragment,{children:e.jsxs(n.Stack,{gap:"md",p:"sm",children:[e.jsxs(n.Stack,{gap:4,align:"center",children:[e.jsx(n.Text,{size:"sm",fw:500,ta:"center",children:"Publish to the web"}),e.jsx(n.Text,{size:"sm",fw:500,color:"var(--mantine-color-gray-6)",ta:"center",children:"Anyone with the link can view this page"})]}),e.jsx(n.Button,{variant:"filled",size:"xs",radius:"md",fw:500,fz:"var(--mantine-font-size-sm)",ta:"center",children:"Publish"})]})}),V=e.jsx(n.Box,{style:{width:"400px",maxHeight:"600px",overflow:"visible"},children:e.jsx(n.Stack,{gap:"lg",children:e.jsxs(n.Tabs,{color:"black",defaultValue:"invite",styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(n.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",children:[e.jsx(n.Tabs.Tab,{value:"invite",p:0,pb:6,onClick:()=>{C("invite")},onMouseEnter:()=>O("invite"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(n.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:k==="invite"?"var(--mantine-color-gray-1)":"transparent",color:y==="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(n.Tabs.Tab,{value:"publish",p:0,pb:6,onClick:()=>{C("publish")},onMouseEnter:()=>O("publish"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(n.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:k==="publish"?"var(--mantine-color-gray-1)":"transparent",color:y==="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(n.Tabs.Panel,{value:"invite",children:e.jsx(n.Box,{p:"sm",children:L})}),e.jsx(n.Tabs.Panel,{value:"publish",children:e.jsx(n.Box,{p:"sm",children:Q})})]})})});return e.jsx(ne,{trigger:i,menuItems:[],opened:o,onClose:r,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:V})},oo=({onInvite:o,onUpdateRole:r,onRemoveUser:t,invitedUsers:s,currentUser:a,roleOptions:c,suggestedUsers:i,label:u="Share"})=>{const[d,f]=l.useState(!1),p=()=>f(!1),m=e.jsx(ke,{label:u,onClick:()=>f(!0),isActive:d});return e.jsx(We,{opened:d,onClose:p,onInvite:o,onUpdateRole:r,onRemoveUser:t,invitedUsers:s,currentUser:a,roleOptions:c,suggestedUsers:i,children:m})},to=({opened:o,onClose:r,onInvite:t,onUpdateRole:s,onRemoveUser:a,invitedUsers:c=[],roleOptions:i=[],suggestedUsers:u=[]})=>{const d=l.useRef(null),{emails:f,setEmails:p,selectedUsers:m,inputText:I,setInputText:b,tagDisplayMap:v,selectedRole:g,setSelectedRole:x,filteredUsers:j,handleInvite:y,handleUpdateRole:C,handleRemoveUser:k,handleToggleUser:O,handleAddSuggestedUser:T}=He({onInvite:t,onUpdateRole:s,onRemoveUser:a,invitedUsers:c,suggestedUsers:u,roleOptions:i}),M=h=>{T(h),d.current&&d.current.clearInput()};return e.jsx(n.Modal,{opened:o,onClose:r,size:"md",withCloseButton:!1,radius:"md",centered:!0,closeOnClickOutside:!1,closeOnEscape:!0,trapFocus:!1,zIndex:300,children:e.jsxs(n.Stack,{gap:"lg",children:[e.jsxs(n.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(n.Text,{size:"md",fw:500,c:"var(--mantine-color-gray-8)",children:"Share"}),e.jsx(N,{icon:w.IconX,size:"md",onClick:r,color:"var(--mantine-color-gray-8)"})]}),e.jsx(Ue,{ref:d,value:f,onChange:p,onInvite:y,roleOptions:i,selectedRole:g,onRoleChange:x,onInputChange:b,suggestedUsers:u,tagDisplayMap:v}),c.length>0&&e.jsxs(n.Box,{children:[e.jsx(n.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(n.Stack,{gap:"sm",children:c.map(h=>e.jsx(oe,{user:h,isSelected:m.includes(h.id),onToggle:O,onUpdateRole:C,onRemoveUser:k,roleOptions:i,variant:"invited"},h.id))})})]}),j.length>0&&e.jsxs(n.Box,{children:[e.jsxs(n.Text,{size:"sm",fw:500,children:["Suggested ",I.trim()&&`(filtered by "${I}")`]}),e.jsx(n.Space,{h:"sm"}),e.jsx(n.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(n.Stack,{gap:"sm",children:j.map(h=>e.jsx(oe,{user:h,isSelected:m.includes(h.id),onToggle:O,onUpdateRole:C,onRemoveUser:k,roleOptions:i,variant:"suggested",onClick:()=>M(h)},h.id))})})]})]})})},ro=({opened:o,onClose:r,options:t=[],onSave:s,onCancel:a,groups:c=[],styles:i})=>{const[u,d]=l.useState("");l.useEffect(()=>{o&&t.length>0?d(t[0].id):o||d("")},[o,t]);const f=()=>{s&&s(),r()},p=()=>{a&&a(),r()},m=()=>{r()},I=t.find(b=>b.id===u);return e.jsxs(n.Modal,{opened:o,onClose:m,size:"90%",centered:!0,closeOnClickOutside:!0,closeOnEscape:!0,withCloseButton:!1,p:"none",styles:{body:{...i==null?void 0:i.body,padding:0,height:"80vh"}},radius:"md",children:[e.jsx(n.FocusTrap.InitialFocus,{}),e.jsxs(n.Box,{style:{display:"flex",height:"100%",...i==null?void 0:i.body},children:[e.jsx(n.Box,{style:{width:"240px",backgroundColor:"var(--mantine-color-gray-0)"},children:e.jsx(n.ScrollArea,{h:"100%",children:e.jsx(n.Stack,{gap:0,p:"sm",children:c.map(b=>e.jsx(n.Box,{mb:"md",children:e.jsxs(l.Fragment,{children:[e.jsx(n.Text,{size:"xs",fw:600,c:"dimmed",m:4,children:b}),t.filter(v=>v.group===b).map(v=>e.jsx(Ie,{label:v.label,icon:v.icon,onClick:()=>d(v.id),isActive:u===v.id},v.id))]},b)}))})})}),e.jsxs(n.Box,{style:{flex:1,display:"flex",flexDirection:"column"},children:[I?e.jsxs(e.Fragment,{children:[e.jsx(n.Box,{p:"md",children:e.jsx(n.Group,{gap:"md",wrap:"nowrap",children:e.jsxs(n.Stack,{gap:4,children:[e.jsx(n.Text,{size:"md",fw:600,children:I.alternateLabel||I.label}),I.description&&e.jsx(n.Text,{size:"sm",c:"var(--mantine-color-gray-6)",children:I.description})]})})}),e.jsx(n.ScrollArea,{style:{flex:1},children:e.jsx(n.Box,{px:"md",children:I.content})})]}):e.jsx(n.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:e.jsx(n.Text,{c:"var(--mantine-color-gray-6)",size:"lg",children:"Select an option from the sidebar"})}),(I==null?void 0:I.saveButton)&&e.jsx(n.Box,{p:"md",children:e.jsxs(n.Group,{justify:"flex-end",gap:"md",children:[e.jsx(n.Button,{variant:"subtle",onClick:p,color:"gray",children:"Cancel"}),e.jsx(n.Button,{onClick:f,color:"blue",children:"Save Changes"})]})})]})]})]})},so=(o,r="es")=>{const t=new Date,s=typeof o=="string"?new Date(o):o,a=Math.floor((t.getTime()-s.getTime())/1e3),c={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"}},i=c[r]||c.en;if(a<5)return i.now;if(a<60)return r==="es"?`${i.ago} ${a} ${a===1?i.second:i.seconds}`:`${a} ${a===1?i.second:i.seconds} ${i.ago}`;const u=Math.floor(a/60);if(u<60)return r==="es"?`${i.ago} ${u} ${u===1?i.minute:i.minutes}`:`${u} ${u===1?i.minute:i.minutes} ${i.ago}`;const d=Math.floor(u/60);if(d<24)return r==="es"?`${i.ago} ${d} ${d===1?i.hour:i.hours}`:`${d} ${d===1?i.hour:i.hours} ${i.ago}`;const f=Math.floor(d/24);if(f<7)return r==="es"?`${i.ago} ${f} ${f===1?i.day:i.days}`:`${f} ${f===1?i.day:i.days} ${i.ago}`;const p=Math.floor(f/7);if(p<4)return r==="es"?`${i.ago} ${p} ${p===1?i.week:i.weeks}`:`${p} ${p===1?i.week:i.weeks} ${i.ago}`;const m=Math.floor(f/30);if(m<12)return r==="es"?`${i.ago} ${m} ${m===1?i.month:i.months}`:`${m} ${m===1?i.month:i.months} ${i.ago}`;const I=Math.floor(f/365);return r==="es"?`${i.ago} ${I} ${I===1?i.year:i.years}`:`${I} ${I===1?i.year:i.years} ${i.ago}`},ao=(o,r="es")=>{const t=typeof o=="string"?new Date(o):o,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"]},c=(s[r]||s.en)[t.getMonth()],i=t.getDate();return r==="es"?`${i} ${c}`:`${c} ${i}`},io=o=>{const r=typeof o=="string"?new Date(o):o,t=new Date;return r.toDateString()===t.toDateString()},co=o=>{const r=typeof o=="string"?new Date(o):o,t=new Date;return t.setDate(t.getDate()-1),r.toDateString()===t.toDateString()},lo=(o,r="es")=>io(o)?r==="es"?"Hoy":"Today":co(o)?r==="es"?"Ayer":"Yesterday":so(o,r),uo=({notification:o,message:r,markAsRead:t,archiveNotification:s,children:a,actions:c})=>{var p,m,I,b,v;const i=new Date().getTime()-new Date(o.timestamp).getTime()<6048e5?lo(o.timestamp,"en"):ao(o.timestamp,"en"),[u,d]=l.useState(!1),f=e.jsxs(n.Group,{bg:"var(--mantine-color-gray-1)",p:4,style:{borderRadius:"var(--mantine-radius-md)"},w:"auto",wrap:"nowrap",gap:0,children:[!o.isRead&&e.jsx(N,{onClick:()=>t(o.id),icon:w.IconCheck}),!o.isArchived&&e.jsx(N,{onClick:()=>s(o.id),icon:w.IconArchive})]});return e.jsxs(n.Box,{p:"sm",bg:u?"var(--mantine-color-gray-0)":"white",style:{cursor:"pointer",borderTop:"1px solid var(--mantine-color-gray-2)"},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[e.jsxs(n.Group,{justify:"space-between",align:"flex-start",gap:"sm",wrap:"nowrap",style:{margin:0},children:[(p=o.metadata)!=null&&p.avatar_url?e.jsx(n.Avatar,{name:(m=o.metadata)==null?void 0:m.fullname,size:"sm",radius:"md",src:(I=o.metadata)==null?void 0:I.avatar_url}):e.jsx(Me,{size:"xs",showText:!1,radius:"xs"}),e.jsxs(n.Stack,{gap:"xs",justify:"flex-start",w:"100%",children:[e.jsx(n.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(n.Text,{size:"xs",c:"dimmed",fw:500,style:{whiteSpace:"nowrap"},children:[o.category?((b=o.category)==null?void 0:b.charAt(0).toUpperCase())+((v=o.category)==null?void 0:v.slice(1)):""," ","• ",i]})]}),u?f:!o.isRead&&e.jsx(n.Indicator,{color:"var(--mantine-color-blue-6)",size:10,position:"top-end"})]}),a,c&&e.jsx(n.Group,{justify:"flex-start",align:"flex-start",gap:"xs",wrap:"nowrap",pl:36,pt:8,children:c})]})},fo=(o,r,t,s,a)=>{const[c,i]=l.useState(!1),u=l.useRef(null),d=l.useRef(null),f=l.useRef(null);l.useEffect(()=>{i(o)},[o]);const p=l.useCallback(I=>{I[0].isIntersecting&&s&&!a&&t&&t()},[s,a,t]),m=l.useCallback(()=>{if(!(!u.current||!o||!r||!t)){d.current&&(d.current.disconnect(),d.current=null);try{const I=new IntersectionObserver(p,{threshold:.1,rootMargin:"50px"});I.observe(u.current),d.current=I}catch(I){console.error("Failed to setup intersection observer:",I)}}},[o,r,t,p]);return l.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),!o||!r||!t){d.current&&(d.current.disconnect(),d.current=null);return}if(!u.current){f.current=setTimeout(()=>m(),50);return}return m(),()=>{f.current&&(clearTimeout(f.current),f.current=null),d.current&&(d.current.disconnect(),d.current=null)}},[o,r,t,m]),l.useEffect(()=>()=>{f.current&&clearTimeout(f.current),d.current&&d.current.disconnect()},[]),{isActive:c,loadMoreRef:u}},po=({notifications:o,isLoading:r=!1,isLoadingMore:t=!1,hasMore:s=!1,unreadCount:a=0,markAllAsRead:c,archiveAllNotifications:i,markAsRead:u,archiveNotification:d,loadMore:f,onFilterChange:p,currentFilter:m="all",customRenderer:I,opened:b=!1,onOpen:v=()=>{},onClose:g=()=>{},enableInfiniteScroll:x=!0})=>{const j=[{children:"Mark all as read",leftSection:e.jsx(w.IconChecklist,{size:16}),onClick:()=>c()},{children:"Archive all",leftSection:e.jsx(w.IconArchive,{size:16}),onClick:()=>i()}],y=[{children:"All",leftSection:e.jsx(w.IconChecklist,{size:16}),onClick:()=>p==null?void 0:p("all"),active:m==="all"},{children:"Unread",leftSection:e.jsx(w.IconChecklist,{size:16}),onClick:()=>p==null?void 0:p("unread"),active:m==="unread"},{children:"Archived",leftSection:e.jsx(w.IconArchive,{size:16}),onClick:()=>p==null?void 0:p("archived"),active:m==="archived"}],C=T=>I&&T.category&&["welcome","upgrade"].includes(T.category)?I(T,u,d):e.jsx(uo,{notification:T,markAsRead:u,archiveNotification:d,message:T.message,actions:T.actions},T.id),{isActive:k,loadMoreRef:O}=fo(b,x,f||(()=>{}),s,t);return e.jsxs(e.Fragment,{children:[e.jsx(Ie,{isActive:k,icon:e.jsx(w.IconBell,{strokeWidth:2,color:"var(--mantine-color-gray-7)"}),onClick:()=>{b?g():v()},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(n.Drawer,{opened:b,onClose:g,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(n.FocusTrap.InitialFocus,{}),e.jsxs(n.Box,{p:0,h:"100%",style:{display:"flex",flexDirection:"column"},children:[e.jsx(n.Box,{style:{position:"sticky",top:0,zIndex:10,backgroundColor:"var(--mantine-color-white)"},children:e.jsxs(n.Group,{justify:"space-between",align:"center",gap:"xs",style:{borderRadius:"var(--mantine-radius-md)"},px:"sm",py:"md",children:[e.jsx(n.Text,{size:"sm",fw:500,children:"Inbox"}),e.jsxs(n.Group,{gap:"xs",children:[e.jsx(ne,{position:"bottom-end",menuItems:y,trigger:e.jsx(N,{icon:w.IconFilter})}),e.jsx(ne,{position:"bottom-end",menuItems:j,trigger:e.jsx(N,{onClick:()=>{},icon:w.IconDots,changeIconOnHover:!0,iconHovered:w.IconDots})})]})]})}),e.jsxs(n.Box,{style:{flex:1,overflow:"auto"},children:[r&&o.length===0?e.jsx(n.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:e.jsx(n.Loader,{})}):o.length>0?e.jsx(n.Stack,{gap:0,children:o.map(T=>C(T))}):e.jsxs(n.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(w.IconInbox,{size:24,color:"var(--mantine-color-gray-6)"}),e.jsx(n.Text,{size:"sm",fw:500,c:"dimmed",ta:"center",mt:"sm",children:"No new updates"})]}),e.jsx(n.Box,{ref:O,style:{padding:"16px",display:x?"flex":"none",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:t&&e.jsxs(n.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(n.Loader,{size:"sm",color:"gray.5"}),e.jsx(n.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]})}),t&&!x&&e.jsxs(n.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(n.Loader,{size:"sm",color:"gray.5"}),e.jsx(n.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]}),!x&&s&&f&&e.jsx(n.Button,{color:"var(--mantine-color-gray-3)",variant:"subtle",onClick:f,loading:t,disabled:t,style:{alignSelf:"center"},children:t?"Loading...":"Load More"})]})]})]})]})},Io=({header:o,body:r,footer:t,withBorder:s=!0,position:a="left",bg:c="var(--mantine-color-gray-0)"})=>{const[i,u]=l.useState(!1),d=()=>{if(!s)return{};const f="var(--mantine-color-gray-3)",p="1px";return a==="left"?{borderRight:`${p} solid ${f}`}:a==="right"?{borderLeft:`${p} solid ${f}`}:{}};return e.jsxs(n.Stack,{gap:"sm",h:"100%",p:"sm",bg:c,style:d(),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[o&&e.jsx(n.Box,{children:typeof o=="function"?o({hovered:i}):o}),r&&e.jsx(n.Box,{style:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:typeof r=="function"?r({hovered:i}):r}),t&&e.jsx(n.Box,{children:typeof t=="function"?t({hovered:i}):t})]})},$e=l.createContext(void 0),ho=({children:o})=>{const[r,{open:t,close:s}]=ae.useDisclosure(!1),a={openedNotificationSidebar:r,openNotificationSidebar:t,closeNotificationSidebar:s};return e.jsx($e.Provider,{value:a,children:o})},xo=()=>{const o=l.useContext($e);if(o===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return o},Ge=({workspace:o,currentUserId:r,currentWorkspaceId:t,onClick:s})=>{const a=t===o.id,c=r&&o.ownerId===r;return e.jsxs(n.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:i=>{i.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)"},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent"},children:[e.jsx(Z,{size:"xs",avatar:typeof o.avatar=="string"?{type:"image",value:o.avatar}:o.avatar,placeholder:o.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(n.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:o.name}),e.jsxs(n.Box,{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0,paddingLeft:"8px"},children:[a&&e.jsx(w.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),c&&e.jsx(n.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},go="_menuItem_3gic2_1",mo="_workspaceButton_3gic2_14",yo="_workspaceText_3gic2_24",vo="_scrollWrapper_3gic2_30",ue={menuItem:go,workspaceButton:mo,workspaceText:yo,scrollWrapper:vo},jo=({workspaces:o=[],currentWorkspace:r,currentUserId:t,isLoading:s=!1,error:a=null,onWorkspaceSelect:c,onCreateWorkspace:i,emptyMessage:u="No workspaces found",loadingMessage:d="Loading workspaces...",errorMessage:f="Failed to load workspaces",className:p,onCloseSidebar:m,sidebarHovered:I=!1,children:b,menuItems:v})=>{const[g,x]=l.useState(!1),[j,y]=l.useState(""),C=l.useMemo(()=>j?o.filter(M=>{var h;return M.name.toLowerCase().includes(j.toLowerCase())||((h=M.ownerEmail)==null?void 0:h.toLowerCase().includes(j.toLowerCase()))}):o,[o,j]),k=M=>{c==null||c(M.id),x(!1),y("")};if(s)return e.jsxs(n.Group,{gap:"xs",children:[e.jsx(n.Loader,{size:"sm"}),e.jsx(n.Text,{size:"sm",c:"dimmed",children:d})]});if(a)return e.jsx(n.Alert,{color:"red",title:"Error",children:f});const[O,T]=l.useState(I);return o.length===0&&!s&&!a?e.jsx(n.Box,{children:e.jsx(n.Text,{size:"sm",c:"dimmed",children:u})}):e.jsxs(n.Menu,{opened:g,onOpen:()=>x(!0),onClose:()=>x(!1),position:"bottom-start",styles:{dropdown:{width:"350px",overflow:"hidden"}},withinPortal:!0,children:[e.jsx(n.Menu.Target,{children:e.jsx(n.Box,{w:"100%",onClick:()=>x(!g),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${ue.workspaceButton} ${p||""}`,bg:O||g?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),children:e.jsx(n.Group,{gap:"xs",wrap:"nowrap",style:{width:"100%",overflow:"hidden"},children:r?e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"xs",avatar:typeof r.avatar=="string"?{type:"image",value:r.avatar}:r.avatar,placeholder:r.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(n.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:r.name}),e.jsxs(n.Group,{gap:4,wrap:"nowrap",style:{flexShrink:0},children:[e.jsx(n.ActionIcon,{radius:"md",size:"md",color:"gray",variant:"subtle",onClick:()=>x(!g),children:e.jsx(w.IconChevronDown,{size:20,strokeWidth:2,color:"var(--mantine-color-gray-7)"})}),(O||I)&&e.jsx(N,{icon:w.IconChevronsLeft,size:"md",color:"gray",variant:"subtle",onClick:()=>{m==null||m()}})]})]}):e.jsx(n.Text,{size:"sm",c:"dimmed",children:"Select workspace"})})})}),e.jsx(n.Menu.Dropdown,{style:{borderRadius:"var(--mantine-radius-md)"},p:0,children:e.jsxs(n.Stack,{gap:0,children:[b,e.jsx(n.Menu.Divider,{style:{margin:"1px 0px"}}),e.jsx(n.Stack,{gap:0,px:4,children:C.length===0?e.jsx(n.Menu.Item,{disabled:!0,children:e.jsx(n.Text,{size:"sm",c:"dimmed",children:u})}):e.jsxs(e.Fragment,{children:[e.jsxs(n.Group,{justify:"space-between",align:"center",p:4,children:[e.jsx(n.Text,{size:"xs",c:"dimmed",fw:500,p:4,truncate:!0,children:"Workspaces"}),i&&e.jsx(n.Anchor,{onClick:()=>{i(),x(!1)},size:"xs",underline:"never",fw:500,p:4,truncate:!0,style:{display:"flex",alignItems:"center",gap:"4px"},children:"Add"})]}),e.jsx("div",{className:ue.scrollWrapper,children:e.jsx(n.ScrollArea,{mah:150,scrollbarSize:6,scrollHideDelay:0,children:e.jsx(n.Stack,{gap:0,mb:6,children:C.map(M=>e.jsx(n.Box,{onClick:()=>k(M),className:ue.menuItem,style:{padding:0,borderRadius:"var(--mantine-radius-md)",cursor:"pointer",overflow:"hidden"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent"},children:e.jsx(Ge,{workspace:M,currentUserId:t,currentWorkspaceId:r==null?void 0:r.id,onClick:()=>k(M)})},M.id))})})})]})}),v&&e.jsx(n.Menu.Divider,{style:{margin:"1px 0px"}}),v&&e.jsx(n.Box,{p:4,children:v==null?void 0:v.map(M=>e.jsx(n.MenuItem,{onClick:M.onClick,leftSection:M.icon,children:M.label,color:M.color,"data-danger":M.color,fw:500,style:{height:"40px",borderRadius:"var(--mantine-radius-md)",padding:"6px"}},M.label))})]})})]})},bo=({opened:o,onClose:r,children:t,...s})=>e.jsxs(n.Modal,{withCloseButton:!1,opened:o,onClose:r,size:"70%",centered:!0,overlayProps:{backgroundOpacity:.55},styles:{content:{minHeight:"100%"}},padding:"md",...s,children:[e.jsxs(n.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(n.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:e.jsx(N,{icon:w.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(n.Group,{justify:"space-between",gap:"xs",children:[e.jsx(N,{icon:w.IconStar,size:"md",onClick:()=>{}}),e.jsx(N,{icon:w.IconDots,size:"md",onClick:()=>{}})]})]}),t]}),wo=({opened:o,onClose:r,content:t,position:s="right",size:a="xl"})=>e.jsxs(n.Drawer,{opened:o,onClose:r,position:s,size:a,padding:"md",withCloseButton:!1,children:[e.jsxs(n.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(n.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:[e.jsx(N,{icon:w.IconChevronsRight,size:"md",onClick:r}),e.jsx(N,{icon:w.IconMaximize,size:"md",onClick:()=>{}})]}),e.jsxs(n.Group,{justify:"space-between",gap:"xs",children:[e.jsx(N,{icon:w.IconStar,size:"md",onClick:()=>{}}),e.jsx(N,{icon:w.IconDots,size:"md",onClick:()=>{}})]})]}),t]}),So=({children:o})=>e.jsx(n.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:o}),Qe=l.createContext(void 0),Co=({children:o})=>{const[r,{toggle:t,open:s,close:a}]=ae.useDisclosure(!0),[c,{toggle:i,open:u,close:d}]=ae.useDisclosure(!1),[f,{open:p,close:m}]=ae.useDisclosure(!1),[I,b]=l.useState(300),[v,g]=l.useState(500),x={opened:r,toggle:t,open:s,close:a,asideOpened:c,toggleAside:i,openAside:u,closeAside:d,sidebarWidth:I,setSidebarWidth:b,asideWidth:v,setAsideWidth:g,openedNotificationSidebar:f,openNotificationSidebar:p,closeNotificationSidebar:m};return e.jsx(Qe.Provider,{value:x,children:o})},Ve=()=>{const o=l.useContext(Qe);if(o===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return o},ko=({header:o,navbar:r,aside:t,children:s,...a})=>{const{opened:c,asideOpened:i,sidebarWidth:u,asideWidth:d}=Ve();return e.jsxs(n.AppShell,{header:{height:o?60:0},navbar:{width:c?u:0,breakpoint:"sm",collapsed:{mobile:!0}},aside:{width:i?d:0,breakpoint:"sm",collapsed:{mobile:!0}},padding:0,...a,children:[o&&e.jsx(n.AppShell.Header,{children:o}),e.jsx(n.AppShell.Navbar,{style:{display:c?"block":"none",width:c?u:0,border:"none"},children:r}),e.jsx(n.AppShell.Aside,{style:{display:i?"block":"none",width:i?d:0},children:t}),e.jsx(n.AppShell.Main,{children:s})]})},Mo=({title:o,properties:r,children:t})=>e.jsxs(n.Stack,{gap:"sm",p:"3rem",children:[e.jsx(n.Text,{size:"2.5rem",fw:600,children:o}),e.jsx(n.Space,{h:"md"}),e.jsx(n.Stack,{gap:"xs",children:r}),e.jsx(n.Space,{h:"md"}),e.jsx(n.Box,{children:t})]}),qe=n.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:{},components:{}});function Oo({children:o,theme:r}){return e.jsxs(n.MantineProvider,{theme:r||qe,children:[e.jsx(tn.Notifications,{}),e.jsx(rn.ModalsProvider,{children:e.jsx(sn.DatesProvider,{settings:{firstDayOfWeek:0},children:o})})]})}exports.ActionButton=N;exports.AppLayout=ko;exports.AppLayoutProvider=Co;exports.AvatarSelector=qn;exports.BaseLayout=Mo;exports.BoxAvatar=Z;exports.CenterPeek=bo;exports.EditableText=xn;exports.EmojiAvatar=ve;exports.ExpandableSearch=Oe;exports.FilterDropdown=vn;exports.FullPage=So;exports.GenericTable=ze;exports.IconAvatar=we;exports.ImageAvatar=Se;exports.InvitedUserCard=oe;exports.Logo=Me;exports.Menu=ne;exports.ModalSettings=ro;exports.NavButton=Ie;exports.NavLink=bn;exports.Navbar=Io;exports.NavbarProvider=ho;exports.NotificationSidebar=po;exports.PlaceholderAvatar=ce;exports.PopoverItem=Te;exports.PopoverSelector=le;exports.ShareButton=oo;exports.ShareMenu=We;exports.ShareModal=to;exports.SidePeek=wo;exports.TextButton=ke;exports.ThemeProvider=Oo;exports.WorkspaceSelector=jo;exports.WorkspaceSelectorItem=Ge;exports.getInitialsFromName=Ce;exports.theme=qe;exports.useAppLayout=Ve;exports.useNavbar=xo;