import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$h as t,Dh as n,Fg as r,Gh as i,Gy as a,Hy as o,Lh as s,Zv as c,ap as l,dg as u,gh as d,kp as f,lh as p,m_ as m,n as h,op as g,ri as _,sn as v,td as y}from"./index-DDwwBb9e.js";import{t as b}from"./MenuLink-DDhUk0c_.js";var x=e(a()),S=e(t());function C(){return C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},C.apply(this,arguments)}function w(e,t){if(e==null)return{};var n=T(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var E=(0,x.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=w(e,[`color`,`size`]);return x.createElement(`svg`,C({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),x.createElement(`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`}),x.createElement(`path`,{d:`M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`}))});E.propTypes={color:S.default.string,size:S.default.oneOfType([S.default.string,S.default.number])},E.displayName=`Inbox`;var D=o();function O({children:e,isSubscription:t}){let{data:a}=g(),o=a?.user,{project:x}=l(),{isLiteMember:S}=_(),C=p.annotation.getPendingItemsCount.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),w=p.annotation.getAssignedItemsCount.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),T=p.annotation.getQueueItemsCounts.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),O={inbox:(0,D.jsx)(E,{width:20,height:20}),queues:(0,D.jsx)(d,{width:20,height:20}),myQueues:(0,D.jsx)(y,{size:`2xs`,width:5,height:5,name:o?.name??``}),all:(0,D.jsx)(s,{width:20,height:20}),done:(0,D.jsx)(i,{width:20,height:20})},k=f(),{openDrawer:A}=h();return(0,D.jsx)(v,{children:(0,D.jsxs)(m,{align:`start`,width:`full`,height:`full`,gap:0,position:`relative`,children:[(0,D.jsxs)(u,{align:`start`,paddingY:5,borderRightWidth:`1px`,borderColor:`border.emphasized`,fontSize:`14px`,minWidth:`240px`,height:`full`,gap:1,display:t?`none`:`flex`,children:[(0,D.jsx)(c,{fontSize:`md`,fontWeight:`500`,paddingX:4,paddingY:2,children:`Annotations`}),(0,D.jsxs)(u,{px:2,w:`full`,children:[(0,D.jsx)(b,{href:`/${x?.slug}/annotations`,icon:O.inbox,menuEnd:(0,D.jsx)(c,{fontSize:`xs`,fontWeight:`500`,children:C.data&&C.data>0?C.data:``}),isSelectedAnnotation:k.pathname===`/[project]/annotations`,children:`Inbox`}),(0,D.jsxs)(b,{href:`/${x?.slug}/annotations/me`,isSelectedAnnotation:k.pathname===`/[project]/annotations/me`,icon:O.myQueues,menuEnd:(0,D.jsx)(c,{fontSize:`xs`,fontWeight:`500`,children:w.data&&w.data>0?w.data:``}),children:[o?.name?.split(` `)[0],` (You)`]}),(0,D.jsx)(b,{href:`/${x?.slug}/annotations/all`,icon:O.all,isSelectedAnnotation:k.pathname===`/[project]/annotations/all`,children:`All`}),(0,D.jsx)(r,{}),(0,D.jsxs)(m,{width:`full`,justify:`space-between`,paddingRight:3,children:[(0,D.jsx)(c,{fontSize:`sm`,fontWeight:`500`,paddingX:4,paddingY:2,children:`My Queues`}),!S&&(0,D.jsx)(n,{onClick:()=>A(`addAnnotationQueue`,void 0),width:18,height:18,cursor:`pointer`})]}),T.data?.map(e=>(0,D.jsx)(b,{href:`/${x?.slug}/annotations/${e.slug}`,isSelectedAnnotation:k.pathname===`/${x?.slug}/annotations/${e.slug}`,icon:O.queues,menuEnd:(0,D.jsx)(c,{fontSize:`xs`,fontWeight:`500`,children:e.pendingCount>0?e.pendingCount:``}),children:e.name},e.id))]})]}),e]})})}function k({selectedAnnotations:e,queueId:t,showQueueAndUser:n,allQueueItems:r}={selectedAnnotations:`pending`,showQueueAndUser:!1,allQueueItems:!1}){let{project:i}=l(),a=f(),o=parseInt(a.query.pageOffset)||0,s=parseInt(a.query.pageSize)||25,c=p.annotation.getOptimizedAnnotationQueues.useQuery({projectId:i?.id??``,selectedAnnotations:e??`pending`,pageSize:s??25,pageOffset:o??0,queueId:t??``,showQueueAndUser:n??!1,allQueueItems:r??!1},{enabled:!!i,refetchOnWindowFocus:!1}),u=p.annotationScore.getAll.useQuery({projectId:i?.id??``},{enabled:!!i}),d=(0,x.useMemo)(()=>{if(!c.data)return{assignedQueueItems:[],totalCount:0};let{assignedQueueItems:e,totalCount:t}=c.data;return{assignedQueueItems:e,totalCount:t}},[c.data]);return{assignedQueueItems:d.assignedQueueItems,totalCount:d.totalCount,scoreOptions:u,queuesLoading:c.isLoading}}export{O as n,k as t};
//# sourceMappingURL=useAnnotationQueues-DnoGcOPa.js.map