import{a as p,b as k,c as L}from"./chunk-XEHBQAFR.mjs";var A={};k(A,{default:()=>$});var F,$,h=p(()=>{"use strict";F=function(){var r=[{defaultValue:10,kind:"LocalArgument",name:"count"},{defaultValue:null,kind:"LocalArgument",name:"createdFrom"},{defaultValue:null,kind:"LocalArgument",name:"createdTo"},{defaultValue:null,kind:"LocalArgument",name:"cursor"},{defaultValue:null,kind:"LocalArgument",name:"userName"}],a={kind:"Variable",name:"createdFrom",variableName:"createdFrom"},e={kind:"Variable",name:"createdTo",variableName:"createdTo"},n={kind:"Variable",name:"userName",variableName:"userName"},s=[{kind:"Variable",name:"after",variableName:"cursor"},a,e,{kind:"Variable",name:"first",variableName:"count"},n],d={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null};return{fragment:{argumentDefinitions:r,kind:"Fragment",metadata:null,name:"ActivityLogsPaginationQuery",selections:[{args:[{kind:"Variable",name:"count",variableName:"count"},a,e,{kind:"Variable",name:"cursor",variableName:"cursor"},n],kind:"FragmentSpread",name:"ActivityLogsFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:r,kind:"Operation",name:"ActivityLogsPaginationQuery",selections:[{alias:null,args:s,concreteType:"ActivityLogConnection",kind:"LinkedField",name:"activityLogs",plural:!1,selections:[{alias:null,args:null,concreteType:"ActivityLogEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ActivityLog",kind:"LinkedField",name:"node",plural:!1,selections:[d,{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"verb",storageKey:null},c,{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[d,{alias:null,args:null,kind:"ScalarField",name:"fullName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},{alias:null,args:[{kind:"Literal",name:"height",value:48},{kind:"Literal",name:"width",value:48}],concreteType:"File",kind:"LinkedField",name:"avatar",plural:!1,selections:[c],storageKey:"avatar(height:48,width:48)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:s,filters:["userName","createdFrom","createdTo"],handle:"connection",key:"ActivityLogs_activityLogs",kind:"LinkedHandle",name:"activityLogs"}]},params:{cacheID:"20426a35a249e70f20032f9dd15f2685",id:null,metadata:{},name:"ActivityLogsPaginationQuery",operationKind:"query",text:`query ActivityLogsPaginationQuery(
  $count: Int = 10
  $createdFrom: Date = null
  $createdTo: Date = null
  $cursor: String
  $userName: String = null
) {
  ...ActivityLogsFragment_4k2xyr
}

fragment ActivityLogsFragment_4k2xyr on Query {
  activityLogs(first: $count, after: $cursor, userName: $userName, createdFrom: $createdFrom, createdTo: $createdTo) {
    edges {
      node {
        id
        createdAt
        verb
        url
        user {
          id
          fullName
          email
          avatar(width: 48, height: 48) {
            url
          }
        }
        __typename
      }
      cursor
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
}
`}}}();F.hash="f5d29f31cbedd5432a4805c649a74929";$=F});var b={};k(b,{default:()=>V});var N,V,K=p(()=>{"use strict";N=function(){var r=["activityLogs"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},e={alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null};return{argumentDefinitions:[{defaultValue:10,kind:"LocalArgument",name:"count"},{defaultValue:null,kind:"LocalArgument",name:"createdFrom"},{defaultValue:null,kind:"LocalArgument",name:"createdTo"},{defaultValue:null,kind:"LocalArgument",name:"cursor"},{defaultValue:null,kind:"LocalArgument",name:"userName"}],kind:"Fragment",metadata:{connection:[{count:"count",cursor:"cursor",direction:"forward",path:r}],refetch:{connection:{forward:{count:"count",cursor:"cursor"},backward:null,path:r},fragmentPathInResult:[],operation:(h(),L(A))}},name:"ActivityLogsFragment",selections:[{alias:"activityLogs",args:[{kind:"Variable",name:"createdFrom",variableName:"createdFrom"},{kind:"Variable",name:"createdTo",variableName:"createdTo"},{kind:"Variable",name:"userName",variableName:"userName"}],concreteType:"ActivityLogConnection",kind:"LinkedField",name:"__ActivityLogs_activityLogs_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ActivityLogEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ActivityLog",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"verb",storageKey:null},e,{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"fullName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},{alias:null,args:[{kind:"Literal",name:"height",value:48},{kind:"Literal",name:"width",value:48}],concreteType:"File",kind:"LinkedField",name:"avatar",plural:!1,selections:[e],storageKey:"avatar(height:48,width:48)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null}}();N.hash="f5d29f31cbedd5432a4805c649a74929";V=N});import{useMemo as P}from"react";import{usePaginationFragment as _}from"react-relay";var i,Q=(i!==void 0||(i=(K(),L(b)),i.hash&&i.hash!=="f5d29f31cbedd5432a4805c649a74929"&&console.error("The definition of 'ActivityLogsFragment' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data.")),i),I=function(a){var e=_(Q,a),n=e.data,s=e.loadNext,d=e.isLoadingNext,c=e.hasNext,T=e.refetch,x=P(function(){var t,g={};n==null||(t=n.activityLogs)===null||t===void 0||(t=t.edges)===null||t===void 0||t.forEach(function(o){var u,l=o?.node;if(l){var v=(u=l.user)===null||u===void 0?void 0:u.id,S=new Date(l.createdAt).getTime();g[v]||(g[v]=[]);var m=g[v];if(m){var y=m[m.length-1];!y||S-new Date(y.lastActivityTimestamp).getTime()>15*60*1e3?m.push({lastActivityTimestamp:l.createdAt,logs:[l]}):(y.logs.unshift(l),y.lastActivityTimestamp=l.createdAt)}}});var f=Object.values(g).flat();return f.sort(function(o,u){return new Date(u.lastActivityTimestamp).getTime()-new Date(o.lastActivityTimestamp).getTime()}),f},[n]);return{logGroups:x,loadNext:s,isLoadingNext:d,hasNext:c,refetch:T}};export{Q as a,I as b};
//# sourceMappingURL=chunk-BWROF6J7.mjs.map