import{a as C}from"./chunk-FWL32KYW.mjs";import{a as D}from"./chunk-DRZWU5CV.mjs";import{a as I}from"./chunk-NIWE5JGD.mjs";import{a as E}from"./chunk-TLGFCVGI.mjs";import{a as T}from"./chunk-3GUGPILY.mjs";import{a as j,b as w}from"./chunk-EG4Q3NXG.mjs";import{a as x}from"./chunk-OOONPYJM.mjs";import{Suspense as Z,useMemo as tt}from"react";import{IconButton as ot}from"@baseapp-frontend/design-system/components/web/buttons";import{LoadingState as F}from"@baseapp-frontend/design-system/components/web/displays";import{CloseIcon as et}from"@baseapp-frontend/design-system/components/web/icons";import{useResponsive as it}from"@baseapp-frontend/design-system/hooks/web";import{Box as p,Divider as nt,Typography as k}from"@mui/material";import{useLazyLoadQuery as rt,usePaginationFragment as at}from"react-relay";import{Virtuoso as ct}from"react-virtuoso";import{jsx as i,Fragment as st,jsxs as v}from"react/jsx-runtime";function l(o){"@babel/helpers - typeof";return l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(o)}function $(o,t){var e=Object.keys(o);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(o);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable})),e.push.apply(e,n)}return e}function f(o){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?$(Object(e),!0).forEach(function(n){J(o,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(e)):$(Object(e)).forEach(function(n){Object.defineProperty(o,n,Object.getOwnPropertyDescriptor(e,n))})}return o}function J(o,t,e){return(t=W(t))in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function W(o){var t=Y(o,"string");return l(t)=="symbol"?t:t+""}function Y(o,t){if(l(o)!="object"||!o)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var n=e.call(o,t||"default");if(l(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}var dt=function(t){var e,n=t.setIsDrawerOpened,s=t.EmptyState,y=s===void 0?I:s,h=t.LoadingState,R=h===void 0?F:h,S=t.LoadingStateProps,V=S===void 0?{}:S,N=t.NotificationItem,L=N===void 0?D:N,P=t.NotificationItemProps,O=P===void 0?{}:P,A=it("down","sm"),_={count:10},B=rt(j,_,{fetchPolicy:"store-and-network"}),m=B.me,d=at(w,m),a=d.data,H=d.loadNext,z=d.isLoadingNext,M=d.hasNext,Q=d.refetch;x(m?.id);var g=tt(function(){var c;return(a==null||(c=a.notifications)===null||c===void 0?void 0:c.edges.filter(function(r){return r?.node}).map(function(r){return r?.node}))||[]},[a==null||(e=a.notifications)===null||e===void 0?void 0:e.edges]),K=function(r,b){var u;return r?!r.unread&&(u=g[b-1])!==null&&u!==void 0&&u.unread?v(st,{children:[i(nt,{children:i(k,{variant:"body2",children:"Older"})}),i(L,f({notification:r},O),"notification-".concat(r.id))]}):i(L,f({notification:r},O),"notification-".concat(r.id)):null},U=function(){return i("div",{className:"h-2"})},X=function(){return z?i(R,f({sx:{paddingTop:3},CircularProgressProps:{size:15}},V)):i(p,{sx:{paddingTop:3}})},q=function(){return g.length===0?i(y,{}):i(p,{sx:{backgroundColor:"common.white"},children:i(ct,{data:g,style:{height:"calc(100vh - 68px)"},itemContent:function(b,u){return K(u,b)},components:{Header:U,Footer:X},endReached:function(){M&&H(T)}})})},G=function(){Q(_,{fetchPolicy:"network-only"})};return v(p,{display:"grid",gridTemplateRows:"min-content 1fr",height:"100%",children:[v(E,{children:[i(k,{variant:"h6",children:"Notifications"}),v(p,{display:"grid",gridTemplateColumns:"max-content min-content",children:[!!(a!=null&&a.notificationsUnreadCount)&&i(C,{refetch:G}),A&&i(ot,{onClick:function(){return n(!1)},"aria-label":"close notifications",children:i(et,{})})]})]}),q()]})},ut=function(t){var e=t.LoadingState,n=e===void 0?F:e,s=t.LoadingStateProps,y=s===void 0?{}:s;return i(Z,{fallback:i(n,f({},y)),children:i(dt,f({},t))})},jt=ut;export{jt as a};
//# sourceMappingURL=chunk-6FLUDO4S.mjs.map