import{a as T}from"./chunk-FKESTKMR.mjs";import{a as N}from"./chunk-AUUYMBUD.mjs";import{b as C}from"./chunk-BWROF6J7.mjs";import{a as v}from"./chunk-53ZWLU5C.mjs";import{a as A}from"./chunk-IZQTEVDI.mjs";import{useState as D,useTransition as oe}from"react";import{Searchbar as ne}from"@baseapp-frontend/design-system/components/web/inputs";import{Box as x,Typography as ae}from"@mui/material";import{useForm as ie}from"react-hook-form";import{jsx as a,jsxs as R}from"react/jsx-runtime";function l(e){"@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(e)}function F(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,o)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?F(Object(r),!0).forEach(function(o){Q(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function Q(e,t,r){return(t=X(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X(e){var t=Y(e,"string");return l(t)=="symbol"?t:t+""}function Y(e,t){if(l(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,t||"default");if(l(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function j(e,t){return re(e)||te(e,t)||ee(e,t)||Z()}function Z(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ee(e,t){if(e){if(typeof e=="string")return G(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?G(e,t):void 0}}function G(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function te(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,s,f,c,u=[],n=!0,m=!1;try{if(f=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;n=!1}else for(;!(n=(o=f.call(r)).done)&&(u.push(o.value),u.length!==t);n=!0);}catch(i){m=!0,s=i}finally{try{if(!n&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(m)throw s}}return u}}function re(e){if(Array.isArray(e))return e}var se=function(t){var r=t.queryRef,o=t.LogGroups,s=o===void 0?T:o,f=t.LogGroupsProps,c=D({createdFrom:null,createdTo:null,userName:"",count:10,cursor:null}),u=j(c,2),n=u[0],m=u[1],i=C(r),P=i.logGroups,I=i.loadNext,E=i.hasNext,k=i.isLoadingNext,W=i.refetch,q=oe(),O=j(q,2),y=O[0],h=O[1],K=D(["All"]),_=j(K,2),V=_[0],$=_[1],d=ie({defaultValues:{search:""}}),B=d.control,H=d.reset,M=d.watch,U=M("search"),g=function(b){var p=S(S({},n),b);m(p),h(function(){W(p,{fetchPolicy:"store-and-network"})})},z=function(){h(function(){H(),g({userName:""})})},J=function(b){var p=b.target.value||"";h(function(){g({userName:p})})},w=P.length===0;return a(x,{p:2,justifyContent:"center",minWidth:"100%",display:"flex",alignItems:"center",children:R(x,{justifyContent:"center",maxWidth:600,width:"100%",mx:"auto",children:[a(ae,{component:"h4",variant:"h4",mb:4,children:"Activity Log"}),a(ne,{placeholder:"Search by user",name:"search",control:B,onChange:J,onClear:z,isPending:y}),R(x,{display:"flex",mt:2,mb:2,flexDirection:"row",gap:2,children:[a(A,{fetchParameters:n,executeRefetch:g}),a(N,{options:["All","Comments","Reactions","Posts"],selectedOptions:V,onChange:$})]}),!y&&U&&w&&a(v,{}),!y&&(n.createdFrom!=null||n.createdTo!=null)&&w&&a(v,{message:"No results found for the selected date range."}),a(s,S({logGroups:P,loadNext:I,hasNext:E,isLoadingNext:k},f))]})})},be=se;export{be as a};
//# sourceMappingURL=chunk-NZ5IA67Q.mjs.map