import{a as k,b as p,c as L}from"./chunk-XEHBQAFR.mjs";var A={};p(A,{default:()=>$});var F,$,h=k(()=>{"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"},d=[{kind:"Variable",name:"after",variableName:"cursor"},a,e,{kind:"Variable",name:"first",variableName:"count"},n],s={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},g={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:d,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:[s,{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"NodeLogEventConnection",kind:"LinkedField",name:"events",plural:!1,selections:[{alias:null,args:null,concreteType:"NodeLogEventEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"NodeLogEvent",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"diff",storageKey:null},s],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"verb",storageKey:null},g,{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[s,{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:[g],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:d,filters:["userName","createdFrom","createdTo"],handle:"connection",key:"ActivityLogs_activityLogs",kind:"LinkedHandle",name:"activityLogs"}]},params:{cacheID:"0cf140296c61a78216ad563591dd2c03",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
        events {
          edges {
            node {
              label
              diff
              id
            }
          }
        }
        verb
        url
        user {
          id
          fullName
          email
          avatar(width: 48, height: 48) {
            url
          }
        }
        __typename
      }
      cursor
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
}
`}}}();F.hash="331e3d4312fbe40053110fe98844df70";$=F});var N={};p(N,{default:()=>V});var K,V,b=k(()=>{"use strict";K=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,concreteType:"NodeLogEventConnection",kind:"LinkedField",name:"events",plural:!1,selections:[{alias:null,args:null,concreteType:"NodeLogEventEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"NodeLogEvent",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"diff",storageKey:null}],storageKey:null}],storageKey:null}],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}}();K.hash="331e3d4312fbe40053110fe98844df70";V=K});import{useMemo as P}from"react";import{usePaginationFragment as _}from"react-relay";var i,Q=(i!==void 0||(i=(b(),L(N)),i.hash&&i.hash!=="331e3d4312fbe40053110fe98844df70"&&console.error("The definition of 'ActivityLogsFragment' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data.")),i),C=function(a){var e=_(Q,a),n=e.data,d=e.loadNext,s=e.isLoadingNext,g=e.hasNext,T=e.refetch,S=P(function(){var t,c={};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 f=(u=l.user)===null||u===void 0?void 0:u.id,x=new Date(l.createdAt).getTime();c[f]||(c[f]=[]);var m=c[f];if(m){var y=m[m.length-1];!y||x-new Date(y.lastActivityTimestamp).getTime()>15*60*1e3?m.push({lastActivityTimestamp:l.createdAt,logs:[l]}):(y.logs.unshift(l),y.lastActivityTimestamp=l.createdAt)}}});var v=Object.values(c).flat();return v.sort(function(o,u){return new Date(u.lastActivityTimestamp).getTime()-new Date(o.lastActivityTimestamp).getTime()}),v},[n]);return{logGroups:S,loadNext:d,isLoadingNext:s,hasNext:g,refetch:T}};export{Q as a,C as b};
//# sourceMappingURL=chunk-AXI33HMZ.mjs.map