1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dc564098-eee4-4f38-a0a2-dd0b95ece5a1",e._sentryDebugIdIdentifier="sentry-dbid-dc564098-eee4-4f38-a0a2-dd0b95ece5a1")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9098],{74211:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/hr/[tenant]/performance/cycles/[rcid]",function(){return a(17293)}])},69682:function(e,t,a){"use strict";a.d(t,{p:function(){return n},x:function(){return s}});let n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return{className:e?"".concat(e," fs-exclude"):"fs-exclude","data-hj-suppress":!0,"data-hs-do-not-collect":"true"}},s=e=>({"data-sentry-component":e||"SuppressedElement"})},59366:function(e,t,a){"use strict";var n=a(52322),s=a(13980),r=a.n(s),i=a(90938);let l=e=>{let{participant:t}=e;return(0,n.jsx)(i.Co,{label:t.status_label,lifecycle:"participant",status:t.status})};l.propTypes={participant:r().shape({status:r().string,status_label:r().string}).isRequired},t.Z=l},76368:function(e,t,a){"use strict";a.d(t,{sL:function(){return d},zy:function(){return u}});var n=a(52322),s=a(39097),r=a.n(s),i=a(13980),l=a.n(i),o=a(76467),c=a(69682);let d=new Set(["moderating","closed","released"]),u=e=>{let{tenantName:t,rsid:a}=e;return"/hr/".concat(t,"/performance/my-results/").concat(a)},p=e=>e||"an employee we could not name",m=e=>{let{tenantName:t,rsid:a,subjectName:s=null}=e;return(0,n.jsxs)(r(),{className:"text-blue-dark text-sm font-medium underline",href:u({tenantName:t,rsid:a}),...(0,c.x)("ResultsLinkRowLink"),children:["View results",(0,n.jsx)(o.Z,{as:"span",className:"sr-only",variant:"caption",children:" for ".concat(p(s))})]})};m.propTypes={tenantName:l().string.isRequired,rsid:l().string.isRequired,subjectName:l().string},t.ZP=m},17293:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return tE}});var n=a(52322),s=a(39097),r=a.n(s),i=a(5632),l=a(13980),o=a.n(l),c=a(2784),d=a(62202),u=a(65232),p=a(17047),m=a(1973),g=a(77590),h=a(30900),x=a(43493),v=a(37903),b=a(20270),f=a(38183),y=a(82292),w=a(14010),j=a(87686),_=a(60418),N=a(84475),k=a(788);class C extends Error{constructor(e,{alreadyToasted:t=!1,reason:a="download_failed"}={}){super(e),this.name="ReviewExportGuardError",this.alreadyToasted=t,this.reason=a}}let R=()=>{let e=(0,w.NL)();return(0,j.D)({mutationFn:async e=>{var t,a,n;let{cycleId:s,format:r}=e;if(!s)throw new C("This export needs a review cycle to run against. Reload the page and try again.",{reason:"missing_cycle"});let i=await _.Z.post((0,k.Le)("reports/performance/export/review-cycle"),{cycle_id:s,format:r},{withCredentials:!0,headers:{...(0,N.g0)({realm:"hr"})}});if(!(null===(t=i.data)||void 0===t?void 0:t.download_url)){let e=(null===(a=i.data)||void 0===a?void 0:a.link_status)===k.xk;throw new C(e&&(null===(n=i.data)||void 0===n?void 0:n.message)||"Your export finished but produced no file. Please try again.",{reason:e?"link_unsigned":"download_failed"})}if(!(0,k.LZ)(i.data.download_url,{telemetryType:"review_export"}))throw new C(k.gh,{alreadyToasted:!0,reason:"download_failed"});return i.data},onSuccess:e=>{d.toast.success((null==e?void 0:e.message)||"Your export is ready.")},onError:e=>{var t,a;if(e instanceof C){e.alreadyToasted||d.toast.error(e.message);return}d.toast.error((null==e?void 0:null===(a=e.response)||void 0===a?void 0:null===(t=a.data)||void 0===t?void 0:t.message)||"Failed to export review results")},onSettled:(t,a,n)=>{(null==n?void 0:n.cycleId)&&e.invalidateQueries({queryKey:y.VF.detail(n.cycleId)})}})};var E=a(23627),S=a(75588),Z=a(79413),T=a(79337),P=a(10988),M=a(47023),A=a(16936),I=a(47477),O=a(41624),D=a(76467),q=a(12840),L=a(86848);let F=[{key:"name",header:"Session"},{key:"department",header:"Department"},{key:"facilitator",header:"Facilitator"},{key:"scheduled",header:"Scheduled for"}],W=e=>{var t,a,s;let{rcid:i,tenantName:l,departments:o=[]}=e,[u,p]=(0,c.useState)(!1),[m,g]=(0,c.useState)(1);(0,c.useEffect)(()=>g(1),[i]);let h=(0,O.Xs)({rcid:i,page:m,perPage:15}),x=(0,O.MX)(),v=(null===(t=h.data)||void 0===t?void 0:t.data)||[],b=null===(a=h.data)||void 0===a?void 0:a.meta,f=!!(h.calibrationError||h.isMissingContext||h.isUnreadable),y=x.error?(0,O.fz)(x.error):null;return(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(M.Z,{onClick:()=>p(!0),size:"sm",children:"New session"})}),(0,n.jsx)(A.Z,{columns:F,emptyDescription:"Create one to start calibrating this cycle's ratings.",emptyMessage:"No calibration sessions yet",errorDescription:(null===(s=h.calibrationError)||void 0===s?void 0:s.message)||"Refresh the page, and let an admin know if it keeps happening.",errorMessage:"We could not load this cycle's calibration sessions",isError:f,isFetching:h.isFetching,isLoading:!h.isMissingContext&&h.isPending,onPageChange:g,pagination:b,renderMobileCard:e=>{var t,a;return(0,n.jsxs)("div",{className:"rounded border border-gray-200 p-3 flex flex-col gap-2",children:[(0,n.jsx)(r(),{className:"text-blue hover:underline",href:"/hr/".concat(l,"/performance/cycles/").concat(i,"/calibration/").concat(e.csid),children:(0,n.jsx)(D.Z,{as:"span",variant:"labelValue",children:e.name})}),(0,n.jsx)(P.Z,{color:q.X5.get(e.status)||"gray",label:e.status_label||e.status}),(0,n.jsx)(D.Z,{color:"text-gray-600",variant:"caption",children:(null===(t=e.department)||void 0===t?void 0:t.name)||"Whole cycle"}),(0,n.jsx)(D.Z,{className:q.il,color:"text-gray-600","data-hj-suppress":!0,"data-hs-do-not-collect":"true",variant:"caption",children:(null===(a=e.facilitator)||void 0===a?void 0:a.name)||"No facilitator assigned"}),(0,n.jsx)(D.Z,{color:"text-gray-600",variant:"caption",children:e.scheduled_at?(0,I.p6)(e.scheduled_at,"MMM dd, yyyy"):"Not scheduled"})]})},renderRow:e=>{var t,a;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("td",{className:"px-4 py-3",children:(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)(r(),{className:"text-blue hover:underline",href:"/hr/".concat(l,"/performance/cycles/").concat(i,"/calibration/").concat(e.csid),children:(0,n.jsx)(D.Z,{as:"span",variant:"labelValue",children:e.name})}),(0,n.jsx)("div",{children:(0,n.jsx)(P.Z,{color:q.X5.get(e.status)||"gray",label:e.status_label||e.status})})]})}),(0,n.jsx)("td",{className:"px-4 py-3",children:(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:(null===(t=e.department)||void 0===t?void 0:t.name)||"Whole cycle"})}),(0,n.jsx)("td",{className:"px-4 py-3 ".concat(q.il),"data-hj-suppress":!0,"data-hs-do-not-collect":"true",children:(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:(null===(a=e.facilitator)||void 0===a?void 0:a.name)||"No facilitator assigned"})}),(0,n.jsx)("td",{className:"px-4 py-3",children:(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:e.scheduled_at?(0,I.p6)(e.scheduled_at,"MMM dd, yyyy"):"Not scheduled"})})]})},rowKey:e=>e.csid,rows:v}),(0,n.jsx)(L.Z,{departments:o,error:y,isOpen:u,isSubmitting:x.isPending,onClose:()=>{p(!1),x.reset()},onSubmit:e=>{x.mutate({rcid:i,body:e},{onSuccess:()=>{p(!1),d.default.success("Calibration session created")}})},session:null})]})};W.propTypes={rcid:o().string.isRequired,tenantName:o().string.isRequired,departments:o().arrayOf(o().object)};var U=a(79147),z=a(79663),V=a(65405),K=a(51634);let Y=[{token:"subjects",label:"Subjects"},{token:"reviewers",label:"Reviewers"},{token:"calibration",label:"Calibration"},{token:"moderation",label:"Moderation"},{token:"settings",label:"Settings"}],Q=Y.map(e=>e.token),B=e=>{let{activeTab:t,onTabChange:a,header:s,notice:r,progress:i,panels:l,tabs:o}=e;return(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[s,r,i,(0,n.jsx)(u.ZP,{children:(0,n.jsx)(u.eW,{padding:0,children:(0,n.jsxs)(z.ZP,{activeIndex:o.findIndex(e=>e.token===t),onChange:a,syncWithUrl:!1,children:[o.map(e=>(0,n.jsx)(V.Z,{label:e.label},e.token)),o.map(e=>(0,n.jsx)(K.Z,{padding:4,children:t===e.token&&l[e.token]},e.token))]})})})]})};B.propTypes={activeTab:o().string.isRequired,onTabChange:o().func.isRequired,header:o().node.isRequired,notice:o().node,progress:o().node,panels:o().shape({subjects:o().node,reviewers:o().node,calibration:o().node,moderation:o().node,settings:o().node}).isRequired,tabs:o().arrayOf(o().shape({token:o().string.isRequired,label:o().string.isRequired})).isRequired};var G=a(62372),X=a(97203);let H=e=>{let{cycle:t,onConfirm:a,onClose:s,isCancelling:r,noteError:i}=e,[l,o]=(0,c.useState)(""),d=(0,c.useCallback)(()=>a(l),[l,a]);return(0,n.jsx)(X.B,{maxWidth:"560px",onClose:s,show:!0,title:"Cancel review cycle",children:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)(D.Z,{variant:"body",children:["Cancelling â",t.name,"â stops it for everyone. Reviewers lose access to their forms, no results are worked out, and the cycle cannot be restarted afterwards."]}),(0,n.jsx)(G.K,{error:i,label:"Why (optional)",maxLength:2e3,name:"cancel_note",onCh
1ange:e=>o(e.target.value),placeholder:"Recorded against the cycle so the reason is not lost.",rows:3,value:l}),(0,n.jsxs)("div",{className:"flex flex-wrap justify-end gap-3",children:[(0,n.jsx)(M.Z,{design:"secondary",onClick:s,type:"button",children:"Keep the cycle"}),(0,n.jsx)(M.Z,{className:"bg-red hover:bg-red-roselight",disabled:r,isLoading:r,onClick:d,type:"button",children:"Cancel this cycle"})]})]})})};H.propTypes={cycle:o().shape({name:o().string}).isRequired,onConfirm:o().func.isRequired,onClose:o().func.isRequired,isCancelling:o().bool.isRequired,noteError:o().string};var J=a(90938),$=a(31515);let ee=new Set(["moderating","closed","released","cancelled"]),et=e=>{let{label:t,value:a,absentLabel:s="Not set"}=e;return(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)(D.Z,{as:"span",color:"text-gray-500",variant:"caption",children:t}),(0,n.jsx)(D.Z,{as:"span",variant:"labelValue",children:(0,$.mn)(a,s)})]})};et.propTypes={label:o().string.isRequired,value:o().string,absentLabel:o().string};let ea=e=>{let{cycle:t,permissions:a,onClose:s,onRelease:r,onCancel:i,isClosing:l,isReleasing:o,canEnterModeration:c=!1,onEnterModeration:d,isEnteringModeration:p=!1,canExport:m=!1,onExport:g,canRemind:h=!1,onRemind:x,subjectsAwaitingRelease:v=null}=e,b=!!((null==a?void 0:a.close_review_cycle)&&t.can_close),f=Number.isInteger(v)&&v>0,y=!!((null==a?void 0:a.release_review_cycle)&&(t.can_release||f)),w=t.can_release?"Release results":"Release the remaining ".concat(1===v?"result":"".concat(v," results")),j=!!((null==a?void 0:a.cancel_review_cycle)&&t.can_cancel),_=!!(t.nomination_opens_at||t.nomination_closes_at),N=!!(c&&d&&!ee.has(t.status)),k=!!(m&&g),C=!!(h&&x);return(0,n.jsx)(u.ZP,{children:(0,n.jsx)(u.eW,{children:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)(J.Co,{label:t.status_label,lifecycle:"cycle",status:t.status}),(0,n.jsx)(P.Z,{color:"blue",label:t.type_label}),(0,n.jsx)(P.Z,{color:t.purpose===U.tt.EVALUATION?"orange":"blue",label:t.purpose_label})]}),!!t.description&&(0,n.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:t.description})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[!!k&&(0,n.jsx)(M.Z,{design:"secondary",onClick:g,type:"button",children:"Export data"}),!!N&&(0,n.jsx)(M.Z,{design:"secondary",disabled:p,isLoading:p,onClick:d,type:"button",children:"Enter moderation"}),!!b&&(0,n.jsx)(M.Z,{design:"secondary",disabled:l,isLoading:l,onClick:s,type:"button",children:"Close cycle"}),!!C&&(0,n.jsx)(M.Z,{design:"secondary",onClick:x,type:"button",children:"Go to reminders"}),!!y&&(0,n.jsx)(M.Z,{disabled:o,isLoading:o,onClick:r,type:"button",children:w}),!!j&&(0,n.jsx)(M.Z,{className:"text-red",design:"secondary",onClick:i,type:"button",children:"Cancel cycle"})]})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-5",children:[(0,n.jsx)(et,{absentLabel:_?"Not set":"Not used",label:"Nominations open",value:t.nomination_opens_at}),(0,n.jsx)(et,{absentLabel:_?"Not set":"Not used",label:"Nominations close",value:t.nomination_closes_at}),(0,n.jsx)(et,{label:"Reviews open",value:t.review_opens_at}),(0,n.jsx)(et,{label:"Reviews close",value:t.review_closes_at}),(0,n.jsx)(et,{label:"Target release",value:t.release_target_at})]})]})})})};ea.propTypes={cycle:o().object.isRequired,permissions:o().object,onClose:o().func.isRequired,onRelease:o().func.isRequired,onCancel:o().func.isRequired,isClosing:o().bool.isRequired,isReleasing:o().bool.isRequired,canEnterModeration:o().bool,onEnterModeration:o().func,isEnteringModeration:o().bool,canExport:o().bool,onExport:o().func,canRemind:o().bool,onRemind:o().func,subjectsAwaitingRelease:o().number};var en=a(61416),es=a(12524),er=a.n(es);let ei=new Map([["brand",{stroke:"stroke-blue",status:null}],["positive",{stroke:"stroke-green-700",status:"On track"}],["attention",{stroke:"stroke-amber-700",status:"Needs attention"}],["critical",{stroke:"stroke-red",status:"At risk"}],["neutral",{stroke:"stroke-gray-500",status:null}]]),el=new Map([["sm",{box:64,stroke:6,figureSize:"text-base",captionInside:!1}],["md",{box:96,stroke:9,figureSize:"text-2xl",captionInside:!0}],["lg",{box:128,stroke:12,figureSize:"text-3xl",captionInside:!0}]]),eo=Object.freeze({MEASURED:"measured",EMPTY:"empty",UNMEASURED:"unmeasured"}),ec=e=>String(e<100?Math.floor(10*e)/10:100),ed=e=>{if("number"==typeof e)return Number.isFinite(e)?e:null;if("string"!=typeof e||""===e.trim())return null;let t=Number(e);return Number.isFinite(t)?t:null},eu=(e,t,a)=>{if(Number(t)!==e)return null;let n=e*a/100;return Number.isInteger(n)?n:null},ep=e=>{let{value:t,completed:a,total:n}
1=e,s={state:eo.EMPTY,percent:null,completed:null,total:null},r={state:eo.UNMEASURED,percent:null,completed:null,total:null},i=ed(n),l=ed(a);if(0===i)return s;let o=null!==i&&i>0,c=o&&null!==l,d=(0,en.h)(c?100*l/i:t);if(null===d)return r;if(c)return{state:eo.MEASURED,percent:d,completed:l,total:i};let u=o?eu(d,t,i):null;return null!==u?{state:eo.MEASURED,percent:d,completed:u,total:i}:{state:eo.MEASURED,percent:d,completed:null,total:null}},em=(e,t)=>{let{emptyText:a,unmeasuredText:n}=t;return e===eo.EMPTY?a:e===eo.UNMEASURED?n:null},eg=(e,t,a,n)=>{let{caption:s,status:r}=n;if(a)return"".concat(e,": ").concat(a,".");let i=null===t.total?"":", ".concat(t.completed," of ").concat(t.total);return"".concat(e,": ").concat(ec(t.percent),"% ").concat(s||"complete").concat(i,".").concat(r?" ".concat(r,"."):"")},eh=e=>{let{value:t,completed:a,total:s,label:r,caption:i,tone:l="brand",size:o="md",emptyText:c="Nothing to do yet",unmeasuredText:d="Not measured yet",className:u}=e,p=el.get(o)||el.get("md"),m=ei.get(l)||ei.get("brand"),g=ep({value:t,completed:a,total:s}),h=g.state===eo.MEASURED,x=em(g.state,{emptyText:c,unmeasuredText:d}),v=h?m.status:null,b=x||v,f=p.box/2,y=(p.box-p.stroke)/2,w=2*Math.PI*y,j=h?g.percent:0;return(0,n.jsxs)("div",{"aria-label":eg(r,g,x,{caption:i,status:v}),className:er()("inline-flex max-w-full flex-col items-center gap-2",u),role:"img",children:[(0,n.jsxs)("span",{className:"relative inline-flex items-center justify-center",children:[(0,n.jsxs)("svg",{"aria-hidden":"true",height:p.box,viewBox:"0 0 ".concat(p.box," ").concat(p.box),width:p.box,children:[(0,n.jsx)("circle",{className:h?"stroke-gray-200":"stroke-gray-300",cx:f,cy:f,fill:"none",r:y,strokeDasharray:h?void 0:"4 6",strokeWidth:p.stroke}),!!h&&(0,n.jsx)("circle",{className:er()("transition-[stroke-dashoffset] duration-700 ease-out motion-reduce:transition-none",m.stroke),cx:f,cy:f,fill:"none",r:y,strokeDasharray:w,strokeDashoffset:w*(1-j/100),strokeLinecap:j>0?"round":"butt",strokeWidth:p.stroke,transform:"rotate(-90 ".concat(f," ").concat(f,")")})]}),(0,n.jsxs)("span",{className:"absolute inset-0 flex flex-col items-center justify-center gap-0.5 px-2 text-center",children:[(0,n.jsx)(D.Z,{as:"span",className:"tabular-nums",color:h?"text-gray-900":"text-gray-500",size:p.figureSize,variant:"stat",children:h?"".concat(ec(j),"%"):"â"}),!!(i&&h&&p.captionInside)&&(0,n.jsx)(D.Z,{as:"span",color:"text-gray-500",variant:"caption",children:i})]})]}),!!b&&(0,n.jsx)(D.Z,{as:"span",className:"text-center",color:"text-gray-500",variant:"caption",children:b})]})};eh.propTypes={value:o().oneOfType([o().number,o().string]),completed:o().oneOfType([o().number,o().string]),total:o().oneOfType([o().number,o().string]),label:o().string.isRequired,caption:o().string,tone:o().string,size:o().oneOf(["sm","md","lg"]),emptyText:o().string,unmeasuredText:o().string,className:o().string};var ex=a(83619);let ev=new Set(["closed","released","cancelled"]),eb=e=>1===e?"of 1 reviewer assigned":"of ".concat(e," reviewers assigned"),ef=e=>{let{progress:t,isLoading:a,isError:s,errorDescription:r}=e,i=Number.isInteger(null==t?void 0:t.total),l=ev.has(null==t?void 0:t.status),o=null!==(0,en.h)(null==t?void 0:t.recorded_completion_rate),c=o?t.recorded_completion_rate:null==t?void 0:t.completion_rate,d=o&&(null==t?void 0:t.total)!==0?void 0:null==t?void 0:t.total,u=l?"Final completion":"Completion so far",p=l?"No responses to count":"No responses to count yet";return(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[!!(a||s)&&(0,n.jsx)(m.Z,{description:r||"Refresh the page if this does not clear.",design:"wrapped",isError:!!s,isLoading:!!a&&!s,message:"We could not check this cycleâs progress"}),!!(!a&&!s&&i)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 items-center gap-4 sm:grid-cols-3",children:[(0,n.jsx)(ex.Z,{hint:eb(t.total),label:"Submitted",value:t.submitted}),(0,n.jsxs)("div",{className:"order-first flex flex-col items-center gap-1 sm:order-none",children:[(0,n.jsx)(D.Z,{as:"p",color:"text-gray-600",variant:"label",children:u}),(0,n.jsx)(eh,{emptyText:p,label:u,size:"lg",total:d,unmeasuredText:p,value:c})]}),(0,n.jsx)(ex.Z,{hint:"Includes reviewers who declined or expired, so reminders will not reach all of them.",label:"Not submitted",tone:l?"neutral":"attention",value:t.outstanding})]}),(0,n.jsx)(D.Z,{color:"text-gray-500",variant:"caption",children:"If you are being reviewed in this cycle, reviews of you are left out of these figures."})]}),!!(!a&&!s&&!i)&&(0,n.jsx)(D.Z,{color:"text-gray-500",variant:"caption",children:"Response counts and completion are shown to cycle administrators only."})]})};
1ef.propTypes={progress:o().object,isLoading:o().bool.isRequired,isError:o().bool.isRequired,errorDescription:o().string};var ey=a(6309),ew=a(63798),ej=a(46362),e_=a(95254);let eN=Object.freeze(["name","description","review_closes_at"]),ek=Object.freeze([...eN,"type","purpose","nomination_opens_at","nomination_closes_at","review_opens_at","release_target_at","calibration_enabled","moderation_enabled","appeal_window_days","min_peers","max_peers"]),eC=Object.freeze(["released","cancelled"]),eR=Object.freeze({name:"text",description:"nullableText",type:"text",purpose:"text",nomination_opens_at:"nullableText",nomination_closes_at:"nullableText",review_opens_at:"nullableText",review_closes_at:"nullableText",release_target_at:"nullableText",calibration_enabled:"boolean",moderation_enabled:"boolean",appeal_window_days:"number",min_peers:"number",max_peers:"number"}),eE=(e,t)=>{if("boolean"===e)return!!t;if("number"===e){if(""===t||null==t)return null;let e=Number(t);return Number.isFinite(e)?e:t}let a="string"==typeof t?t.trim():null!=t?t:"";return"nullableText"===e?""===a?null:a:"string"==typeof a?a:String(a)},eS=e=>{let t=null==e?void 0:e.status;return!t||eC.includes(t)?[]:"draft"===t?ek:eN},eZ=function(){let{cycle:e,values:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return eS(e).reduce((a,n)=>{if(!Object.prototype.hasOwnProperty.call(t||{},n))return a;let s=eR[n],r=eE(s,t[n]);return r===eE(s,null==e?void 0:e[n])?a:{...a,[n]:r}},{})},eT=new Set(["nomination_opens_at","nomination_closes_at","review_opens_at","review_closes_at","release_target_at"]),eP={name:"Cycle name",description:"Description",type:"Cadence",purpose:"Purpose",nomination_opens_at:"Nominations open",nomination_closes_at:"Nominations close",review_opens_at:"Reviews open",review_closes_at:"Reviews close",release_target_at:"Target release date",calibration_enabled:"Calibration",moderation_enabled:"Moderation",appeal_window_days:"Appeal window (days)",min_peers:"Minimum peers",max_peers:"Maximum peers"},eM=e=>{if(!(e instanceof Date)||Number.isNaN(e.getTime()))return null;let t=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return"".concat(e.getFullYear(),"-").concat(t,"-").concat(a)},eA=e=>{if(!e)return null;let t=new Date("".concat(e,"T00:00:00"));return Number.isNaN(t.getTime())?null:t},eI=(e,t)=>t.reduce((t,a)=>{var n;return{...t,[a]:null!==(n=null==e?void 0:e[a])&&void 0!==n?n:""}},{}),eO=e=>{let{cycle:t,onSave:a,isSaving:s,canUpdate:r,fieldErrors:i={}}=e,l=(0,c.useMemo)(()=>eS(t),[t]),[o,d]=(0,c.useState)(()=>eI(t,l));(0,c.useEffect)(()=>{d(eI(t,eS(t)))},[null==t?void 0:t.rcid,null==t?void 0:t.updated_at]);let p=(0,c.useCallback)((e,t)=>d(a=>({...a,[e]:t})),[]),g=(0,c.useMemo)(()=>eZ({cycle:t,values:o}),[t,o]),h=Object.keys(g).length>0,x=(0,c.useCallback)(e=>{e.preventDefault(),h&&a(g)},[h,a,g]),v=e=>{var a;let s=eP[e],r=i[e];if(eT.has(e))return(0,n.jsx)(ey.M,{error:r,label:s,minDate:"review_closes_at"===e?eA(null==t?void 0:t.review_closes_at):void 0,onChange:t=>p(e,eM(t)),selected:eA(o[e])});if("description"===e)return(0,n.jsx)(G.K,{error:r,label:s,name:e,onChange:t=>p(e,t.target.value),rows:3,value:o[e]||""});if("type"===e||"purpose"===e){let t="type"===e?U.$l:U.pY;return(0,n.jsx)(ew.P,{error:r,label:s,name:e,onChange:t=>p(e,t.target.value),options:t,selected:o[e]||""})}return"calibration_enabled"===e||"moderation_enabled"===e?(0,n.jsx)(ej.Z,{checked:!!o[e],label:s,name:e,onChange:t=>p(e,t.target.checked)}):(0,n.jsx)(e_.o,{error:r,label:s,name:e,onChange:t=>p(e,t.target.value),required:"name"===e,type:"name"===e?"text":"number",value:String(null!==(a=o[e])&&void 0!==a?a:"")})};return(0,n.jsxs)(u.ZP,{children:[(0,n.jsx)(u.Ol,{children:(0,n.jsx)(D.Z,{variant:"sectionHeader",children:"Settings"})}),(0,n.jsxs)(u.eW,{children:[!r&&(0,n.jsx)(m.Z,{description:"Ask an admin to change this cycle for you.",design:"wrapped",message:"You can view this cycle but not change it",showIcon:!1}),!!(r&&0===l.length)&&(0,n.jsx)(m.Z,{description:"A released or cancelled cycle keeps its settings as a record of what ran.",design:"wrapped",message:"This cycle has finished, so its settings are fixed",showIcon:!1}),!!(r&&l.length>0)&&(0,n.jsxs)("form",{className:"flex flex-col gap-4",onSubmit:x,children:["draft"!==t.status&&(0,n.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:"This cycle has already launched, so only its name, description and review close date can change. The close date can be pushed back but never brought forward."}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:l.map(e=>(0,n.jsx)("div",{children:v(e)},e))}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(M.Z,{disabled:!h||s,isLoading:s,type:"submit",children:"Save changes"})})]})]})]})};eO.propTypes={cycle:o().object.isRequired,onSave:o().func.isRequired,isSaving:o().bool.isRequired,canUpdate:o().bool.isRequired,fieldErrors:o().object};var eD=a(72203),eq=a(74618);let eL=[{group:"Cycle",items:["Cycle ID","Cycle Name","Cycle Status","Cycle Purpose"]},{group:"Subject",items:["Subject ID","Subject User ID","Subject Name","Subject Email","Subject Department","Subject Job Title","Subject Status","Subject Overall Rating","Subject Calibrated Rating","Results Computed At","Results Schema Version"]},{group:"Question",items:["Section","Section Position","Question Position","Question ID","Question Prompt","Question Type","Question Asked Of","Relationship","Is Anonymous"]},{group:"Response metrics",items:["Response Count","Cannot Assess Count","Rating Mean","Rating Count","Rating Min","Rating Max","Rating SD","Choice Counts","Comment Count","Comments"]}],eF=eL.reduce((e,t)=>
1e+t.items.length,0),eW={description:"Every subject in this cycle, broken out by question and reviewer relationship: ratings, response counts and verbatim comments.",note:"".concat(eF," columns \xb7 one row per subject, question and relationship group \xb7 no reviewer name, email or ID appears in any column, but a manager or self row with a single response is still attributable by role."),containsPii:!0,piiNotice:"This file contains personal data: each subjectâs name, email and verbatim review comments. Handle and store it according to your data policy.",columns:eL},eU=[{value:"xlsx",label:"Excel (.xlsx)"},{value:"csv",label:"CSV (.csv)"}],ez=e=>{let{cycle:t,onConfirm:a,onClose:s,isExporting:r,exportResult:i=null}=e,[l,o]=(0,c.useState)(eU[0].value),[d,u]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let e=(0,$.w0)(null==i?void 0:i.expires_at);if(!e){u(!1);return}let t=()=>u(Date.now()>=e.getTime());t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[i]);let p=(0,c.useCallback)(()=>{l&&a(l)},[l,a]);return i?(0,n.jsx)(X.B,{maxWidth:"560px",onClose:s,show:!0,title:"Export ready",children:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)(D.Z,{variant:"body",children:["Your export of â",t.name,"â is ready. If a new tab did not open on its own, use the link below to download it."]}),!!d&&(0,n.jsx)(Z.Z,{message:"This download link has expired. Close this dialog and export again to get a new one.",variant:"warning"}),!d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D.Z,{as:"a",className:"break-all",href:(0,eq.Ld)(i.download_url),rel:"noopener noreferrer",target:"_blank",variant:"link",children:i.filename||"Download the export"}),!!i.expires_at&&(0,n.jsxs)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:["This link stops working at ",(0,$.o0)(i.expires_at),"."]})]}),(0,n.jsx)("div",{className:"flex flex-wrap justify-end gap-3",children:(0,n.jsx)(M.Z,{onClick:s,type:"button",children:"Done"})})]})}):(0,n.jsx)(X.B,{maxWidth:"560px",onClose:s,show:!0,title:"Export review data",children:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)(D.Z,{variant:"body",children:["Exporting â",t.name,"â. ",eW.description]}),(0,n.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:eW.note}),!!eW.containsPii&&(0,n.jsx)(Z.Z,{message:eW.piiNotice,variant:"warning"}),(0,n.jsx)(eD.Z,{title:"What's included (".concat(eF," columns)"),children:(0,n.jsx)("div",{className:"flex flex-col gap-3",children:eW.columns.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)(D.Z,{variant:"label",children:e.group}),(0,n.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:e.items.join(", ")})]},e.group))})}),(0,n.jsx)(ew.P,{disabled:r,error:l?void 0:"Choose a format to continue.",label:"Format",name:"review_export_format",onChange:e=>o(e.target.value),options:eU,selected:l}),(0,n.jsxs)("div",{className:"flex flex-wrap justify-end gap-3",children:[(0,n.jsx)(M.Z,{design:"secondary",onClick:s,type:"button",children:"Cancel"}),(0,n.jsx)(M.Z,{disabled:r||!l,isLoading:r,onClick:p,type:"button",children:"Export cycle data"})]})]})})};ez.propTypes={cycle:o().shape({name:o().string}).isRequired,onConfirm:o().func.isRequired,onClose:o().func.isRequired,isExporting:o().bool.isRequired,exportResult:o().shape({download_url:o().string,filename:o().string,expires_at:o().string})};var eV=a(30591);let eK=new Map([[y.QK.PENDING,{variant:"info",message:"Working out this cycleâs results. This usually takes a minute."}],[y.QK.PROCESSING,{variant:"info",message:"Working out this cycleâs results. This usually takes a minute."}],[y.QK.COMPLETED,{variant:"success",message:"Results are ready. You can release them to the people they are about."}],[y.QK.COMPLETED_WITH_FAILURES,{variant:"warning",message:"Results are ready for most people, but some could not be worked out. Releasing now would leave those people with nothing."}],[y.QK.FAILED,{variant:"warning",message:"We could not work out this cycleâs results. Closing an already-closed cycle again will not retry it â contact support to have the computation retried."}]]),eY={variant:"warning",message:"Working out this cycleâs results is taking longer than expected. Refresh the page, and contact support if it does not finish."},eQ={variant:"warning",message:"We could not check whether this cycleâs results are ready. Refresh the page before releasing anything."},eB=e=>{var t;let a=null==e?void 0:null===(t=e.summary)||void 0===t?void 0:t.subjects_failed;return Number.isInteger(a)&&0!==a?1===a?" 1 person has no results.":" ".concat(a," people have no results."):null},eG=e=>{let{computation:t,isError:a=!1,errorDescription:s,isStalled:r=!1}=e;if(a)return(0,n.jsx)(Z.Z,{message:s?"".concat(eQ.message," ").concat(s):eQ.message,variant:eQ.variant});if(!(null==t?void 0:t.status))return null;let i=r?eY:eK.get(t.status);if(!i)return null;let l=eB(t);return(0,n.jsx)(Z.Z,{message:l?"".concat(i.message).concat(l):i.message,variant:i.variant})};
1eG.propTypes={computation:o().object,isError:o().bool,errorDescription:o().string,isStalled:o().bool};var eX=a(18183);let eH=[{value:"pending",label:"Pending"},{value:"in_progress",label:"In progress"},{value:"submitted",label:"Submitted"},{value:"declined",label:"Declined"},{value:"expired",label:"Expired"},{value:"cancelled",label:"Cancelled"}],eJ=[{value:"self",label:"Self"},{value:"manager",label:"Manager"},{value:"peer",label:"Peer"},{value:"upward",label:"Upward"}],e$=e=>{let{value:t,onChange:a,departments:s}=e;return(0,n.jsxs)("fieldset",{className:"w-full min-w-0 rounded-lg border border-gray-200 bg-gray-50 p-4",children:[(0,n.jsx)(D.Z,{as:"legend",className:"px-1",color:"text-gray-700",variant:"label",children:"Show these reviewers"}),(0,n.jsx)(D.Z,{as:"p",className:"mb-3",color:"text-gray-600",variant:"caption",children:"Narrows the table below. Nobody is emailed by these."}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[(0,n.jsx)("div",{children:(0,n.jsx)(ew.P,{defaultOption:"Any status",label:"Show this status",name:"participant_status",onChange:e=>a({status:e.target.value||void 0}),options:eH,selected:t.status||""})}),(0,n.jsx)("div",{children:(0,n.jsx)(ew.P,{defaultOption:"Any relationship",label:"Show this relationship",name:"participant_relationship",onChange:e=>a({relationship:e.target.value||void 0}),options:eJ,selected:t.relationship||""})}),(0,n.jsx)("div",{children:(0,n.jsx)(eX.Z,{departments:s,label:"Show this department",name:"participant_department_id",onChange:e=>a({departmentId:e||void 0}),value:t.departmentId||null})})]})]})};e$.propTypes={value:o().shape({status:o().string,relationship:o().string,departmentId:o().string}).isRequired,onChange:o().func.isRequired,departments:o().arrayOf(o().object)};var e0=a(59366);let e1=[{key:"reviewer",header:"Reviewer"},{key:"subject",header:"Reviewing"},{key:"relationship",header:"Relationship"},{key:"status",header:"Status"},{key:"reminded",header:"Last reminded"},{align:"right",key:"actions",header:"Actions"}],e2=new Set(["peer","upward"]),e4=e=>e2.has(null==e?void 0:e.relationship),e3=e=>Object.prototype.hasOwnProperty.call(null!=e?e:{},"reviewer"),e6=e=>{let{participants:t,isLoading:a,isError:s,isFetching:r,errorDescription:i,pagination:l,onPageChange:o,onRemind:c,remindingRpid:d}=e,u=e=>{var t,a;if(e4(e))return"Anonymous ".concat((null===(a=e.relationship_label)||void 0===a?void 0:a.toLowerCase())||"reviewer");if(!e3(e))return"No reviewer recorded";let n=(null===(t=e.reviewer)||void 0===t?void 0:t.name)||"Name unavailable";return e.reviewer_is_deleted?"".concat(n," (no longer in the workspace)"):n},p=e=>{var t;return Object.prototype.hasOwnProperty.call(e,"subject")?(null===(t=e.subject)||void 0===t?void 0:t.name)||"Name unavailable":"Not shown on anonymous rows"},m=e=>Object.prototype.hasOwnProperty.call(e,"last_reminder_at")?e.last_reminder_at?(0,$.mn)(e.last_reminder_at,"Never"):"Never":"Not shown for anonymous reviewers",g=e=>!!e.can_remind&&(0,n.jsx)(M.Z,{design:"secondary",isLoading:d===e.rpid,onClick:()=>c(e),size:"sm",type:"button",children:"Remind"}),h=t.length>0&&t.every(e4),x=Number.isFinite(null==l?void 0:l.total)?l.total:null;return(0,n.jsxs)(n.Fragment,{children:[!!h&&(0,n.jsx)(D.Z,{color:"text-gray-600",role:"status",variant:"caption",children:null===x?"These reviewers are anonymous, so their rows differ only by status. Reminders go to the group, never to one of them.":"".concat(x," anonymous ").concat(1===x?"reviewer matches":"reviewers match"," these filters. Their rows differ only by status, and reminders go to the group rather than to one of them.")}),(0,n.jsx)(A.Z,{columns:e1,emptyDescription:"Nobody matches these filters. Try widening them.",emptyMessage:"No reviewers in this cycle",errorDescription:i||"Refresh the page, and let an admin know if it keeps happening.",errorMessage:"We could not load this cycleâs reviewers",isError:!!s,isFetching:!!r,isLoading:!!a,onPageChange:o,pagination:l,renderMobileCard:e=>(0,n.jsxs)("div",{className:"rounded border border-gray-200 p-3 flex flex-col gap-2",children:[(0,n.jsx)(D.Z,{variant:"labelValue",weight:"font-semibold",children:u(e)}),(0,n.jsxs)(D.Z,{color:"text-gray-600",variant:"caption",children:["Reviewing: ",p(e)]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:e.relationship_label}),(0,n.jsx)(e0.Z,{participant:e})]}),(0,n.jsxs)(D.Z,{color:"text-gray-600",variant:"caption",children:["Last reminded: ",m(e)]}),g(e)]}),renderRow:e=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("td",{className:"px-4 py-3",children:(0,n.jsx)(D.Z,{as:"span",variant:"labelValue",children:u(e)})}),(0,n.jsx)("td",{className:"px-4 py-3",children:(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:p(e)})}),(0,n.jsx)("td",{className:"px-4 py-3",children:(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:e.relationship_label})}),(0,n.jsx)("td",{className:"px-4 py-3",children:(0,n.jsx)(e0.Z,{participant:e})}),(0,n.jsx)("td",{className:"px-4 py-3",children:(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:m(e)})}),(0,n.jsx)("td",{className:"px-4 py-3 text-right",children:g(e)})]}),rowKey:e=>e.rpid,rows:t})]})};e6.propTypes={participants:o().arrayOf(o().object).isRequired,isLoading:o().bool.isRequired,isError:o().bool.isRequired,isFetching:o().bool,errorDescription:o().string,pagination:o().object,onPageChange:o().func.isRequired,onRemind:o().func.isRequired,remindingRpid:o().string};let e7=[{value:"pending",label:"Pending"},{value:"needs_manager",label:"Needs a manager"},{value:"needs_attention",label:"Needs attention"},{value:"nominating",label:"Nominating"},{value:"collecting",label:"Collecting"},{value:"calibrating",label:"Calibrating"},{value:"moderating",label:"Moderating"},{value:"closed",label:"Closed"},{value:"released",label:"Released"},{value:"cancelled",label:"Cancelled"}],e5=[{value:"yes",label:"Only flagged"},{value:"no",label:"Only not flagged"}],e8=e=>"yes"===e||"no"!==e&&void 0,e9=e=>!0===e?"yes":!1===e?"no":"",te=e=>{let{value:t,onChange:a,departments:s}=e;return(0,n.jsxs)("fieldset",{className:"w-full min-w-0 rounded-lg border border-gray-200 bg-gray-50 p-4",children:[(0,n.jsx)(D.Z,{as:"legend",className:"px-1",color:"text-gray-700",variant:"label",children:"Show these people"}),(0,n.jsxs)("div",{className:"mt-3 grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4",children:[(0,n.jsx)("div",{children:(0,n.jsx)(ew.P,{defaultOption:"Any status",label:"Status",name:"subject_status",onChange:e=>a({status:e.target.value||void 0}),options:e7,selected:t.status||""})}),(0,n.jsx)("div",{children:(0,n.jsx)(ew.P,{defaultOption:"Everyone",label:"Needs attention",name:"needs_attention",onChange:e=>a({needsAttention:e8(e.target.value)}),options:e5,selected:e9(t.needsAttention)})}),(0,n.jsx)("div",{children:(0,n.jsx)(ew.P,{defaultOption:"Everyone",label:"Missing a manager",n
1ame:"needs_manager",onChange:e=>a({needsManager:e8(e.target.value)}),options:e5,selected:e9(t.needsManager)})}),(0,n.jsx)("div",{children:(0,n.jsx)(eX.Z,{departments:s,label:"Department",name:"subject_department_id",onChange:e=>a({departmentId:e||void 0}),value:t.departmentId||null})})]})]})};te.propTypes={value:o().shape({status:o().string,needsAttention:o().bool,needsManager:o().bool,departmentId:o().string}).isRequired,onChange:o().func.isRequired,departments:o().arrayOf(o().object)};let tt="eux:saved-views:",ta=e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e,tn=e=>!e||"object"!=typeof e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>{let[t,a]=e;return""!==t&&ta(a)})),ts=e=>{if(!e||"object"!=typeof e||Array.isArray(e))return null;let t="string"==typeof e.name?e.name.trim().slice(0,60):"";return""===t?null:{name:t,filters:tn(e.filters)}},tr=e=>{try{let t=window.localStorage.getItem("".concat(tt).concat(e));if(!t)return[];let a=JSON.parse(t);if(!Array.isArray(a))return[];return a.map(ts).filter(Boolean).slice(0,20)}catch(e){return[]}},ti=(e,t)=>{try{return window.localStorage.setItem("".concat(tt).concat(e),JSON.stringify(t)),!0}catch(e){return!1}};var tl=e=>{let{storageKey:t}=e,[a,n]=(0,c.useState)([]),[s,r]=(0,c.useState)(!1),[i,l]=(0,c.useState)(!0);return(0,c.useEffect)(()=>{if(!t){n([]),r(!1);return}n(tr(t)),r(!0)},[t]),{views:a,isReady:s,isPersistent:i,saveView:(0,c.useCallback)((e,a)=>{if(!t)return!1;let s=ts({name:e,filters:a});if(!s)return!1;let r=e=>e.name.toLowerCase()===s.name.toLowerCase(),i=tr(t),o=i.some(r);if(!o&&i.length>=20)return!1;let c=o?i.map(e=>r(e)?s:e):[...i,s],d=ti(t,c);return n(c),l(d),!0},[t]),deleteView:(0,c.useCallback)(e=>{if(!t)return;let a=tr(t).filter(t=>t.name!==e),s=ti(t,a);n(a),l(s)},[t])}};let to="__none__",tc=(e,t)=>{let a=e=>new Map(Object.entries(e||{}).filter(e=>{let[,t]=e;return null!=t&&""!==t})),n=a(e),s=a(t);return n.size===s.size&&[...n].every(e=>{let[t,a]=e;return s.has(t)&&s.get(t)===a})},td=e=>{let{storageKey:t,filters:a,onApply:s,label:r="Saved views",className:i}=e,{views:l,isReady:o,isPersistent:d,saveView:u,deleteView:p}=tl({storageKey:t}),[m,g]=(0,c.useState)(!1),[h,x]=(0,c.useState)(""),[v,b]=(0,c.useState)(null),f=(0,c.useRef)(null),y=(0,c.useRef)(null),w=(0,c.useRef)(!1);(0,c.useEffect)(()=>{var e,t,a,n;if(m){null===(t=f.current)||void 0===t||null===(e=t.querySelector("input"))||void 0===e||e.focus();return}w.current&&(w.current=!1,null===(n=y.current)||void 0===n||null===(a=n.querySelector("button"))||void 0===a||a.focus())},[m]);let j=(0,c.useMemo)(()=>{let e=l.find(e=>tc(e.filters,a));return e?e.name:to},[l,a]),_=(0,c.useMemo)(()=>Object.values(a||{}).some(e=>null!=e&&""!==e),[a]),N=(0,c.useCallback)(e=>{let t=e.target.value;if(""===t){s({});return}let a=l.find(e=>e.name===t);a&&s({...a.filters})},[l,s]),k=(0,c.useCallback)(e=>{e.preventDefault();let t=l.find(e=>tc(e.filters,a)&&e.name.toLowerCase()!==h.trim().toLowerCase());if(t){b(t.name);return}u(h,a)&&(b(null),x(""),w.current=!0,g(!1))},[h,a,u,l]),C=(0,c.useCallback)(e=>{var t,a;p(e),null===(a=y.current)||void 0===a||null===(t=a.querySelector("button"))||void 0===t||t.focus()},[p]);if(!t)return null;let R=l.length>=20,E=h.trim(),S=l.some(e=>e.name.toLowerCase()===E.toLowerCase());return(0,n.jsxs)("div",{className:i,children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[l.length>0&&(0,n.jsx)("div",{className:"min-w-[12rem]",children:(0,n.jsx)(ew.P,{defaultOption:"No saved view",label:r,name:"saved_view",onChange:N,options:l.map(e=>({value:e.name,label:e.name})),selected:j===to?"":j})}),!m&&(0,n.jsx)("span",{ref:y,children:(0,n.jsx)(M.Z,{design:"secondary",disabled:!_,onClick:()=>g(!0),size:"sm",type:"button",children:"Save these filters"})}),j!==to&&(0,n.jsx)(M.Z,{design:"plain",onClick:()=>C(j),size:"sm",type:"button",children:"Delete this view"})]}),!!m&&(0,n.jsxs)("form",{className:"mt-3 flex flex-wrap items-end gap-3",onSubmit:k,ref:f,children:[(0,n.jsx)("div",{className:"min-w-[14rem]",children:(0,n.jsx)(e_.o,{label:"Name this view",name:"saved_view_name",onChange:e=>{b(null),x(e.target.value.slice(0,60))},value:h})}),(0,n.jsx)(M.Z,{disabled:""===E||R&&!S,size:"sm",type:"submit",children:S?"Replace it":"Save"}),(0,n.jsx)(M.Z,{design:"plain",onClick:()=>{x(""),b(null),w.current=!0,g(!1)},size:"sm",type:"button",children:"Cancel"})]}),!!(m&&v)&&(0,n.jsx)(D.Z,{as:"p",className:"mt-2",color:"text-orange-700",role:"alert",variant:"caption",children:'"'.concat(v,'" already covers these filters. Rename that one, or change a filter before saving this.')}),!!(o&&l.length>0)&&(0,n.jsx)(D.Z,{as:"p",className:"mt-2",color:"text-gray-500",variant:"caption",children:"Saved in this browser only. They do not follow you to another device."}),!d&&(0,n.jsx)(D.Z,{as:"p",className:"mt-2",color:"text-orange-700",variant:"caption",children:"This browser would not store the view, so it is gone when you reload."}),!!(m&&R&&!S)&&(0,n.jsx)(D.Z,{as:"p",className:"mt-2",color:"text-orange-700",variant:"caption",children:"You have ".concat(20," saved views, which is the most this keeps. Delete one, or reuse a name to replace it.")})]})};td.propTypes={storageKey:o().string,filters:o().object.isRequired,onApply:o().func.isRequired,label:o().string,className:o().string};var tu=a(69682),tp=a(76368);let tm=[{key:"person",header:"Person"},{key:"department",header:"Department"},{key:"manager",header:"Manager"},{key:"flags",header:"Flags"},{key:"status",header:"Status"},{align:"right",key:"actions",header:"Actions"}],tg=(e,t)=>(null==e?void 0:e.name)||t,th=e=>{let{subjects:t,tenantName:a,isLoading:s,isError:r,isFetching:i,errorDescription:l,pagination:o,onPageChange:c}=e,d=e=>(0,n.jsx)(J.Co,{label:e.status_label,lifecycle:"subject",status:e.status,subject:"Review"}),u=e=>(0,n.jsxs)("div",{className:"flex flex-wrap gap-1",children:[!!e.needs_manager&&(0,n.jsx)(P.Z,{color:"orange",label:"No manager"}),!!e.needs_attention&&(0,n.jsx)(P.Z,{color:"orange",label:"Needs attention"}),!!(!e.needs_manager&&!e.needs_attention)&&(0,n.jsx)(D.Z,{as:"span",color:"text-gray-500",variant:"caption",children:"None"})]}),p=e=>tp.sL.has(e.status),m=e=>{var t;return!!p(e)&&(0,n.jsx)(tp.ZP,{rsid:e.rsid,subjectName:null===(t=e.user)||void 0===t?void 0:t.name,tenantName:a})};return(0,n.jsx)(A.Z,{columns:tm,emptyDescription:"Nobody matches these filters. Try widening them.",emptyMessage:"No people in this cycle",errorDescription:l||"Refresh the page, and let an admin know if it keeps happening.",errorMessage:"We could not load the people in this cycle",isError:!!r,isFetching:!!i,isLoading:!!s,onPageChange:c,pagination:o,renderMobileCard:e=>(0,n.jsxs)("div",{className:"rounded border border-gray-200 p-3 flex flex-col gap-2",children:[(0,n.jsxs)("div",{...(0,tu.p)("flex flex-col gap-2"),children:[(0,n.jsx)(D.Z,{variant:"labelValue",weight:"font-semibold",children:tg(e.user,"Name unavailable")}),(0,n.jsxs)(D.Z,{color:"text-gray-600",variant:"caption",children:[tg(e.department,"No department")," \xb7"," ",e.job_title_snapshot||"No job title recorded"]}),(0,n.jsxs)(D.Z,{color:"text-gray-600",variant:"caption",children:["Manager: ",tg(e.manager,"None assigned")]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[d(e),u(e)]}),!!p(e)&&(0,n.jsx)("div",{...(0,tu.p)(),children:m(e)})]}),renderRow:e=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("td",{...(0,tu.p)("px-4 py-3"),children:(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)(D.Z,{as:"span",variant:"labelValue",children:tg(e.user,"Name unavailable")}),(0,n.jsx)(D.Z,{as:"span",color:"text-gray-500",variant:"caption",children:e.job_title_snapshot||"No job title recorded"})]})}),(0,n.jsx)("td",{...(0,tu.p)("px-4 py-3"),children:(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:tg(e.department,"No department")})}),(0,n.jsx)("td",{...(0,tu.p)("px-4 py-3"),children:(0,n.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:tg(e.manager,"None assigned")})}),(0,n.jsx)("td",{className:"px-4 py-3",children:u(e)}),(0,n.jsx)("td",{className:"px-4 py-3",children:d(e)}),(0,n.jsx)("td",{...(0,tu.p)("px-4 py-3 text-right"),children:m(e)})]}),rowKey:e=>e.rsid,rows:t})};th.propTypes={subjects:o().arrayOf(o().object).isRequired,tenantName:o().string.isRequired,isLoading:o().bool.isRequired,isError:o().bool.isRequired,isFetching:o().bool,errorDescription:o().string,pagination:o().object,onPageChange:o().func.isRequired};var tx=a(81272),tv=a(66981);let tb=Q[0],tf=/^[A-Za-z0-9_-]{1,64}$/,ty=["closed","released"],tw=Object.freeze({}),tj="Everyone in this cycle will be able to read their own results. This cannot be undone.",t_="We could not confirm this cycleâs results were all worked out, so releasing now could leave some people with nothing. ".concat(tj),tN="What came back was not a list we could read, so this is not a sign the list is empty. Refresh the page, and let an admin know if it keeps happening.",tk=e=>e.cycleError?e.cycleError.message:e.isUnreadable?tN:void 0,tC=(e,t)=>t.includes(e)?e:tb,tR=e=>{var t,a,s,l,o,w,j,_,N,k,C,P,M,A;let{tenantName:I,rcid:O}=e,D="string"==typeof O&&tf.test(O)?O:void 0,q=(0,i.useRouter)(),{track:L}=(0,E.Ke)({app:"portal"}),{data:F}=(0,b.Pi)({enabled:!0}),z=(0,x.userCan)(F,"run_calibration"),V=(0,x.userCan)(F,"moderate_reviews"),K=(0,x.userCan)(F,"hear_review_appeals"),Q=(0,x.userCan)(F,"manage_review_cycles"),G=(0,c.useMemo)(()=>Y.filter(e=>("calibration"!==e.token||z)&&("moderation"!==e.token||V)),[V,z]),X=(0,c.useMemo)(()=>G.map(e=>e.token),[G]),J=tC(q.query.tab,X),[$,ee]=(0,c.useState)(tw),[et,en]=(0,c.useState)(tw),[es,er]=(0,c.useState)(1),[ei,el]=(0,c.useState)(1),[eo,ec]=(0,c.useState)(1),[ed,eu]=(0,c.useState)(null),[ep,em]=(0,c.useState)(!1),[eg,eh]=(0,c.useState)(!1),[ex,ev]=(0,c.useState)(null),[eb,ey]=(0,c.useState)(null),[ew,ej]=(0,c.useState)(null),[e_,eN]=(0,c.useState)(!1),ek=(0,c.useRef)(null),eC=(0,y.VE)({rcid:D}),eR=null===(t=eC.data)||void 0===t?void 0:t.data,eE=null===(a=eC.data)||void 0===a?void 0:a.can,eS=null===(s=eC.data)||void 0===s?void 0:s.subjects_awaiting_release_count,eZ=(0,y.JP)({rcid:D,status:null==eR?void 0:eR.status}),eT=(0,y.kU)({rcid:D,enabled:ty.includes(null==eR?void 0:eR.status)}),eP=eT.cycleError,eM=!!eP&&409!==eP.status||!!eT.isUnreadable,eA=(null===(l=eT.data)||void 0===l?void 0:l.status)===y.QK.COMPLETED,eI=(0,v.Lo)(),eD=null===(o=eI.data)||void 0===o?void 0:o.data,eq=Array.isArray(eD)?eD:[],eL=!!eI.isError||!!(eI.isSuccess&&!Array.isArray(eD)),eF=(0,y.Md)({rcid:D,...$,page:es,perPage:15,enabled:"subjects"===J}),eW=(0,y.IV)({rcid:D,...et,page:ei,perPage:15,enabled:"reviewers"===J}),eU=(0,f.XD)({rcid:D,page:eo,perPage:15,enabled:"moderation"===J}),eK=(0,y.tZ)(),eY=(0,y.d2)(),eQ=(0,y.$Q)(),eB=(0,y.nE)(),eX=(0,y.os)(),eH=(0,y.QY)(),eJ=(0,y.HG)(),e0=(0,f.Nt)(),e1=(0,f.Ak)(),e2=R(),e4=!!(Q&&eR&&ty.includes(eR.status)&&eR.purpose!==U.tt.DEVELOPMENT),e3=(0,c.useCallback)(e=>{let t=X[e]||tb;q.push({pathname:q.pathname,query:{...q.query,tab:t}},void 0,{shallow:!0})},[q,X]),e7=(0,c.useCallback)(()=>{eN(!0),q.push({pathname:q.pathname,query:{...q.query,tab:"reviewers"}},void 0,{shallow:!0})},[q]);(0,c.useEffect)(()=>{var e;e_&&"reviewers"===J&&(null===(e=ek.current)||void 0===e||e.focus(),eN(!1))},[J,e_]);let e5=(0,c.useCallback)(e=>{er(1),ee(t=>({...t,...e}))},[]),e8=(0,c.useCallback)(e=>{el(1),en(t=>({...t,...e}))},[]),e9=(0,c.useCallback)(e=>{er(1),ee(e)},[]),tt=(0,c.useCallback)(e=>{el(1),en(e)}
1,[]),ta="string"==typeof q.query.tenant&&(null==F?void 0:F.uid)?"".concat(q.query.tenant,":").concat(F.uid):null;(0,c.useEffect)(()=>{ee(tw),en(tw),er(1),el(1),ec(1),eu(null),ej(null),ey(null),em(!1),eh(!1),ev(null)},[D]);let tn=(0,c.useRef)(D);(0,c.useEffect)(()=>{tn.current=D},[D]);let ts=(0,c.useRef)(eg);(0,c.useEffect)(()=>{ts.current=eg},[eg]);let tr=(e,t)=>{let a=null==e?void 0:e.last_page;Number.isInteger(a)&&!(a<1)&&t(e=>Math.min(e,a))},ti=null===(w=eF.data)||void 0===w?void 0:w.meta,tl=null===(j=eW.data)||void 0===j?void 0:j.meta,to=null===(_=eU.data)||void 0===_?void 0:_.meta;(0,c.useEffect)(()=>{tr(ti,er)},[null==ti?void 0:ti.last_page]),(0,c.useEffect)(()=>{tr(tl,el)},[null==tl?void 0:tl.last_page]),(0,c.useEffect)(()=>{tr(to,ec)},[null==to?void 0:to.last_page]);let tc=(0,c.useCallback)(e=>{eK.mutate({rcid:D,body:e},{onSuccess:()=>d.default.success("Cycle updated")})},[D,eK]),tu=(0,c.useCallback)(()=>{(0,p.Z)({handler:async()=>{let e=await eY.mutateAsync({rcid:D}),t=null==e?void 0:e.subjects_not_closed_count;if(L(h.dW.PERF_CYCLE_CLOSED,{status_before:null==eR?void 0:eR.status,surface:h.S9.PERFORMANCE_REVIEWS}),!Number.isInteger(t)){d.default.success("Cycle closed.");return}if(t>0){d.default.success(1===t?"Cycle closed. 1 person never reached the review stage, so nobody reviewed them.":"Cycle closed. ".concat(t," people never reached the review stage, so nobody reviewed them."));return}d.default.success("Cycle closed. Nobody was left short of the review stage.")},title:"Close this cycle",message:"Reviewers can no longer submit after this. Anything still outstanding is recorded as not submitted, and results are worked out from what came in.",confirmButtonText:"Close the cycle",cancelButtonText:"Keep it open"})},[eY,eR,D,L]),tp=(0,c.useCallback)(()=>{(0,p.Z)({handler:async()=>{let e=await eQ.mutateAsync({rcid:D}),t=null==e?void 0:e.subjects_not_released_count;L(h.dW.PERF_CYCLE_RELEASED,{surface:h.S9.PERFORMANCE_REVIEWS});let a=null==e?void 0:e.subjects_promoted_count,n=null==e?void 0:e.subjects_not_computed_count;if(Number.isInteger(a)&&0===a){d.default.error(Number.isInteger(n)&&n>0?"Nobody was released. Their results are still being worked out â release again once that finishes, and they will be sent out.":"Nobody was released. Nothing was ready to send.");return}if(!Number.isInteger(t)){d.default.success("Results released.");return}if(t>0){d.default.success(1===t?"Results released. 1 personâs results were not worked out in time, so they were left out. Release again once that finishes.":"Results released. ".concat(t," peopleâs results were not worked out in time, so they were left out. Release again once that finishes."));return}d.default.success("Results released. Nobody was left waiting on results.")},title:"Release results",message:eA?tj:t_,confirmButtonText:"Release results",cancelButtonText:"Not yet"})},[eA,D,eQ,L]),tm=(0,c.useCallback)(()=>{(0,p.Z)({handler:async()=>{let e=await eJ.mutateAsync({rcid:D}),t=null==e?void 0:e.moderations_minted_count;if(!Number.isInteger(t)){d.default.success("This cycle is now in moderation.");return}if(t>0){d.default.success(1===t?"This cycle is now in moderation. 1 review is waiting on a decision.":"This cycle is now in moderation. ".concat(t," reviews are waiting on a decision."));return}d.default.success("This cycle is now in moderation. Nothing needed a moderation decision.")},title:"Move this cycle into moderation",message:"Every review in this cycle goes to its moderator for approval before results are worked out.",confirmButtonText:"Enter moderation",cancelButtonText:"Not yet"})},[eJ,D]),tg=(0,c.useCallback)(e=>{if(!(null==F?void 0:F.uid))return!1;let t=null==e?void 0:e.moderator;return void 0!==t&&(null===t||t.uid===F.uid)},[null==F?void 0:F.uid]),tR=(0,c.useCallback)(async e=>{let{comments:t}=e;if(!ed)return;let{intent:a,moderation:n}=ed,s=a===tx.t.APPROVE,r="string"==typeof t&&t.trim().length>0;try{s?await e0.mutateAsync({rmid:n.rmid,rcid:D,...r?{comments:t}:{}}):await e1.mutateAsync({rmid:n.rmid,rcid:D,comments:t}),L(h.dW.PERF_MODERATION_DECIDED,{decision:a,surface:h.S9.PERFORMANCE_REVIEWS}),eu(null),d.default.success(s?"Review approved.":"Review returned to the manager.")}catch(e){}},[e0,ed,D,e1,L]),tE=(0,c.useCallback)(async e=>{try{await eB.mutateAsync({rcid:D,note:e}),em(!1),d.default.success("Cycle cancelled")}catch(e){}},[eB,D]),tS=(0,c.useCallback)(async e=>{try{let t=await e2.mutateAsync({cycleId:D,format:e});if(D!==tn.current||!ts.current)return;ev(t)}catch(e){}},[e2,D]),tZ=(0,c.useCallback)(async e=>{ej(null);try{var t;let a=await eX.mutateAsync({rcid:D,...e});
1ej(a),L(h.dW.PERF_REMINDER_SENT_MANUAL,{scope:"cycle",reminded:null!==(t=null==a?void 0:a.reminded)&&void 0!==t?t:0,surface:h.S9.PERFORMANCE_REVIEWS})}catch(e){ej(null)}},[eX,D,L]),tT=(0,c.useCallback)(async e=>{ey(e.rpid);try{await eH.mutateAsync({rpid:e.rpid,rcid:D}),L(h.dW.PERF_REMINDER_SENT_MANUAL,{scope:"participant",reminded:1,surface:h.S9.PERFORMANCE_REVIEWS}),d.default.success("Reminder sent")}catch(e){}finally{ey(null)}},[D,eH,L]),tP=(0,c.useMemo)(()=>[{href:"/hr/".concat(I,"/performance"),name:"Performance",nodeType:"Link"},{href:"/hr/".concat(I,"/performance/cycles"),name:"Review cycles",nodeType:"Link"},{href:"/hr/".concat(I,"/performance/cycles/").concat(D),name:(null==eR?void 0:eR.name)||"Cycle",nodeType:"Link"}],[eR,D,I]),{cycleError:tM,isMissingContext:tA,isUnreadable:tI}=eC,tO=!!(!D||tA||tM||tI),tD=!tA&&eC.isPending,tq=(0,c.useMemo)(()=>D?tA?{message:"We could not tell which workspace you are in",description:"Check you are signed in to the right workspace, then try again."}:tI?{message:"We could not read this review cycle",description:"What came back was not a cycle we could read. Refresh the page, and let an admin know if it keeps happening."}:{message:"We could not load this review cycle",description:null==tM?void 0:tM.message}:{message:"We could not find this review cycle",description:"The link you followed does not point at a cycle we can open. Go back to Review cycles and pick it again."},[tM,tA,tI,D]),tL=eK.error?(0,y.I6)(eK.error).fieldErrors:{},tF=(null==ed?void 0:ed.intent)===tx.t.RETURN?e1:e0,tW=!!(null==eE?void 0:eE.update_review_cycle),tU=!!((null==eE?void 0:eE.update_review_cycle)&&(0,y.xE)(eR)),tz=!!(tU&&"reviewers"!==J),tV=(0,n.jsx)(Z.Z,{message:"We could not load your departments, so the department filters are empty. Refresh the page to try again.",variant:"warning"});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(T.Z,{thirdParty:!1,title:"".concat((0,g.kC)((0,g.parseUnderScore)(I))," - ").concat((null==eR?void 0:eR.name)||"Review cycle")}),(0,n.jsxs)("main",{className:"container flex flex-col gap-4 mx-auto px-4 md:px-8 lg:px-12 pb-6",children:[(0,n.jsx)(S.Z,{breadcrumbs:tP,description:"Watch this round, chase what is outstanding, and steer it to a close",tenantName:I,title:(null==eR?void 0:eR.name)||"Review cycle"}),!!(tD||tO)&&(0,n.jsx)(u.ZP,{children:(0,n.jsx)(u.eW,{children:(0,n.jsx)(m.Z,{description:tq.description,design:"wrapped",isError:tO,isLoading:!!tD&&!tO,message:tq.message})})}),!!(!tD&&!tO&&eR)&&(0,n.jsx)(B,{activeTab:J,header:(0,n.jsx)(ea,{canEnterModeration:V,canExport:e4,canRemind:tz,cycle:eR,isClosing:eY.isPending,isEnteringModeration:eJ.isPending,isReleasing:eQ.isPending,onCancel:()=>em(!0),onClose:tu,onEnterModeration:tm,onExport:()=>eh(!0),onRelease:tp,onRemind:e7,permissions:eE,subjectsAwaitingRelease:eS}),notice:(0,n.jsx)(eG,{computation:eT.data,errorDescription:null==eP?void 0:eP.message,isError:eM,isStalled:(0,y.mN)(eT.data)}),onTabChange:e3,panels:{subjects:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[!!eL&&tV,(0,n.jsx)(te,{departments:eq,onChange:e5,value:$}),(0,n.jsx)(td,{filters:$,label:"Saved people views",onApply:e9,storageKey:ta?"perf-cycle-subjects:".concat(ta):null}),(0,n.jsx)(th,{errorDescription:tk(eF),isError:!!(eF.cycleError||eF.isUnreadable),isFetching:eF.isFetching,isLoading:eF.isPending,onPageChange:er,pagination:ti,subjects:(null===(N=eF.data)||void 0===N?void 0:N.data)||[],tenantName:I})]}),reviewers:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[!!eL&&tV,!!tU&&(0,n.jsx)("section",{"aria-label":"Send reminders",ref:ek,tabIndex:-1,children:(0,n.jsx)(eV.Z,{departments:eq,isSending:eX.isPending,onSend:tZ,summary:ew})}),(0,n.jsx)(e$,{departments:eq,onChange:e8,value:et}),(0,n.jsx)(td,{filters:et,label:"Saved reviewer views",onApply:tt,storageKey:ta?"perf-cycle-reviewers:".concat(ta):null}),(0,n.jsx)(e6,{errorDescription:tk(eW),isError:!!(eW.cycleError||eW.isUnreadable),isFetching:eW.isFetching,isLoading:eW.isPending,onPageChange:el,onRemind:tT,pagination:tl,participants:(null===(k=eW.data)||void 0===k?void 0:k.data)||[],remindingRpid:eb})]}),calibration:!!z&&(0,n.jsx)(W,{departments:eq,rcid:D,tenantName:I}),moderation:!!V&&(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[!!K&&(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(r(),{className:"text-blue-dark text-sm font-medium underline",href:"/hr/".concat(I,"/performance/appeals?review_cycle_id=").concat(D),children:"See appeals for this cycle"})}),(0,n.jsx)(tv.ZP,{canDecide:tg,errorDescription:(null===(C=eU.moderationError)||void 0===C?void 0:C.message)||(eU.isUnreadable?tN:void 0),isError:!!(eU.moderationError||eU.isUnreadable),isFetching:eU.isFetching,isLoading:eU.isPending,moderations:(null===(P=eU.data)||void 0===P?void 0:P.data)||[],onApprove:e=>eu({intent:tx.t.APPROVE,moderation:e}),onPageChange:ec,onReturn:e=>eu({intent:tx.t.RETURN,moderation:e}),pagination:to})]}),settings:(0,n.jsx)(eO,{canUpdate:tW,cycle:eR,fieldErrors:tL,isSaving:eK.isPending,onSave:tc})},progress:(0,n.jsx)(ef,{errorDescription:(null===(M=eZ.cycleError)||void 0===M?void 0:M.message)||(eZ.isUnreadable?"What came back was not a set of figures we could read. Refresh the page, and let an admin know if it keeps happening.":void 0),isError:!!(eZ.cycleError||eZ.isUnreadable),isLoading:!eZ.isMissingContext&&eZ.isPending,progress:eZ.data}),tabs:G})]}),!!ed&&(0,n.jsx)(tx.Z,{error:tF.error?(0,f.GI)(tF.error):void 0,intent:ed.intent,isOpen:!0,isSubmitting:tF.isPending,moderation:ed.moderation,onClose:()=>{eu(null),e0.reset(),e1.reset()},onSubmit:tR}),!!(ep&&eR)&&(0,n.jsx)(H,{cycle:eR,isCancelling:eB.isPending,noteError:eB.error?null===(A=(0,y.I6)(eB.error).fieldErrors)||void 0===A?void 0:A.note:void 0,onClose:()=>em(!1),onConfirm:tE}),!!(eg&&eR)&&(0,n.jsx)(ez,{cycle:eR,exportResult:ex,isExporting:e2.isPending,onClose:()=>{eh(!1),ev(null)},onConfirm:tS})]})};tR.getInitialProps=async e=>{let{tenant:t,rcid:a}=e.query;return{tenantName:encodeURIComponent(t),rcid:a}},tR.propTypes={tenantName:o().string.isRequired,rcid:o().oneOfType([o().string,o().arrayOf(o().string)])};var tE=(0,N.withAuthSync)(tR)},72203:function(e,t,a){"use strict";var n=a(52322),s=a(2784),r=a(2369),i=a(92942),l=a(12524),o=a.n(l),c=a(13980),d=a.n(c),u=a(47023),p=a(76467);let m=e=>{let{title:t,icon:a,itemCount:l=0,isEmpty:c=!1,open:d,defaultOpen:m=!1,onToggle:g,onAddClick:h,loading:x=!1,children:v,className:b=""}
1=e,f=(0,s.useId)(),y=void 0!==d,[w,j]=(0,s.useState)(m),_=y?d:w,N=(0,s.useCallback)(()=>{y||j(e=>!e),null==g||g()},[y,g]);return(0,n.jsxs)("div",{className:o()("accordion-section",{"accordion-section--empty":c,"accordion-section--expanded":_},b),children:[(0,n.jsxs)("button",{"aria-controls":"".concat(f,"-content"),"aria-expanded":_,className:o()("accordion-header",{"accordion-header--expanded":_}),id:"".concat(f,"-button"),onClick:N,type:"button",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,n.jsx)(i.FontAwesomeIcon,{className:o()("accordion-chevron text-gray-500",{"accordion-chevron--expanded":_}),icon:r._tD,size:"sm"}),!!a&&(0,n.jsx)(i.FontAwesomeIcon,{className:"text-blue-600",icon:a,size:"sm"}),(0,n.jsx)(p.Z,{className:"!text-base",color:"text-gray-800",variant:"sectionHeader",children:t}),l>0&&(0,n.jsx)("span",{"aria-label":"".concat(l," items"),className:o()("accordion-badge",{"accordion-badge--filled":!c,"accordion-badge--empty":c}),children:l})]}),!!(h&&_)&&(0,n.jsx)("div",{children:(0,n.jsx)(u.Z,{"aria-label":"Add",beforeIcon:(0,n.jsx)(i.FontAwesomeIcon,{className:"text-xs sm:mr-2",icon:r.r8p,size:"xs"}),className:"ml-2",design:"secondary",onClick:e=>{e.stopPropagation(),h()},children:(0,n.jsx)("span",{className:"hidden sm:inline text-sm leading-none",children:"Add"})})})]}),!!_&&(0,n.jsx)("div",{"aria-labelledby":"".concat(f,"-button"),className:"accordion-content",id:"".concat(f,"-content"),role:"region",children:(0,n.jsx)("div",{className:"p-2 sm:p-4 bg-white rounded-b-lg",children:v})})]})};m.propTypes={title:d().string.isRequired,icon:d().object,itemCount:d().number,isEmpty:d().bool,open:d().bool,defaultOpen:d().bool,onToggle:d().func,onAddClick:d().func,loading:d().bool,children:d().node.isRequired,className:d().string},t.Z=m},46362:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var n=a(52322),s=a(2784),r=a(13980),i=a.n(r),l=a(12524),o=a.n(l);let c=e=>{let{name:t,checked:a=!1,onChange:r,disabled:i=!1,size:l="md",label:c,labelPosition:d="right",description:u,error:p,className:m,inputClassName:g,labelClassName:h,ariaLabel:x,ariaDescribedBy:v,showIcons:b=!1,checkedIcon:f,uncheckedIcon:y}=e,w=(0,s.useId)(),j=u?"".concat(w,"-description"):void 0,_=p?"".concat(w,"-error"):void 0,N=(0,s.useCallback)(e=>{i||r({...e,target:{...e.target,name:t,checked:!a,type:"checkbox"}})},[i,t,a,r]),k=(0,s.useCallback)(e=>{(" "===e.key||"Enter"===e.key)&&(e.preventDefault(),N(e))},[N]),C={xs:{track:"w-7 h-3.5",thumb:"w-3 h-3",thumbTranslate:a?"translate-x-[14px]":"translate-x-0.5",iconSize:"text-[8px]"},sm:{track:"w-9 h-[18px]",thumb:"w-4 h-4",thumbTranslate:a?"translate-x-[18px]":"translate-x-0.5",iconSize:"text-[10px]"},md:{track:"w-11 h-[22px]",thumb:"w-5 h-5",thumbTranslate:a?"translate-x-[22px]":"translate-x-0.5",iconSize:"text-xs"},lg:{track:"w-[52px] h-[26px]",thumb:"w-6 h-6",thumbTranslate:a?"translate-x-[26px]":"translate-x-0.5",iconSize:"text-sm"}},R=C[l]||C.md,E=o()("relative inline-flex items-center rounded-full cursor-pointer","transition-colors duration-200 ease-in-out","focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-300 focus-visible:ring-offset-1",R.track,{"bg-gray-300 hover:bg-gray-400":!a&&!i,"bg-blue hover:bg-blue-dark":a&&!i,"bg-gray-200":!a&&i,"bg-blue-200":a&&i,"cursor-not-allowed opacity-50":i,"ring-1 ring-red-400":p},g),S=o()("absolute bg-white rounded-full shadow-sm border","transition-transform duration-200 ease-in-out",R.thumb,R.thumbTranslate,{"border-gray-200":!a,"border-blue":a&&!i,"border-blue-200":a&&i}),Z=o()("text-gray-700 font-medium cursor-pointer select-none",{"text-xs":"xs"===l,"text-sm":"sm"===l||"md"===l,"text-base":"lg"===l,"cursor-not-allowed opacity-50":i},h),T=o()("inline-flex items-center gap-2",{"flex-row-reverse":"left"===d},m);return(0,n.jsxs)("div",{className:"inline-flex flex-col",children:[(0,n.jsxs)("label",{className:T,htmlFor:t,children:[(0,n.jsxs)("button",{"aria-checked":a,"aria-describedby":v||j||_,"aria-disabled":i,"aria-label":x||c,className:E,disabled:i,id:t,name:t,onClick:N,onKeyDown:k,role:"switch",type:"button",children:[!!b&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:o()("absolute left-1 transition-opacity duration-200",R.iconSize,{"opacity-100":a,"opacity-0":!a}
1),children:f||(0,n.jsx)("svg",{className:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 12 12",children:(0,n.jsx)("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4a1 1 0 00-1.414-1.414L5 6.586 3.707 5.293z"})})}),(0,n.jsx)("span",{className:o()("absolute right-1 transition-opacity duration-200",R.iconSize,{"opacity-0":a,"opacity-100":!a}),children:y||(0,n.jsx)("svg",{className:"w-3 h-3 text-gray-400",fill:"currentColor",viewBox:"0 0 12 12",children:(0,n.jsx)("path",{d:"M4 4l4 4m0-4l-4 4",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})})})]}),(0,n.jsx)("span",{className:S})]}),!!c&&(0,n.jsx)("span",{className:Z,children:c})]}),!!u&&(0,n.jsx)("span",{className:"text-gray-500 text-sm mt-1",id:j,children:u}),!!p&&(0,n.jsx)("span",{className:"text-red-400 text-xs mt-1",id:_,children:p})]})};c.propTypes={name:i().string.isRequired,checked:i().bool,onChange:i().func.isRequired,disabled:i().bool,size:i().oneOf(["xs","sm","md","lg"]),label:i().string,labelPosition:i().oneOf(["left","right"]),description:i().string,error:i().string,className:i().string,inputClassName:i().string,labelClassName:i().string,ariaLabel:i().string,ariaDescribedBy:i().string,showIcons:i().bool,checkedIcon:i().node,uncheckedIcon:i().node}},788:function(e,t,a){"use strict";a.d(t,{LZ:function(){return p},Le:function(){return m},gh:function(){return d},xk:function(){return c}});var n=a(62202),s=a(47477),r=a(59578),i=a(82036);let l=["elevolt.co.ke","wira.s3.eu-central-1.amazonaws.com"],o=e=>{if(!e||"string"!=typeof e)return!1;try{let{protocol:t,hostname:a}=new URL(e);if("https:"!==t)return!1;return l.some(e=>a===e||a.endsWith(".".concat(e)))}catch(e){return!1}},c="signing_failed",d="Your export is ready, but its download link was blocked for security. Please try again or contact support.",u=e=>{try{return new URL(e).origin}catch(e){return"unparseable"}},p=function(e){let{telemetryType:t="export"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(e)?(window.open(e,"_blank","noopener,noreferrer"),!0):(r.RY("Export download URL rejected by allowlist",{level:"warning",tags:{type:t,reason:"download_url_rejected"},extra:{export:{rejectedOrigin:u(e)}}}),n.toast.error(d),!1)},m=e=>"".concat(i.JW,"tenant/").concat((0,s.d_)(),"/").concat(e)},91516:function(e,t,a){"use strict";a.d(t,{Z:function(){return m}});var n=a(7896),s=a(2784),r=a(26202),i=a(88137),l=a(56666),o=a(33028),c=a(76854),d=a(59740),u=a(407),p=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];a(28316),a(84337);var m=(0,s.forwardRef)(function(e,t){var a,m,g,h,x,v,b,f,y,w,j,_,N,k,C,R,E,S,Z,T,P,M,A,I,O,D,q,L,F,W,U,z,V,K,Y,Q,B,G,X,H,J,$,ee,et,ea,en,es,er,ei,el,eo,ec=(m=void 0!==(a=e.defaultOptions)&&a,h=void 0!==(g=e.cacheOptions)&&g,x=e.loadOptions,e.options,v=e.isLoading,b=e.onInputChange,f=e.filterOption,w=(y=(0,d.Z)(e,p)).inputValue,j=(0,s.useRef)(void 0),_=(0,s.useRef)(!1),N=(0,s.useState)(Array.isArray(m)?m:void 0),C=(k=(0,c.Z)(N,2))[0],R=k[1],E=(0,s.useState)(void 0!==w?w:""),Z=(S=(0,c.Z)(E,2))[0],T=S[1],P=(0,s.useState)(!0===m),A=(M=(0,c.Z)(P,2))[0],I=M[1],O=(0,s.useState)(void 0),q=(D=(0,c.Z)(O,2))[0],L=D[1],F=(0,s.useState)([]),U=(W=(0,c.Z)(F,2))[0],z=W[1],V=(0,s.useState)(!1),Y=(K=(0,c.Z)(V,2))[0],Q=K[1],B=(0,s.useState)({}),X=(G=(0,c.Z)(B,2))[0],H=G[1],J=(0,s.useState)(void 0),ee=($=(0,c.Z)(J,2))[0],et=$[1],ea=(0,s.useState)(void 0),es=(en=(0,c.Z)(ea,2))[0],er=en[1],h!==es&&(H({}),er(h)),m!==ee&&(R(Array.isArray(m)?m:void 0),et(m)),(0,s.useEffect)(function(){return _.current=!0,function(){_.current=!1}},[]),ei=(0,s.useCallback)(function(e,t){if(!x)return t();var a=x(e,t);a&&"function"==typeof a.then&&a.then(t,function(){return t()})},[x]),(0,s.useEffect)(function(){!0===m&&ei(Z,function(e){_.current&&(R(e||[]),I(!!j.current))})},[]),el=(0,s.useCallback)(function(e,t){var a=(0,u.L)(e,t,b);if(!a){j.current=void 0,T(""),L(""),z([]),I(!1),Q(!1);return}if(h&&X[a])T(a),L(a),z(X[a]),I(!1),Q(!1);else{var n=j.current={};T(a),I(!0),Q(!q),ei(a,function(e){_&&n===j.current&&(j.current=void 0,I(!1),L(a),z(e||[]),Q(!1),H(e?(0,o.Z)((0,o.Z)({}
1,X),{},(0,l.Z)({},a,e)):X))})}},[h,ei,q,X,b]),eo=Y?[]:Z&&q?U:C||[],(0,o.Z)((0,o.Z)({},y),{},{options:eo,isLoading:A||void 0!==v&&v,onInputChange:el,filterOption:void 0===f?null:f})),ed=(0,i.u)(ec);return s.createElement(r.S,(0,n.Z)({ref:t},ed))})}},function(e){e.O(0,[5351,9436,9400,8819,5742,493,3733,3587,1282,270,9277,2292,248,9574,6478,610,6081,7487,7721,2888,9774,179],function(){return e(e.s=74211)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.