1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0193d-a290-7532-9f10-04b7d1fc8266")}catch(e){}}();import{p as is,c as je,j as t,aS as As,aT as ko,aU as Co,aE as jt,D as Ye,E as De,aA as Oe,aB as Je,R as ut,aV as pi,ar as ts,aW as Ts,q as Be,u as at,T as J,r as ee,aP as Do,X as Ns,ae as yn,aN as gn,B as bt,aG as xn,A as bn,aX as Io,aO as rs,H as We,aY as yi,at as Bs,aZ as Qt,a_ as gi,am as xi,G as ps,N as ss,P as es,t as St,J as To,a$ as ws,s as Hn,b0 as en,b1 as No,aC as Sn,aD as bi,b2 as Mo,ak as Si,Q as ji,a8 as Yt,a7 as Eo,aJ as Vn,aM as Ro,af as Ao,aI as vi,K as Bo,g as $o,b3 as Oo}from"./index-BrrDycJc.js";import{u as Vt}from"./useSuspenseQuery-CphnBbpU.js";import{g as Po,u as wi,a as ms,t as jn,D as _i,S as Lo,b as Fo,c as Wo,i as ki,d as zo,e as Ho,P as Vo,f as Qo,p as Uo}from"./open-shift-time-CuJIYd-D.js";import{c as Go,g as yt,u as Ci,P as Ko,i as qt,a as cs,b as Qn,d as Un,e as Yo,f as qo,R as Xo,S as Zo}from"./use-shift-drawer-kdc1IcIF.js";import{u as Jo}from"./use-availability-editor-dialog-D7imTUpF.js";import{E as $s,a as Os,b as Ps,c as Ls,d as Fs,e as Di}from"./empty-D14-lER1.js";import{r as Ii,M as ea,l as vn,o as wn,I as _n,s as ta,t as sa,v as na,w as ia,x as oa,S as ln,d as Ws,f as rn,e as cn,h as dn,i as mn,y as aa,z as la,C as Ti,B as _s}from"./FormComponents-kkYQbiIE.js";import{D as kn,C as Ni,u as ra,E as ca}from"./EmployeeDrawer-BGuHsRVB.js";import{s as Ks,g as Mi}from"./availability-D29Pgowk.js";import{C as zs}from"./chevron-right-C67pYrV2.js";import{b as mt,T as ft,a as ht,f as Ei,P as Ri,d as Ai,e as Bi}from"./popover-DF0NSsCk.js";import{u as Wt}from"./use-time-format-D-chAty5.js";import{f as Kt,a as da,b as Gn}from"./formatting-CICzoO_3.js";import{S as ma}from"./scale-Ckwm9b_m.js";import{F as Hs}from"./break-prefill-Ckb8ayS1.js";import{S as $i}from"./shield-alert-lsF_47w0.js";import{C as Oi}from"./calendar-DCSxLE40.js";import{e as fa,u as ha,A as ua}from"./absence-request-dialog-3U8T2aJf.js";import{u as Pi}from"./use-confirmation-dialog-Bvs_bkd9.js";import{C as Cn}from"./copy-o8v2z2P-.js";import{P as pa}from"./plus-BJf5yfjY.js";import{E as Vs,a as Qs}from"./eye-DJxBaVT0.js";import{C as ya}from"./check-4P7fJ2mN.js";import{B as Cs,C as fn,u as ga}from"./useMonth-C6iS-9tx.js";import{c as Zt,i as xs,b as os,D as Kn,a as Rs,e as Yn,f as qn}from"./dropdown-menu-C_wvrZgp.js";import{T as bs}from"./toggle-pgzf9dtU.js";import{T as xa}from"./trash-D3PUqNUw.js";import{T as ba}from"./table-bK3MdmGi.js";import{C as Li}from"./calendar-range-I__hkhzs.js";import{E as Sa}from"./ellipsis-vertical-Cmo55STl.js";import{D as Xn}from"./download-BPcFEYUw.js";import{F as ja}from"./file-up-DkWhkBgA.js";import{i as va}from"./input-class-name-CLpWM5B0.js";import{X as vs}from"./x-E2J_ExBq.js";import{s as tn,t as as,u as wa}from"./useWeek-Dg2-HM4G.js";import{B as _a}from"./building-2-0MaMSxGv.js";import{u as Fi}from"./current-organization-DBnYvl3j.js";import{f as ka}from"./FileSaver.min-CHcmwUUn.js";import"./badge-DJm4Hqap.js";import"./tag-FOomi1GW.js";import"./radio-group-BtNIVdC-.js";import"./index-JzjpaTA2.js";import"./index-CXZCay7u.js";import"./index-jjkLF7kJ.js";import"./weekday-labels-tZYPNgX9.js";import"./label-Chi7z3bV.js";import"./toggle-group-0Td0_q05.js";import"./index-DkVNVtgg.js";import"./calendar-sync-BcfBPHRp.js";import"./TagForm-DCWLIZcx.js";import"./RoleForm-cBCazHqq.js";import"./textarea-yqvxCBGR.js";import"./validation-messages-DVhBsbnn.js";import"./dialog-QG_DREPA.js";import"./trash-2-DNWJq7ox.js";import"./input-Bh56ttuS.js";import"./circle-check-C5qc9Qaj.js";import"./circle-x-CDt8t1dd.js";import"./index-Br_TbOzh.js";import"./pro-upgrade-dialog-YHYUHDDB.js";import"./segmented-control-B0repPE5.js";import"./use-current-billing-fyWlVQUc.js";import"./calendar-days-o4mrIiCC.js";import"./sparkles-WGM893nQ.js";import"./convex-storage-upload-C6GnnHWh.js";import"./tabs-DBPM43If.js";import"./archive-DBOaU2V4.js";import"./circle-alert-DAu8rk68.js";import"./table-6MkqNJ_-.js";import"./pencil-xSXU0NPF.js";import"./circle-slash-D4TcGWFc.js";import"./clock-CFpZHkBa.js";/** 2 * @license lucide-react v0.553.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ca=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Da=is("ban",Ca);/** 7 * @license lucide-react v0.553.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Ia=[["path",{d:"M10 6h8",key:"zvc2xc"}],["path",{d:"M12 16h6",key:"yi5mkt"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 11h7",key:"wz2hg0"}]],Ta=is("chart-gantt",Ia);/** 12 * @license lucide-react v0.553.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const Na=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ma=is("funnel",Na);/** 17 * @license lucide-react v0.553.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const Ea=[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]],Zn=is("group",Ea);/** 22 * @license lucide-react v0.553.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const Ra=[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]],Dn=is("move-down",Ra);/** 27 * @license lucide-react v0.553.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const Aa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}
31],["path",{d:"M21 15H3",key:"9uk58r"}]],fs=is("rows-3",Aa);/** 32 * @license lucide-react v0.553.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */const Ba=[["path",{d:"M12 13v7a2 2 0 0 0 4 0",key:"rpgb42"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M20.992 13a1 1 0 0 0 .97-1.274 10.284 10.284 0 0 0-19.923 0A1 1 0 0 0 3 13z",key:"124nyo"}]],Wi=is("umbrella",Ba);function $a(i){const e=je.c(16);let s,o;e[0]!==i?({size:o,...s}=i,e[0]=i,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=o===void 0?"24px":o;let d,a,l,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("path",{d:"M9.12015 8.16C10.1529 7.38542 10.6693 6.99813 11.2364 6.84884C11.737 6.71706 12.2632 6.71705 12.7638 6.84883C13.331 6.99812 13.8474 7.38541 14.8801 8.15999L20.5868 12.44C21.7448 13.3085 22.3238 13.7427 22.5308 14.275C22.7122 14.7413 22.7122 15.2586 22.5308 15.7249C22.3238 16.2573 21.7448 16.6915 20.5868 17.56L14.8801 21.84C13.8474 22.6146 13.331 23.0019 12.7638 23.1512C12.2632 23.2829 11.737 23.2829 11.2364 23.1512C10.6693 23.0019 10.1529 22.6146 9.12014 21.84L3.41349 17.56C2.25552 16.6915 1.67654 16.2573 1.4695 15.7249C1.28816 15.2586 1.28816 14.7413 1.46951 14.275C1.67655 13.7427 2.25553 13.3085 3.41349 12.44L9.12015 8.16Z",fill:"url(#d3n7rwctdx5-1752500502793-639649_layers_existing_0_b0rh2cs4r)","data-glass":"origin",mask:"url(#d3n7rwctdx5-1752500502793-639649_layers_mask_lh5t9hjjm)"}),a=t.jsx("path",{d:"M9.12015 8.16C10.1529 7.38542 10.6693 6.99813 11.2364 6.84884C11.737 6.71706 12.2632 6.71705 12.7638 6.84883C13.331 6.99812 13.8474 7.38541 14.8801 8.15999L20.5868 12.44C21.7448 13.3085 22.3238 13.7427 22.5308 14.275C22.7122 14.7413 22.7122 15.2586 22.5308 15.7249C22.3238 16.2573 21.7448 16.6915 20.5868 17.56L14.8801 21.84C13.8474 22.6146 13.331 23.0019 12.7638 23.1512C12.2632 23.2829 11.737 23.2829 11.2364 23.1512C10.6693 23.0019 10.1529 22.6146 9.12014 21.84L3.41349 17.56C2.25552 16.6915 1.67654 16.2573 1.4695 15.7249C1.28816 15.2586 1.28816 14.7413 1.46951 14.275C1.67655 13.7427 2.25553 13.3085 3.41349 12.44L9.12015 8.16Z",fill:"url(#d3n7rwctdx5-1752500502793-639649_layers_existing_0_b0rh2cs4r)","data-glass":"clone",filter:"url(#d3n7rwctdx5-1752500502793-639649_layers_filter_kkalz5ssh)",clipPath:"url(#d3n7rwctdx5-1752500502793-639649_layers_clipPath_il5y28du5)"}),l=t.jsx("path",{d:"M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z",fill:"url(#d3n7rwctdx5-1752500502793-639649_layers_existing_1_b23jvecwf)","data-glass":"blur"}),f=t.jsx("path",{d:"M11.237 0.848781C11.7375 0.717108 12.2639 0.717038 12.7644 0.848781C13.3314 0.998119 13.8479 1.38584 14.8806 2.1603L20.5866 6.44056C21.7446 7.30903 22.3239 7.74317 22.5309 8.27552C22.7121 8.74164 22.7121 9.25861 22.5309 9.72473C22.3239 10.2571 21.7446 10.6912 20.5866 11.5597L14.8806 15.8399L14.194 16.3507C13.5865 16.7934 13.1897 17.0395 12.7644 17.1515L12.5749 17.1944C12.1953 17.2685 11.805 17.2685 11.4255 17.1944L11.237 17.1515C10.8117 17.0395 10.4147 16.7933 9.80733 16.3507L9.12081 15.8399L3.4138 11.5597C2.25593 10.6913 1.67649 10.2571 1.46947 9.72473C1.31093 9.31688 1.29097 8.86987 1.4099 8.45227L1.46947 8.27552C1.62471 7.87635 1.98934 7.53197 2.65013 7.01868L3.4138 6.44056L9.12081 2.1603C10.0243 1.48266 10.5323 1.10089 11.0251 0.916164L11.237 0.848781ZM12.5729 1.57436C12.1975 1.47557 11.8029 1.47554 11.4274 1.57436C11.0366 1.67728 10.6561 1.94538 9.57003 2.75991L3.86399 7.04017C3.27389 7.48274 2.87129 7.78513 2.58665 8.04114C2.30554 8.29399 2.20972 8.44147 2.16868 8.547C2.05534 8.83843 2.05534 9.16182 2.16868 9.45325C2.20973 9.55878 2.30557 9.70629 2.58665 9.95911C2.87129 10.2151 3.27391 10.5175 3.86399 10.9601L9.57003 15.2403C10.6561 16.0549 11.0366 16.323 11.4274 16.4259C11.8029 16.5247 12.1975 16.5247 12.5729 16.4259C12.9638 16.323 13.3443 16.0549 14.4304 15.2403L20.1374 10.9601C20.7272 10.5177 21.1292 10.215 21.4137 9.95911C21.6947 9.70637 21.7906 9.55877 21.8317 9.45325C21.945 9.16182 21.945 8.83843 21.8317 8.547C21.7906 8.44148 21.6948 8.2939 21.4137 8.04114C21.1292 7.7852 20.7272 7.48254 20.1374 7.04017L14.4304 2.75991C13.3443 1.94534 12.9638 1.67725 12.5729 1.57436Z",fill:"url(#d3n7rwctdx5-1752500502793-639649_layers_existing_2_j9tnotxte)"}),e[3]=d,e[4]=a,e[5]=l,e[6]=f):(d=e[3],a=e[4],l=e[5],f=e[6]);let r;e[7]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("linearGradient",{id:"d3n7rwctdx5-1752500502793-639649_layers_existing_0_b0rh2cs4r",x1:"12",y1:"6.75",x2:"12",y2:"23.25",gradientUnits:"userSpaceOnUse",children:[t.jsx("stop",{stopColor:"var(--nc-gradient-1-color-1,#575757)","data-glass-11":"on"}),t.jsx("stop",{offset:"1",stopColor:"var(--nc-gradient-1-color-2,#151515)","data-glass-12":"on"})]}),e[7]=r):r=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("linearGradient",{id:"d3n7rwctdx5-1752500502793-639649_layers_existing_1_b23jvecwf",x1:"12",y1:".75",x2:"12",y2:"17.25",gradientUnits:"userSpaceOnUse",children:[t.jsx("stop",{stopColor:"var(--nc-gradient-2-color-1,#E3E3E599)","data-glass-21":"on"}),t.jsx("stop",{offset:"1",stopColor:"var(--nc-gradient-2-color-2,#BBBBC099)","data-glass-22":"on"})]}),e[8]=m):m=e[8];let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsxs("linearGradient",{id:"d3n7rwctdx5-1752500502793-639649_layers_existing_2_j9tnotxte",x1:"12",y1:".75",x2:"12",y2:"10.305",gradientUnits:"userSpaceOnUse",children:[t.jsx("stop",{stopColor:"var(--nc-light,#fff)","data-glass-light":"on"}),t.jsx("stop",{offset:"1",stopColor:"var(--nc-light,#fff)",stopOpacity:"0","data-glass-light":"on"})]}),e[9]=c):c=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("filter",{id:"d3n7rwctdx5-1752500502793-639649_layers_filter_kkalz5ssh",x:"-100%",y:"-100%",width:"400%",height:"400%",filterUnits:"objectBoundingBox",primitiveUnits:"userSpaceOnUse",children:t.jsx("feGaussianBlur",{stdDeviation:"2",x:"0%",y:"0%",width:"100%",height:"100%",in:"SourceGraphic",edgeMode:"none",result:"blur"})}),e[10]=h):h=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("clipPath",{id:"d3n7rwctdx5-1752500502793-639649_layers_clipPath_il5y28du5",children:t.jsx("path",{d:"M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z",fill:"url(#d3n7rwctdx5-1752500502793-639649_layers_existing_1_b23jvecwf)"})}),e[11]=p):p=e[11];let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs("g",{fill:"none",className:"nc-icon-wrapper",children:[d,a,l,f,t.jsxs("defs",{children:[r,m,c,h,p,t.jsxs("mask",{id:"d3n7rwctdx5-1752500502793-639649_layers_mask_lh5t9hjjm",children:[t.jsx("rect",{width:"100%",height:"100%",fill:"#FFF"}),t.jsx("path",{d:"M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z",fill:"#000"})]})]})]}),e[12]=y):y=e[12];let g;return e[13]!==s||e[14]!==n?(g=t.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...s,children:y}),e[13]=s,e[14]=n,e[15]=g):g=e[15],g}function In(i,e){return As(i,e?.in).getDay()}function Tn(i,e){return ko(Co(i,i),Go(i))}function zi(i,e,s){const o=+As(i,s?.in),[n,d]=[+As(e.start,s?.in),+As(e.end,s?.in)].sort((a,l)=>a-l);return o>=n&&o<=d}function Oa(i,e,s){return jt(i,-1,s)}const Pa=i=>{let{activatorEvent:e,draggingNodeRect:s,transform:o}=i;if(s&&e){const n=Po(e);if(!n)return o;const d=n.x-s.left,a=n.y-s.top;return{...o,x:o.x+d-s.width/2,y:o.y+a-s.height/2}}return o},Nn={};function ds(i){return(i?.size??0)>0}function La(i){return ds(i.roleIds)||ds(i.tagIds)||ds(i.addressIds)}function hs(i,e){return!(ds(e.roleIds)&&(!i.companyRoleId||!e.roleIds?.has(i.companyRoleId))||ds(e.tagIds)&&!(i.tagIds??[]).some(o=>e.tagIds?.has(o))||ds(e.addressIds)&&(!i.addressId||!e.addressIds?.has(i.addressId)))}function Us(i,e=Nn){return La(e)?i.filter(s=>hs(s,e)):i}function Fa(i){const e="seriesId"in i?i.seriesId:void 0;return e?`${e}:${i.date}`:`${i._id}:${i.date}`}function Hi({employees:i,flatAvailabilities:e,startDate:s,dayCount:o=7}){const n={},d={};
36return i.forEach(a=>{n[a._id]=Array(o).fill(null).map(()=>[]),d[a._id]=Array(o).fill(null).map(()=>new Set)}),e.forEach(a=>{if(n[a.employeeId])for(let l=0;l<o;l++){if(!pi(a,jt(s,l)))continue;const f=Fa(a),r=d[a.employeeId]?.[l];r?.has(f)||(r?.add(f),n[a.employeeId][l].push(a))}}),n}function Wa(i,e,s,o){const n=je.c(68),d=o===void 0?Nn:o;let a;n[0]===Symbol.for("react.memo_cache_sentinel")?(a=Ye(De.employees.listAll,{visibleInRoster:!0}),n[0]=a):a=n[0];const{data:l}=Vt(a);let f;n[1]===Symbol.for("react.memo_cache_sentinel")?(f=Ye(De.tags.listAll,{}),n[1]=f):f=n[1];const{data:r}=Vt(f);let m;n[2]===Symbol.for("react.memo_cache_sentinel")?(m=Ye(De.companyRoles.listAll,{}),n[2]=m):m=n[2];const{data:c}=Vt(m);let h;n[3]===Symbol.for("react.memo_cache_sentinel")?(h=Ye(De.addresses.listAll,{includeArchived:!0}),n[3]=h):h=n[3];const{data:p}=Vt(h),y=Oe(i,Je),g=Oe(jt(i,6),Je),u=ut(Ye(De.shifts.listByDateRangeAndEmployeeIdsFlat,{employeeIds:l.map(Ka),startDate:y,endDate:g,branchId:s})),x=ut(Ye(De.shifts.listByDateRangeAndEmployeeIdsFlat,{employeeIds:l.map(Ga),startDate:y,endDate:g}
36)),b=ut(Ye(De.absences.listAbsencesForPlan,{startDate:y,endDate:g,employeeIds:l.map(Ua)})),v=ut(Ye(De.availabilities.listAvailabilities,{startDate:y,endDate:g,employeeIds:l.map(Qa)}));let j;n[4]!==l?(j=Ye(De.availabilities.listAvailabilitySeries,{employeeIds:l.map(Va)}),n[4]=l,n[5]=j):j=n[5];const w=ut(j);let C;n[6]!==b.data?(C=b.data??[],n[6]=b.data,n[7]=C):C=n[7];const D=C;let _;n[8]!==v.data?(_=v.data??[],n[8]=v.data,n[9]=_):_=n[9];const S=_;let N;n[10]!==w.data?(N=w.data??[],n[10]=w.data,n[11]=N):N=n[11];const B=N;let A;n[12]!==u.data?(A=u.data??[],n[12]=u.data,n[13]=A):A=n[13];const R=A;let F;n[14]!==x||n[15]!==s||n[16]!==R?(F=s?x.data??[]:R,n[14]=x,n[15]=s,n[16]=R,n[17]=F):F=n[17];const H=F;let M;n[18]!==d||n[19]!==R?(M=Us(R,d),n[18]=d,n[19]=R,n[20]=M):M=n[20];const O=M;let Q;n[21]!==H||n[22]!==d?(Q=Us(H,d),n[21]=H,n[22]=d,n[23]=Q):Q=n[23];const $=Q,E=u.isPending||(s?x.isPending:!1);let I=l;if(s){let U;if(n[24]!==s||n[25]!==I){let te;n[27]!==s?(te=se=>se.branches.some(oe=>oe._id===s),n[27]=s,n[28]=te):te=n[28],U=I.filter(te),n[24]=s,n[25]=I,n[26]=U}else U=n[26];I=U}if(e){let U;if(n[29]!==I||n[30]!==e){let te;n[32]!==e?(te=se=>Ii(se.name,e),n[32]=e,n[33]=te):te=n[33],U=I.filter(te),n[29]=I,n[30]=e,n[31]=U}else U=n[31];I=U}const P=I;let G;n[34]!==P?(G=U=>{const te={};return P.forEach(se=>{te[se._id]=Array(7).fill(null).map(Ha)}),U.forEach(se=>{if(se.assignedEmployeeId&&te[se.assignedEmployeeId]){const oe=ts(se.date);if(!oe)return;const be=Ts(oe)-1;be>=0&&be<7&&te[se.assignedEmployeeId][be].push(se)}}),te},n[34]=P,n[35]=G):G=n[35];const k=G;let T;n[36]!==O||n[37]!==k?(T=k(O),n[36]=O,n[37]=k,n[38]=T):T=n[38];const W=T;let L;n[39]!==$||n[40]!==k?(L=k($),n[39]=$,n[40]=k,n[41]=L):L=n[41];const q=L;let Z;n[42]!==P||n[43]!==D||n[44]!==i?(Z={},P.forEach(U=>{Z[U._id]=Array(7).fill(null).map(za)}),D.forEach(U=>
36{if(!Z[U.employeeId])return;const te=new Date(U.startAt),se=new Date(U.endAt);for(let oe=0;oe<7;oe++){const be=jt(i,oe);zi(be,{start:new Date(te.getFullYear(),te.getMonth(),te.getDate()),end:new Date(se.getFullYear(),se.getMonth(),se.getDate())})&&Z[U.employeeId][oe].push(U)}}),n[42]=P,n[43]=D,n[44]=i,n[45]=Z):Z=n[45];const ne=Z;let Y;n[46]!==P||n[47]!==S||n[48]!==i?(Y=Hi({employees:P,flatAvailabilities:S,startDate:i}),n[46]=P,n[47]=S,n[48]=i,n[49]=Y):Y=n[49];const ae=Y;let le;return n[50]!==p||n[51]!==H||n[52]!==q||n[53]!==c||n[54]!==l||n[55]!==$||n[56]!==P||n[57]!==O||n[58]!==D||n[59]!==S||n[60]!==B||n[61]!==R||n[62]!==ne||n[63]!==ae||n[64]!==W||n[65]!==E||n[66]!==r?(le={employees:l,companyRoles:c,addresses:p,tags:r,flatShifts:R,allLocationFlatShifts:H,filteredFlatShifts:O,filteredAllLocationFlatShifts:$,flatAbsences:D,flatAvailabilities:S,flatAvailabilitySeries:B,isLoadingShifts:E,filteredEmployees:P,groupShiftsByEmployeeAndDay:W,allLocationGroupShiftsByEmployeeAndDay:q,groupAbsencesByEmployeeAndDay:ne,groupAvailabilitiesByEmployeeAndDay:ae},n[50]=p,n[51]=H,n[52]=q,n[53]=c,n[54]=l,n[55]=$,n[56]=P,n[57]=O,n[58]=D,n[59]=S,n[60]=B,n[61]=R,n[62]=ne,n[63]=ae,n[64]=W,n[65]=E,n[66]=r,n[67]=le):le=n[67],le}function za(){return[]}function Ha(){return[]}function Va(i){return i._id}function Qa(i){return i._id}function Ua(i){return i._id}function Ga(i){return i._id}function Ka(i){return i._id}function Gs(i){return i.reduce((e,s)=>e+(s.workedMinutes??0)/60,0)}function Vi(i,e=kn){const s=Gs(i),o=s-e;return{credited:s,quota:e,overtime:o}}function Mn(i){const{allShifts:e,visibleShifts:s,branchNameById:o,selectedBranchId:n}=i;if(!n)return null;const d=Gs(e),a=Gs(s),l=d-a;if(l<=0)return null;const f=new Map;for(const m of e){const c=(m.workedMinutes??0)/60;f.set(m.branchId,(f.get(m.branchId)??0)+c)}const r=Array.from(f.entries()).map(([m,c])=>({branchId:m,branchName:o[m]??"Unknown location",hours:c,isSelectedBranch:m===n})).sort((m,c)=>m.isSelectedBranch!==c.isSelectedBranch?m.isSelectedBranch?-1:1:c.hours!==m.hours?c.hours-m.hours:m.branchName.localeCompare(c.branchName));return{totalHours:d,visibleHours:a,hiddenHours:l,entries:r}}function En(i){const e=je.c(34),{color:s,name:o,count:n,open:d,onToggle:a,stickyLabelWidth:l,trailing:f,className:r}=i,m=`var(--${s}-3)`,c=`var(--${s}-4)`,h=`var(--${s}-11)`,p=`var(--${s}-9)`;let y;e[0]!==m||e[1]!==c||e[2]!==h||e[3]!==p?(y={"--rg-bg":m,"--rg-bg-hover":c,"--rg-fg":h,"--rg-dot":p},e[0]=m,e[1]=c,e[2]=h,e[3]=p,e[4]=y):y=e[4];let g;e[5]!==r?(g=Be("group flex w-full items-center bg-(--rg-bg) text-left text-(--rg-fg) transition-colors hover:bg-(--rg-bg-hover)",r),e[5]=r,e[6]=g):g=e[6];const u=l!==void 0&&"sticky left-0 z-2";let x;e[7]!==u?(x=Be("flex items-center gap-2 bg-(--rg-bg) px-2.5 py-1 transition-colors group-hover:bg-(--rg-bg-hover)",u),e[7]=u,e[8]=x):x=e[8];let b;e[9]!==l?(b=l!==void 0?{width:l}:void 0,e[9]=l,e[10]=b):b=e[10];const v=d&&"rotate-90";let j;e[11]!==v?(j=Be("size-3.5 shrink-0 transition-transform",v),e[11]=v,e[12]=j):j=e[12];let w;e[13]!==j?(w=t.jsx(zs,{className:j}),e[13]=j,e[14]=w):w=e[14];let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("span",{className:"size-2 shrink-0 rounded-xs bg-(--rg-dot)"}),e[15]=C):C=e[15];let D;e[16]!==o?(D=t.jsx("span",{className:"min-w-0 truncate text-xs font-semibold",children:o}),e[16]=o,e[17]=D):D=e[17];let _;e[18]!==n?(_=t.jsx("span",{className:"text-[11px] tabular-nums opacity-70",children:n}),e[18]=n,e[19]=_):_=e[19];let S;e[20]!==f?(S=f!==void 0&&t.jsx("span",{className:"flex shrink-0 items-center",children:f}),e[20]=f,e[21]=S):S=e[21];let N;e[22]!==w||e[23]!==D||e[24]!==_||e[25]!==S||e[26]!==x||e[27]!==b?(N=t.jsxs("span",{className:x,style:b,children:[w,C,D,_,S]}),e[22]=w,e[23]=D,e[24]=_,e[25]=S,e[26]=x,e[27]=b,e[28]=N):N=e[28];let B;return e[29]!==a||e[30]!==N||e[31]!==y||e[32]!==g?(B=t.jsx("button",{type:"button",onClick:a,style:y,className:g,children:N}),e[29]=a,e[30]=N,e[31]=y,e[32]=g,e[33]=B):B=e[33],B}function Rn(i){const e=je.c(12),{count:s,onShowAll:o}=i,{i18n:n}=at();if(s<=0)return null;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(fs,{className:"text-amber-11 size-3.5"}),e[0]=d):d=e[0];let a;e[1]!==s||e[2]!==n?(a=n._({id:"roster.hiddenEmptyRowsFooter",message:"{count, plural, one {# row hidden by filter} other {# rows hidden by filter}}",values:{count:s}}),e[1]=s,e[2]=n,e[3]=a):a=e[3];let l;e[4]!==a?(l=t.jsx("span",{className:"text-amber-11",children:a}),e[4]=a,e[5]=l):l=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(J,{id:"roster.showAllRows"}),e[6]=f):f=e[6];let r;e[7]!==o?(r=t.jsx("button",{type:"button",onClick:o,className:"text-amber-12 hover:text-amber-12 font-medium underline-offset-2 hover:underline",children:f}),e[7]=o,e[8]=r):r=e[8];let m;return e[9]!==l||e[10]!==r?(m=t.jsxs("div",{className:"bg-amber-2/60 border-amber-6/40 my-3 flex items-center justify-center gap-2 rounded-md border border-dashed px-4 py-2 text-xs",children:[d,l,r]}),e[9]=l,e[10]=r,e[11]=m):m=e[11],m}const ns=1440,Ms=15,Qi=15,Ya=ns-Qi;function hn(i){const[e,s]=i.split(":").map(Number);return e*60+(s||0)}function Ds(i){const e=(i%ns+ns)%ns,s=Math.floor(e/60),o=e%60;return`${String(s).padStart(2,"0")}
36:${String(o).padStart(2,"0")}`}function Ui(i,e=Ms){return Math.round(i/e)*e}function Gi(i,e,s=Ms){const o=i/e*60;return Ui(o,s)}function Ki(i,e){const s=hn(i);let o=hn(e);return o<=s&&(o+=ns),{start:s,end:o}}function qa(i){const{startTime:e,endTime:s,deltaMinutes:o}=i,{start:n,end:d}=Ki(e,s),a=ns-Ms;let l=n+o;l<0&&(l=0),l>a&&(l=a),o>0&&l<n&&(l=n),o<0&&l>n&&(l=n);const f=l-n;return{startTime:Ds(n+f),endTime:Ds(d+f)}}function An(i){const{startTime:e,endTime:s,edge:o,deltaMinutes:n,minDurationMinutes:d=Qi}=i;let{start:a,end:l}=Ki(e,s);const f=ns-Ms,r=Math.max(d,Ya);if(o==="start"){const m=Math.max(0,l-r),c=Math.min(f,l-d);a=Math.max(m,Math.min(a+n,c))}else{const m=a+d,c=a+r;l=Math.max(m,Math.min(l+n,c))}return{startTime:Ds(a),endTime:Ds(l)}}const ks=44,Xt=190,Ys=64,Is=36,Jn=28,Xa=Ms,Yi=6,qi=4;function Ft(i){return hn(i)}function qs(i,e,s=ks){return(i-e)/60*s}function Za(i,e,s,o=ks){let n=Ft(i.startTime),d=Ft(i.endTime);Ks({startTime:i.startTime,endTime:i.endTime})&&(d=s),n=Math.max(n,e),d=Math.min(d,s);const a=qs(n,e,o),l=(d-n)/60*o;return{left:Math.max(0,a),width:Math.max(0,l)}}const ei=Gi,Ja=An;function Xi(i){const e=new Map;if(i.length===0)return{laneByShiftId:e,laneCount:1};const s=[...i].sort((n,d)=>Ft(n.startTime)-Ft(d.startTime)),o=[];for(const n of s){const d=Ft(n.startTime);let a=Ft(n.endTime);Ks({startTime:n.startTime,endTime:n.endTime})&&(a=1440);let l=-1;for(let f=0;f<o.length;f++)if(o[f]<=d){l=f;break}l===-1?(l=o.length,o.push(a)):o[l]=a,e.set(yt(n),l)}return{laneByShiftId:e,laneCount:Math.max(1,o.length)}}function Zi(i){return i<=1?Ys:Yi*2+i*Is+(i-1)*qi}function Ji(i,e){return e<=1?(Ys-Is)/2:Yi+i*(Is+qi)}function eo(i,e){if(e==="12h"){const s=i<12?"AM":"PM";return`${i%12===0?12:i%12} ${s}`}return`${String(i).padStart(2,"0")}:00`}function ti({event:i,hourWidth:e,viewStartMinutes:s}){const o=i.currentTarget.getBoundingClientRect(),d=(i.clientX-o.left)/e*60+s,a=Ui(d,Xa),l=Math.max(0,Math.min(a,1425));return Ds(l)}function el(i){const e=je.c(21),{hourSlots:s,hourWidth:o,shiftsByHour:n,companyRoles:d}=i,{i18n:a}=at(),{timeFormat:l}=Wt();let f;e[0]!==n?(f=Array.from(n.values()).map(tl),e[0]=n,e[1]=f):f=e[1];const r=Math.max(1,...f);let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m={height:Jn},e[2]=m):m=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"border-border bg-slate-1 sticky left-0 z-10 flex shrink-0 items-center border-r px-3 text-xs font-medium text-zinc-500",style:{width:Xt},children:t.jsx(J,{id:"dayView.coverage.label"})}),e[3]=c):c=e[3];let h;if(e[4]!==d||e[5]!==s||e[6]!==o||e[7]!==a||e[8]!==r||e[9]!==n||e[10]!==l){let y;e[12]!==d||e[13]!==o||e[14]!==a||e[15]!==r||e[16]!==n||e[17]!==l?(y=g=>{const u=n.get(g)??{total:0,byRole:new Map},x=r>0?u.total/r:0,b=u.total===0?"text-slate-9":x>=.85?"bg-green-7 text-green-12":x>=.65?"bg-green-6 text-green-12":x>=.45?"bg-green-5 text-green-12":x>=.25?"bg-green-4 text-green-11":"bg-green-3 text-green-11";return t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx("div",{className:Be("border-border flex items-center justify-center border-r text-xs font-medium",b),style:{width:o,height:Jn},children:u.total})}),t.jsx(ht,{children:t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"font-medium",children:[eo(g,l)," â ",u.total," ",a._({id:"dayView.coverage.staff"})]}),Array.from(u.byRole.entries()).map(v=>{const[j,w]=v,C=d.find(D=>D._id===j);return t.jsxs("p",{className:"text-xs",children:[C?.name??a._({id:"dayView.coverage.unknownRole"}),": ",w]},j)})]})})]},g)},e[12]=d,e[13]=o,e[14]=a,e[15]=r,e[16]=n,e[17]=l,e[18]=y):y=e[18],h=s.map(y),e[4]=d,e[5]=s,e[6]=o,e[7]=a,e[8]=r,e[9]=n,e[10]=l,e[11]=h}else h=e[11];let p;return e[19]!==h?(p=t.jsxs("div",{className:"border-border flex border-b",style:m,children:[c,t.jsx("div",{className:"flex",children:h})]}),e[19]=h,e[20]=p):p=e[20],p}function tl(i){return i.total}function sl(i){const e=je.c(13),{viewStartMinutes:s,viewEndMinutes:o,hourWidth:n,selectedDate:d}=i,{intlOptions:a}=Wt(),[l,f]=ee.useState(nl);let r,m;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const v=setInterval(()=>f(new Date),6e4);return()=>clearInterval(v)},m=[],e[0]=r,e[1]=m):(r=e[0],m=e[1]),ee.useEffect(r,m),!Tn(d))return null;const c=l.getHours()*60+l.getMinutes();if(c<s||c>o)return null;const h=qs(c,s,n),p=Xt+h;let y;e[2]!==p?(y={left:p},e[2]=p,e[3]=y):y=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"bg-red-9 h-full w-[2px]"}),e[4]=g):g=e[4];let u;e[5]!==a?(u={timeStyle:"short",...a},e[5]=a,e[6]=u):u=e[6];let x;e[7]!==l||e[8]!==u?(x=t.jsx("div",{className:"bg-red-9 text-red-1 absolute -top-5 left-1/2 -translate-x-1/2 roun
36ded px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap",children:t.jsx(Do,{options:u,children:l})}),e[7]=l,e[8]=u,e[9]=x):x=e[9];let b;return e[10]!==y||e[11]!==x?(b=t.jsxs("div",{className:"pointer-events-none absolute top-0 bottom-0 z-20",style:y,children:[g,x]}),e[10]=y,e[11]=x,e[12]=b):b=e[12],b}function nl(){return new Date}function si(i){const[e,s]=i.split(":");if(!e||!s)return null;const o=Number(e),n=Number(s);return!Number.isInteger(o)||!Number.isInteger(n)||o<0||o>23||n<0||n>59?null:{hours:o,minutes:n}}function il(i){return un(i.date,i.startTime,i.endTime)}function un(i,e,s){const o=ts(i);if(!o)return null;const n=si(e),d=si(s);if(!n||!d)return null;const a=new Date(o);a.setHours(n.hours,n.minutes,0,0);const l=new Date(o);return l.setHours(d.hours,d.minutes,0,0),l<=a&&l.setDate(l.getDate()+1),{start:a,end:l}}function ol(i,e){if(!e.isAllDay&&e.startTime&&e.endTime&&e.date)return un(e.date,e.startTime,e.endTime);const s=new Date(e.startAt),o=new Date(e.endAt);if(s.setSeconds(0,0),o.setSeconds(0,0),o<=s&&e.endTime&&e.startTime){const n=un(i.date,e.startTime,e.endTime);if(n)return n}return{start:s,end:o}}function al(i,e){return i.start<e.end&&e.start<i.end}function Xs(i,e){const s=il(i);return s?e.some(o=>{const n=ol(i,o);return n?al(s,n):!1}):!1}const ll=.05;function Bn({scheduledHours:i,quotaHours:e,period:s,delta:o=i-e,timeAccountBalanceMinutes:n,locationBreakdown:d,layout:a="inline",name:l,className:f}){const{i18n:r}=at(),m=d?t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:r._(cl(s))}),t.jsx("div",{className:"space-y-1",children:d.entries.map(x=>t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{className:Be(x.isSelectedBranch&&"text-slate-12 font-medium"),children:x.branchName}),t.jsx("span",{className:"text-slate-12 font-medium",children:Kt(x.hours)})]},x.branchId))})]}):r._(rl(s)),c=t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx("span",{className:"text-slate-12 cursor-help font-medium tabular-nums",children:Kt(i)})}),t.jsx(ht,{children:m})]}),h=t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx("span",{className:"cursor-help tabular-nums",children:Kt(e)})}),t.jsx(ht,{children:r._(dl(s))})]}),p=Math.abs(o)>=ll&&t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsxs("span",{className:Be("shrink-0 cursor-help font-medium tabular-nums",o>0&&"text-red-11",o<0&&"text-amber-11"),children:[o>0?"+":"",Kt(o)]})}),t.jsx(ht,{children:r._(ml(s))})]}),y=n!=null,g=y?n/60:0,u=y&&t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsxs("span",{className:Be("flex shrink-0 cursor-help items-center gap-0.5 font-medium tabular-nums",g>0&&"text-green-11",g<0&&"text-red-11",g===0&&"text-slate-11"),children:[t.jsx(ma,{className:"size-3 shrink-0 opacity-70"}),g>0?"+":"",Kt(g)]})}),t.jsx(ht,{children:r._(fl(s))})]});return a==="stacked"?t.jsxs("div",{className:Be("flex flex-col gap-0.5",f),children:[t.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[l,u&&t.jsx("span",{className:"text-[11px]",children:u})]}),t.jsxs("div",{className:"text-slate-11 flex items-center justify-between gap-1.5 text-[11px]",children:[t.jsxs("span",{className:"flex gap-1",children:[c,t.jsx("span",{children:"/"}),h]}),p]})]}):t.jsxs("div",{className:Be("text-slate-9 flex justify-between text-xs",f),children:[t.jsxs("div",{className:"flex gap-1",children:[c,t.jsx("span",{children:"/"}),h]}),t.jsxs("div",{className:"flex items-center gap-2",children:[p,u]})]})}function rl(i){return i==="day"?{id:"employeeHours.tooltip.scheduled.day"}:i==="month"?{id:"employeeHours.tooltip.scheduled.month"}:{id:"employeeHours.tooltip.scheduled.week"}}function cl(i){return i==="day"?{id:"employeeHours.tooltip.breakdown.day"}:i==="month"?{id:"employeeHours.tooltip.breakdown.month"}:{id:"employeeHours.tooltip.breakdown.week"}}function dl(i){return i==="day"?{id:"employeeHours.tooltip.contract.day"}:i==="month"?{id:"employeeHours.tooltip.contract.month"}:{id:"employeeHours.tooltip.contract.week"}}function ml(i){return i==="day"?{id:"employeeHours.tooltip.delta.day"}:i==="month"?{id:"employeeHours.tooltip.delta.month"}:{id:"employeeHours.tooltip.delta.week"}}function fl(i){return i==="month"?{id:"employeeHours.tooltip.timeAccount.month"}:{id:"employeeHours.tooltip.timeAccount.week"}}function to(i){const e=je.c(111),{shift:s,companyRoles:o,branchName:n,viewStartMinutes:d,viewEndMinutes:a,hourWidth:l,dragId:f,isDragGhost:r,canManageShiftTime:m,onClick:c,onResize:h,hasAbsenceConflict:p,hasAvailabilityConflict:y,top:g}=i,{i18n:u}=at(),{formatRange:x,formatTime:b}=Wt(),v=Ns();let j;e[0]!==s?(j=yt(s),e[0]=s,e[1]=j):j=e[1];const w=Ci(j);let C;if(e[2]!==o||e[3]!==s.companyRoleId){let K;e[5]!==s.companyRoleId?(K=Te=>Te._id===s.companyRoleId,e[5]=s.companyRoleId,e[6]=K):K=e[6],C=o.find(K),e[2]=o,e[3]=s.companyRoleId,e[4]=C}else C=e[4];const D=C,_=D?.name??"",S=D?.color??"slate",[N,B]=ee.useState(!1),[A,R]=ee.useState(null),F=ee.useRef(0),H=ee.useRef(null),M=A?{...s,startTime:A.startTime,endTime:A.endTime}:s,{left:O,width:Q}=Za(M,d,a,l);let $;e[7]!==l||e[8]!==s?($={...s,dragContext:"day-view",dayViewHourWidth:l},e[7]=l,e[8]=s,e[9]=$):$=e[9];const E=!m||N;let I;e[10]!==f||e[11]!==$||e[12]!==E?(I={id:f,data:$,disabled:E}
36,e[10]=f,e[11]=$,e[12]=E,e[13]=I):I=e[13];const{attributes:P,listeners:G,setNodeRef:k,isDragging:T}=wi(I),W=(s.overlappingShifts?.length??0)>0,L=W||p||y,q=Ks({startTime:M.startTime,endTime:M.endTime}),Z=s.workedMinutes===void 0?null:s.workedMinutes/60;let ne;e[14]!==n?(ne=n?n.split(/\s+/).filter(Boolean).map(pl).join("").slice(0,3).toUpperCase()||n.slice(0,3).toUpperCase():"",e[14]=n,e[15]=ne):ne=e[15];const Y=ne,ae=x(M.startTime,M.endTime);let le="";n&&Q>220?le=`${n} · ${_} · ${ae}`:n&&Q>150?le=`${n} · ${ae}`:n&&Q>110?le=n:n&&Q>90?le=Y:Q>150?le=`${_} · ${ae}`:Q>100&&(le=ae);let U;e[16]!==m||e[17]!==s.endTime||e[18]!==s.startTime?(U=K=>Te=>{m&&(Te.preventDefault(),Te.stopPropagation(),F.current=Date.now()+500,B(!0),H.current={edge:K,originX:Te.clientX,lastDeltaMinutes:0},R({startTime:s.startTime,endTime:s.endTime}))},e[16]=m,e[17]=s.endTime,e[18]=s.startTime,e[19]=U):U=e[19];const te=U;let se,oe;e[20]!==l||e[21]!==h||e[22]!==s.endTime||e[23]!==s.startTime?(se=()=>{const K=$e=>{const ke=H.current;if(!ke)return;const Qe=$e.clientX-ke.originX,nt=ei(Qe,l);if(nt===ke.lastDeltaMinutes)return;ke.lastDeltaMinutes=nt;const gt=Ja({startTime:s.startTime,endTime:s.endTime,edge:ke.edge,deltaMinutes:nt});R(gt)},Te=$e=>{const ke=H.current;if(!ke)return;const Qe=$e.clientX-ke.originX,nt=ei(Qe,l);nt!==0&&h(ke.edge,nt),F.current=Date.now()+500,H.current=null,R(null),requestAnimationFrame(()=>{B(!1)})};return window.addEventListener("pointermove",K),window.addEventListener("pointerup",Te),()=>{window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",Te)}},oe=[l,h,s.endTime,s.startTime],e[20]=l,e[21]=h,e[22]=s.endTime,e[23]=s.startTime,e[24]=se,e[25]=oe):(se=e[24],oe=e[25]),ee.useEffect(se,oe);let be,ie;if(e[26]!==T?(be=()=>{T&&(F.current=Date.now()+250)},ie=[T],e[26]=T,e[27]=be,e[28]=ie):(be=e[27],ie=e[28]),ee.useEffect(be,ie),Q<=0)return null;const fe=mt,he=ft,Ie=!0,de="button";let re;e[29]!==N||e[30]!==c?(re=K=>{K.stopPropagation(),!(Date.now()<F.current||N)&&c()},e[29]=N,e[30]=c,e[31]=re):re=e[31];const Se=u._({id:"dayView.shift.openAria",message:"Open shift {startTime} to {endTime}",values:{startTime:b(M.startTime),endTime:b(M.endTime)}}),X=L&&"ring-red-8 ring-[3px]",ge=m&&"cursor-grab active:cursor-grabbing",ce=N&&"cursor-ew-resize",Ce=T&&"z-20",Ee=r&&"border-slate-8 border-2 border-dashed opacity-60";let ue;e[32]!==X||e[33]!==ge||e[34]!==ce||e[35]!==Ce||e[36]!==Ee?(ue=Be("focus-visible:ring-slate-8/50 absolute flex cursor-pointer items-center gap-1 overflow-hidden rounded-lg border-0 px-2 text-xs font-medium transition-colors hover:brightness-95 focus-visible:ring-2 focus-visible:outline-hidden",X,ge,ce,Ce,Ee),e[32]=X,e[33]=ge,e[34]=ce,e[35]=Ce,e[36]=Ee,e[37]=ue):ue=e[37];const me=g??(Ys-Is)/2,_e=`var(--${S}-3)`,pe=`var(--${S}-12)`,Me=`3px solid var(--${S}-9)`;let Pe;e[38]!==O||e[39]!==me||e[40]!==_e||e[41]!==pe||e[42]!==Me||e[43]!==Q?(Pe={left:O,width:Q,height:Is,top:me,backgroundColor:_e,color:pe,borderLeft:Me},e[38]=O,e[39]=me,e[40]=_e,e[41]=pe,e[42]=Me,e[43]=Q,e[44]=Pe):Pe=e[44];let ze;e[45]!==m||e[46]!==te||e[47]!==Q?(ze=m&&Q>=48&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"before:bg-slate-11/45 absolute inset-y-0 left-0 z-10 w-2 cursor-ew-resize touch-none before:absolute before:top-1/2 before:left-[3px] before:h-4 before:w-px before:-translate-y-1/2",onPointerDown:te("start"),onClick:ul,"aria-hidden":!0}),t.jsx("span",{className:"before:bg-slate-11/45 absolute inset-y-0 right-0 z-10 w-2 cursor-ew-resize touch-none before:absolute before:top-1/2 before:right-[3px] before:h-4 before:w-px before:-translate-y-1/2",onPointerDown:te("end"),onClick:hl,"aria-hidden":!0})]}),e[45]=m,e[46]=te,e[47]=Q,e[48]=ze):ze=e[48];let He;e[49]!==L?(He=L&&t.jsxs("span",{className:"bg-red-3 relative flex size-4 shrink-0 items-center justify-center rounded-sm",children:[t.jsx("span",{className:"bg-red-6 absolute inline-flex size-full animate-ping rounded-full motion-reduce:animate-none"}),t.jsx(yn,{className:"text-red-11 relative size-3.5 shrink-0"})]}),e[49]=L,e[50]=He):He=e[50];let Ue;e[51]!==w?(Ue=w&&t.jsx("span",{className:"bg-amber-3 flex size-4 shrink-0 items-center justify-center rounded-sm",children:t.jsx($i,{className:"text-amber-11 size-3.5 shrink-0","aria-hidden":"true"})}),e[51]=w,e[52]=Ue):Ue=e[52];let Ge;e[53]!==q?(Ge=q&&t.jsx(ea,{className:"text-indigo-11 size-3.5 shrink-0"}),e[53]=q,e[54]=Ge):Ge=e[54];let Le;e[55]!==le||e[56]!==S?(Le=le?t.jsx("span",{className:"truncate",children:le}):t.jsx("div",{className:"size-2.5 shrink-0 rounded-full",style:{backgroundColor:`var(--${S}-9)`}}),e[55]=le,e[56]=S,e[57]=Le):Le=e[57];let Ke;e[58]!==P||e[59]!==G||e[60]!==k||e[61]!==re||e[62]!==Se||e[63]!==ue||e[64]!==Pe||e[65]!==ze||e[66]!==He||e[67]!==Ue||e[68]!==Ge||e[69]!==Le?(Ke=t.jsxs("button",{ref:k,type:de,onClick:re,"aria-label":Se,className:ue,...P,...G,style:Pe,children:[ze,He,Ue,Ge,Le]}),e[58]=P,e[59]=G,e[60]=k,e[61]=re,e[62]=Se,e[63]=ue,e[64]=Pe,e[65]=ze,e[66]=He,e[67]=Ue,e[68]=Ge,e[69]=Le,e[70]=Ke):Ke=e[70];let Re;e[71]!==he||e[72]!==Ke?(Re=t.jsx(he,{asChild:Ie,children:Ke}),e[71]=he,e[72]=Ke,e[73]=Re):Re=e[73];let qe;e[74]!==_?(qe=t.jsx("p",{className:"font-medium",children:_}),e[74]=_,e[75]=qe):qe=e[75];let st;e[76]!==n?(st=n&&t.jsx("p",{className:"text-xs",children:n}),e[76]=n,e[77]=st):st=e[77];let Ve;e[78]!==x||e[79]!==M.endTime||e[80]!==M.startTime?(Ve=x(M.startTime,M.endTime," â "),e[78]=x,e[79]=M.endTime,e[80]=M.startTime,e[81]=Ve):Ve=e[81];let we;e[82]!==Z?(we=Z===null?"â¦":Kt(Z),e[82]=Z,e[83]=we):we=e[83];let et;e[84]!==Ve||e[85]!==we?(et=t.jsxs("p",{className:"text-xs",children:[Ve," (",we,")"]}),e[84]=Ve,e[85]=we,e[86]=et):et=e[86];let tt;e[87]!==s.comment?(tt=s.comment&&t.jsx("p",{className:"max-w-[200px] text-xs italic",children:s.comment}),e[87]=s.comment,e[88]=tt):tt=e[88];let Xe;e[89]!==p||e[90]!==y||e[91]!==L||e[92]!==W?(Xe=L&&t.jsxs(Ei,{className:"mt-1",children:[W&&t.jsx("p",{children:t.jsx(J,{id:"dayView.shift.tooltip.overlap"})}),p&&t.jsx("p",{children:t.jsx(J,{id:"dayView.shift.tooltip.absenceConflict"})}),y&&t.jsx("p",{children:t.jsx(J,{id:"dayView.shift.tooltip.availabilityConflict"})})]}),e[89]=p,e[90]=y,e[91]=L,e[92]=W,e[93]=Xe):Xe=e[93];let ve;e[94]!==v||e[95]!==w?(ve=w&&t.jsxs("div",{className:"text-amber-9 text-xs",children:[t.jsx("p",{className:"font-medium",children:t.jsx(J,{id:"roster.compliance.tooltipTitle"})}),w.map(K=>
36t.jsx("p",{children:Hs[K.code]?v(Hs[K.code].label):K.code},K.code))]}),e[94]=v,e[95]=w,e[96]=ve):ve=e[96];let Ne;e[97]!==q?(Ne=q&&t.jsx("p",{className:"text-indigo-9 text-xs",children:t.jsx(J,{id:"dayView.shift.tooltip.endsNextDay"})}),e[97]=q,e[98]=Ne):Ne=e[98];let it;e[99]!==qe||e[100]!==st||e[101]!==et||e[102]!==tt||e[103]!==Xe||e[104]!==ve||e[105]!==Ne?(it=t.jsx(ht,{children:t.jsxs("div",{className:"space-y-0.5",children:[qe,st,et,tt,Xe,ve,Ne]})}),e[99]=qe,e[100]=st,e[101]=et,e[102]=tt,e[103]=Xe,e[104]=ve,e[105]=Ne,e[106]=it):it=e[106];let rt;return e[107]!==fe||e[108]!==Re||e[109]!==it?(rt=t.jsxs(fe,{children:[Re,it]}),e[107]=fe,e[108]=Re,e[109]=it,e[110]=rt):rt=e[110],rt}function hl(i){return i.stopPropagation()}function ul(i){return i.stopPropagation()}function pl(i){return i[0]}function yl(i){const e=je.c(21),{roles:s}=i;let o,n,d,a,l,f;if(e[0]!==s){f=Symbol.for("react.early_return_sentinel");e:{const h=s.filter(xl);if(h.length===0){f=null;break e}const p=360/h.length;let y;e[7]!==p?(y=(x,b)=>{const v=b*p,j=(b+1)*p;return`var(--${x.color}-9) ${v}deg ${j}deg`},e[7]=p,e[8]=y):y=e[8];const g=h.map(y).join(", ");n=mt;const u=h.length===1?{backgroundColor:`var(--${h[0].color}-9)`}:{backgroundImage:`conic-gradient(${g})`};e[9]!==u?(l=t.jsx(ft,{asChild:!0,children:t.jsx("span",{className:"border-slate-6/70 inline-flex size-3.5 shrink-0 rounded-full border",style:u})}),e[9]=u,e[10]=l):l=e[10],o=ht,d="space-y-1",a=h.map(gl)}e[0]=s,e[1]=o,e[2]=n,e[3]=d,e[4]=a,e[5]=l,e[6]=f}else o=e[1],n=e[2],d=e[3],a=e[4],l=e[5],f=e[6];if(f!==Symbol.for("react.early_return_sentinel"))return f;let r;e[11]!==d||e[12]!==a?(r=t.jsx("div",{className:d,children:a}),e[11]=d,e[12]=a,e[13]=r):r=e[13];let m;e[14]!==o||e[15]!==r?(m=t.jsx(o,{children:r}),e[14]=o,e[15]=r,e[16]=m):m=e[16];let c;return e[17]!==n||e[18]!==l||e[19]!==m?(c=t.jsxs(n,{children:[l,m]}),e[17]=n,e[18]=l,e[19]=m,e[20]=c):c=e[20],c}function gl(i){return t.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[t.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:`var(--${i.color}-9)`}}),t.jsx("span",{children:i.name})]},i._id)}function xl(i,e,s){return s.findIndex(o=>o._id===i._id)===e}function bl(i){const e=je.c(15),{availabilities:s,viewStartMinutes:o,viewEndMinutes:n,hourWidth:d}=i,{i18n:a}=at(),{formatRange:l}=Wt();let f;if(e[0]!==s||e[1]!==l||e[2]!==d||e[3]!==a||e[4]!==n||e[5]!==o){let m;e[7]!==l||e[8]!==d||e[9]!==a||e[10]!==n||e[11]!==o?(m=c=>{const h=c.kind==="available";let p,y;c.isAllDay?(p=o,y=n):c.startTime&&c.endTime?(p=Ft(c.startTime),y=Ft(c.endTime)):(p=new Date(c.startAt).getHours()*60+new Date(c.startAt).getMinutes(),y=new Date(c.endAt).getHours()*60+new Date(c.endAt).getMinutes()),p=p>o?p:o,y=y<n?y:n;const g=qs(p,o,d),u=(y-p)/60*d;if(u<=0)return null;const x=h?a._({id:"dayView.availability.available"}):a._({id:"dayView.availability.unavailable"}),b=c.isAllDay?a._({id:"dayView.availability.allDay"}):c.startTime&&c.endTime?l(c.startTime,c.endTime," - "):`${c.startTime??""} - ${c.endTime??""}`,v=`${x} · ${b}`;return t.jsx("div",{className:Be("pointer-events-none absolute top-0 flex h-full items-start px-2 py-2",h?"bg-green-9/13 text-green-12":"bg-orange-9/20 text-orange-12"),style:{left:g,width:u},title:v,"aria-label":v,children:u>=96?t.jsx("span",{className:Be("rounded-full border px-2 py-0.5 text-[11px] leading-none font-medium shadow-sm backdrop-blur-sm",h?"border-green-7 bg-green-1/85":"border-orange-7 bg-orange-1/85"),children:x}):null},c._id)},e[7]=l,e[8]=d,e[9]=a,e[10]=n,e[11]=o,e[12]=m):m=e[12],f=s.map(m),e[0]=s,e[1]=l,e[2]=d,e[3]=a,e[4]=n,e[5]=o,e[6]=f}else f=e[6];let r;return e[13]!==f?(r=t.jsx(t.Fragment,{children:f}),e[13]=f,e[14]=r):r=e[14],r}function Sl(i){const e=je.c(13),{absences:s,viewStartMinutes:o,viewEndMinutes:n,hourWidth:d}=i,{i18n:a}=at(),l=gn();if(s.length===0)return null;const f=s[0];let r;e[0]!==f.absenceType||e[1]!==l||e[2]!==a?(r=l(f.absenceType,a._({id:"dayView.absence.fallbackLabel"})),e[0]=f.absenceType,e[1]=l,e[2]=a,e[3]=r):r=e[3];const m=r,c=(n-o)/60*d;let h;e[4]!==c?(h={width:c},e[4]=c,e[5]=h):h=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"absolute inset-0 bg-zinc-500/10"}),e[6]=p):p=e[6];let y;e[7]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Wi,{className:"size-3.5"}),e[7]=y):y=e[7];let g;e[8]!==m?(g=t.jsxs("div",{className:"z-10 flex items-center gap-1.5 rounded-full bg-zinc-100 px-3 py-1 text-xs font-medium text-zinc-600",children:[y,m]}),e[8]=m,e[9]=g):g=e[9];let u;return e[10]!==h||e[11]!==g?(u=t.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-10 flex h-full items-center justify-center",style:h,children:[p,g]}),e[10]=h,e[11]=g,e[12]=u):u=e[12],u}function jl(i){const e=je.c(110),{employee:s,companyRoles:o,employeeShifts:n,allLocationEmployeeShifts:d,employeeAbsence
36s:a,employeeAvailabilities:l,branchNameById:f,hasFullDayAbsence:r,hourSlots:m,canCreateShifts:c,canUpdateShifts:h,hourWidth:p,totalTimelineWidth:y,viewStartMinutes:g,viewEndMinutes:u,onEmployeeClick:x,onTimelineClick:b,onShiftClick:v,onShiftTimeUpdate:j,activeShift:w,selectedDateStr:C,locationBreakdown:D,dailyQuotaHours:_,showShiftBranchName:S,createRoleId:N}=i,B=_===void 0?8:_,A=S===void 0?!1:S,{i18n:R}=at(),F=a.length>0,H=N??s.companyRoles[0]?._id;let M;e[0]!==n?(M=Xi(n),e[0]=n,e[1]=M):M=e[1];const{laneByShiftId:O,laneCount:Q}=M;let $;e[2]!==Q?($=Zi(Q),e[2]=Q,e[3]=$):$=e[3];const E=$;let I;e[4]!==l.length||e[5]!==R?(I=l.length>0?R._({id:"dayView.availability.timelineHint"}):void 0,e[4]=l.length,e[5]=R,e[6]=I):I=e[6];const P=I;let G;e[7]!==s._id||e[8]!==C?(G={assignedEmployeeId:s._id,date:C},e[7]=s._id,e[8]=C,e[9]=G):G=e[9];const k=G,T=`day-view-employee-drop-${s._id}-${C}`;let W;e[10]!==k||e[11]!==T?(W={id:T,data:k},e[10]=k,e[11]=T,e[12]=W):W=e[12];const{isOver:L,setNodeRef:q}=ms(W),Z=d.reduce(wl,0),ne=Z-B;let Y;e[13]!==E?(Y={height:E},e[13]=E,e[14]=Y):Y=e[14];const ae=s._id;let le;e[15]===Symbol.for("react.memo_cache_sentinel")?(le={width:Xt},e[15]=le):le=e[15];let U;e[16]!==s._id||e[17]!==x?(U=()=>x(s._id),e[16]=s._id,e[17]=x,e[18]=U):U=e[18];let te;e[19]!==s.name||e[20]!==R?(te=R._({id:"dayView.employee.openAria",message:"Open employee {name}",values:{name:s.name}}),e[19]=s.name,e[20]=R,e[21]=te):te=e[21];let se;e[22]!==s.name?(se=t.jsx("span",{className:"truncate text-sm font-medium",children:s.name}),e[22]=s.name,e[23]=se):se=e[23];let oe;e[24]!==s.companyRoles?(oe=t.jsx(yl,{roles:s.companyRoles}),e[24]=s.companyRoles,e[25]=oe):oe=e[25];let be;e[26]!==se||e[27]!==oe?(be=t.jsxs("div",{className:"flex items-center gap-1.5",children:[se,oe]}),e[26]=se,e[27]=oe,e[28]=be):be=e[28];let ie;e[29]!==ne||e[30]!==B||e[31]!==Z||e[32]!==D?(ie=t.jsx(Bn,{period:"day",className:"mt-2",scheduledHours:Z,quotaHours:B,delta:ne,locationBreakdown:D}),e[29]=ne,e[30]=B,e[31]=Z,e[32]=D,e[33]=ie):ie=e[33];let fe;e[34]!==U||e[35]!==te||e[36]!==be||e[37]!==ie?(fe=t.jsxs("button",{type:"button",className:"border-border bg-slate-1 sticky left-0 z-10 flex shrink-0 cursor-pointer flex-col justify-center border-0 border-r px-2 text-left",style:le,onClick:U,"aria-label":te,children:[be,ie]}),e[34]=U,e[35]=te,e[36]=be,e[37]=ie,e[38]=fe):fe=e[38];const he=c&&!F&&"cursor-pointer",Ie=L&&"ring-blue-9/40 ring-2 ring-inset";let de;e[39]!==he||e[40]!==Ie?(de=Be("relative transition-shadow",he,Ie),e[39]=he,e[40]=Ie,e[41]=de):de=e[41];let re;e[42]!==y?(re={width:y},e[42]=y,e[43]=re):re=e[43];let Se;e[44]!==H||e[45]!==s._id||e[46]!==b?(Se=me=>{me.target.closest("button")||b(me,s._id,H)},e[44]=H,e[45]=s._id,e[46]=b,e[47]=Se):Se=e[47];let X;if(e[48]!==m||e[49]!==p){let me;e[51]!==p?(me=(_e,pe)=>t.jsx("div",{className:"border-border absolute top-0 h-full border-r",style:{left:pe*p,width:p},children:t.jsx("div",{className:"border-border/50 absolute top-0 h-full border-r border-dashed",style:{left:p/2}})},_e),e[51]=p,e[52]=me):me=e[52],X=m.map(me),e[48]=m,e[49]=p,e[50]=X}else X=e[50];let ge;e[53]!==l||e[54]!==p||e[55]!==u||e[56]!==g?(ge=t.jsx(bl,{availabilities:l,viewStartMinutes:g,viewEndMinutes:u,hourWidth:p}),e[53]=l,e[54]=p,e[55]=u,e[56]=g,e[57]=ge):ge=e[57];let ce;e[58]!==a||e[59]!==r||e[60]!==p||e[61]!==u||e[62]!==g?(ce=r&&t.jsx(Sl,{absences:a,viewStartMinutes:g,viewEndMinutes:u,hourWidth:p}),e[58]=a,e[59]=r,e[60]=p,e[61]=u,e[62]=g,e[63]=ce):ce=e[63];let Ce;if(e[64]!==w||e[65]!==f||e[66]!==h||e[67]!==o||e[68]!==l||e[69]!==n||e[70]!==F||e[71]!==p||e[72]!==O||e[73]!==Q||e[74]!==v||e[75]!==j||e[76]!==A||e[77]!==u||e[78]!==g){let me;e[80]!==w||e[81]!==f||e[82]!==h||e[83]!==o||e[84]!==l||e[85]!==F||e[86]!==p||e[87]!==O||e[88]!==Q||e[89]!==v||e[90]!==j||e[91]!==A||e[92]!==u||e[93]!==g?(me=_e=>{const pe=l.filter(vl),Me=Xs(_e,pe),Pe=yt(_e),ze=O.get(Pe)??0,He=Ji(ze,Q);return t.jsx(to,{shift:_e,companyRoles:o,viewStartMinutes:g,viewEndMinutes:u,hourWidth:p,dragId:`${Pe}-day-view`,isDragGhost:w?yt(w)===Pe:!1,canManageShiftTime:h,top:He,onClick:()=>v(_e),onResize:(Ue,Ge)=>{const Le=An({startTime:_e.startTime,endTime:_e.endTime,edge:Ue,deltaMinutes:Ge});Le.startTime===_e.startTime&&Le.endTime===_e.endTime||j({shift:_e,startTime:Le.startTime,endTime:Le.endTime})},hasAbsenceConflict:F,hasAvailabilityConflict:Me,branchName:A?f[_e.branchId]:void 0},Pe)},e[80]=w,e[81]=f,e[82]=h,e[83]=o,e[84]=l,e[85]=F,e[86]=p,e[87]=O,e[88]=Q,e[89]=v,e[90]=j,e[91]=A,e[92]=u,e[93]=g,e[94]=me):me=e[94],Ce=n.map(me),e[64]=w,e[65]=f,e[66]=h,e[67]=o,e[68]=l,e[69]=n,e[70]=F,e[71]=p,e[72]=O,e[73]=Q,e[74]=v,e[75]=j,e[76]=A,e[77]=u,e[78]=g,e[79]=Ce}else Ce=e[79];let Ee;e[95]!==P||e[96]!==q||e[97]!==de||e[98]!==re||e[99]!==Se||e[100]!==X||e[101]!==ge||e[102]!==ce||e[103]!==Ce?(Ee=t.jsxs("div",{ref:q,className:de,style:re,title:P,onClick:Se,children:[X,ge,ce,Ce]}),e[95]=P,e[96]=q,e[97]=de,e[98]=re,e[99]=Se,e[100]=X,e[101]=ge,e[102]=ce,e[103]=Ce,e[104]=Ee):Ee=e[104];let ue;return e[105]!==s._id||e[106]!==fe||e[107]!==Ee||e[108]!==Y?(ue=t.jsxs("div",{className:"border-border flex border-b",style:Y,children:[fe,Ee]},ae),e[105]=s._id,e[106]=fe,e[107]=Ee,e[108]=Y,e[109]=ue):ue=e[109],ue}function vl(i){return i.kind==="unavailable"}function wl(i,e){return i+(e.workedMinutes??0)/60}function ni(i){const e=je.c(91),{selectedDate:s,selectedDateStr:o,companyRoles:n,openShifts:d,hourSlots:a,hourWidth:l,totalTimelineWidth:f,viewStartMinutes:r,viewEndMinutes:m,canCreateOpenShifts:c,canManageShiftTime:h,activeShift:p,onTimelineClick:y,onShiftClick:g,onShiftTimeUpdate:u}=i,{i18n:x}=at();let b;e[0]!==d?(b=Xi(d),e[0]=d,e[1]=b):b=e[1];const{laneByShiftId:v,laneCount:j}=b;let w;e[2]!==j?(w=Zi(j),e[2]=j,e[3]=w):w=e[3];const C=w;let D;e[4]!==o?(D={assignedEmployeeId:void 0,date:o},e[4]=o,e[5]=D):D=e[5];const _=D,S=`day-view-open-shifts-drop-${o}`;let N;e[6]!==_||e[7]!==S?(N={id:S,data:_},e[6]=_,e[7]=S,e[8]=N):N=e[8];const{isOver:B,setNodeRef:A}=ms(N);let R;e[9]!==x?(R=x._({id:"openShifts.manager.tooltip",message:"Open shifts are unassigned shifts made available to eligible employees. Depending on your organization's settings, employees either take them instantly or apply for approval."}),e[9]=x,e[10]=R):R=e[10];const F=R;let H;e[11]!==x?(H=x._({id:"openShifts.whatAria"}),e[11]=x,e[12]=H):H=e[12];const M=H;let O;e[13]!==C?(O={height:C},e[13]=C,e[14]=O):O=e[14];let Q;e[15]===Symbol.for("react.memo_cache_sentinel")?(Q={width:Xt},e[15]=Q):Q=e[15];let $;e[16]!==x?($=x._({id:"openShifts.rowTitle"}),e[16]=x,e[17]=$):$=e[17];let E;e[18]!==$?(E=t.jsx("span",{className:"truncate text-sm font-medium",children:$}),e[18]=$,e[19]=E):E=e[19];let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(Ni,{className:"size-3.5"}),e[20]=I):I=e[20];let P;e[21]!==M?(P=t.jsx(ft,{asChild:!0,children:t.jsx(bt,{type:"button",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground size-6 shrink-0 rounded-full","aria-label":M,children:I})}),e[21]=M,e[22]=P):P=e[22];let G;e[23]!==F?(G=t.jsx(ht,{className:"max-w-64 leading-relaxed",children:F}),e[23]=F,e[24]=G):G=e[24];let k;e[25]!==P||e[26]!==G?(k=t.jsxs(mt,{children:[P,G]}),e[25]=P,e[26]=G,e[27]=k):k=e[27];let T;e[28]!==E||e[29]!==k?(T=t.jsxs("div",{className:"flex items-center gap-1.5",children:[E,k]}),e[28]=E,e[29]=k,e[30]=T):T=e[30];let W;e[31]!==c||e[32]!==x||e[33]!==d.length?(W=c?d.length>0?x._({id:"openShifts.manager.countUnassigned",message:"{count, plural, one {# unassigned shift} other {# unassigned shifts}}",values:{count:d.length}}):x._({id:"openShifts.manager.clickToAdd",message:"Click a day to add one"}):x._({id:"openShifts.employee.shiftsAvailable",message:"{count, plural, one {# shift available} other {# shifts available}}",values:{count:d.length}}),e[31]=c,e[32]=x,e[33]=d.length,e[34]=W):W=e[34];let L;e[35]!==W?(L=t.jsx("span",{className:"text-muted-foreground mt-2 text-xs",children:W}),e[35]=W,e[36]=L):L=e[36];let q;e[37]!==T||e[38]!==L?(q=t.jsxs("div",{className:"border-border bg-slate-1 sticky left-0 z-10 flex shrink-0 flex-col justify-center border-r px-2 text-left",style:Q,children:[T,
36L]}),e[37]=T,e[38]=L,e[39]=q):q=e[39];const Z=c&&"cursor-pointer",ne=B&&"ring-blue-9/40 ring-2 ring-inset";let Y;e[40]!==Z||e[41]!==ne?(Y=Be("relative transition-shadow",Z,ne),e[40]=Z,e[41]=ne,e[42]=Y):Y=e[42];let ae;e[43]!==f?(ae={width:f},e[43]=f,e[44]=ae):ae=e[44];let le;e[45]!==c||e[46]!==y?(le=ie=>{ie.target.closest("button")||c&&y(ie)},e[45]=c,e[46]=y,e[47]=le):le=e[47];let U;e[48]!==x||e[49]!==s?(U=x._({id:"dayView.openShifts.rowAria",message:"Open shifts for {date}",values:{date:s.toLocaleDateString()}}),e[48]=x,e[49]=s,e[50]=U):U=e[50];let te;if(e[51]!==a||e[52]!==l){let ie;e[54]!==l?(ie=(fe,he)=>t.jsx("div",{className:"border-border absolute top-0 h-full border-r",style:{left:he*l,width:l},children:t.jsx("div",{className:"border-border/50 absolute top-0 h-full border-r border-dashed",style:{left:l/2}})},fe),e[54]=l,e[55]=ie):ie=e[55],te=a.map(ie),e[51]=a,e[52]=l,e[53]=te}else te=e[53];let se;if(e[56]!==p||e[57]!==h||e[58]!==n||e[59]!==l||e[60]!==v||e[61]!==j||e[62]!==g||e[63]!==u||e[64]!==d||e[65]!==m||e[66]!==r){let ie;e[68]!==p||e[69]!==h||e[70]!==n||e[71]!==l||e[72]!==v||e[73]!==j||e[74]!==g||e[75]!==u||e[76]!==m||e[77]!==r?(ie=fe=>{const he=yt(fe),Ie=v.get(he)??0,de=Ji(Ie,j);return t.jsx(to,{shift:fe,companyRoles:n,viewStartMinutes:r,viewEndMinutes:m,hourWidth:l,dragId:`${he}-day-view-open-shift`,isDragGhost:p?yt(p)===he:!1,canManageShiftTime:h,top:de,onClick:()=>g(fe),onResize:(re,Se)=>{const X=An({startTime:fe.startTime,endTime:fe.endTime,edge:re,deltaMinutes:Se});u({shift:fe,startTime:X.startTime,endTime:X.endTime})},hasAbsenceConflict:!1,hasAvailabilityConflict:!1},he)},e[68]=p,e[69]=h,e[70]=n,e[71]=l,e[72]=v,e[73]=j,e[74]=g,e[75]=u,e[76]=m,e[77]=r,e[78]=ie):ie=e[78],se=d.map(ie),e[56]=p,e[57]=h,e[58]=n,e[59]=l,e[60]=v,e[61]=j,e[62]=g,e[63]=u,e[64]=d,e[65]=m,e[66]=r,e[67]=se}else se=e[67];let oe;e[79]!==A||e[80]!==Y||e[81]!==ae||e[82]!==le||e[83]!==U||e[84]!==te||e[85]!==se?(oe=t.jsxs("div",{ref:A,className:Y,style:ae,onClick:le,"aria-label":U,children:[te,se]}),e[79]=A,e[80]=Y,e[81]=ae,e[82]=le,e[83]=U,e[84]=te,e[85]=se,e[86]=oe):oe=e[86];let be;return e[87]!==q||e[88]!==oe||e[89]!==O?(be=t.jsxs("div",{className:"border-border flex border-b",style:O,children:[q,oe]}),e[87]=q,e[88]=oe,e[89]=O,e[90]=be):be=e[90],be}function _l(i){const e=je.c(20),{hourSlots:s,hourWidth:o,searchTerm:n,setSearchTerm:d,searchPlaceholder:a}=i,{timeFormat:l}=Wt();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={width:Xt},e[0]=f):f=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(vn,{align:"inline-start",children:t.jsx(xn,{})}),e[1]=r):r=e[1];let m;e[2]!==d?(m=g=>d(g.target.value),e[2]=d,e[3]=m):m=e[3];let c;e[4]!==a||e[5]!==n||e[6]!==m?(c=t.jsx("div",{className:"border-border bg-background sticky left-0 z-30 flex shrink-0 items-center border-r p-1",style:f,children:t.jsxs(wn,{children:[r,t.jsx(_n,{type:"search",placeholder:a,value:n,onChange:m,className:"print:hidden"})]})}),e[4]=a,e[5]=n,e[6]=m,e[7]=c):c=e[7];let h;if(e[8]!==s||e[9]!==o||e[10]!==l){let g;e[12]!==o||e[13]!==l?(g=u=>t.jsx("div",{className:"border-border flex items-center justify-start border-r px-2 text-xs font-medium text-zinc-500",style:{width:o,height:40},children:eo(u,l)},u),e[12]=o,e[13]=l,e[14]=g):g=e[14],h=s.map(g),e[8]=s,e[9]=o,e[10]=l,e[11]=h}else h=e[11];let p;e[15]!==h?(p=t.jsx("div",{className:"flex",children:h}),e[15]=h,e[16]=p):p=e[16];let y;return e[17]!==c||e[18]!==p?(y=t.jsxs("div",{className:"bg-background sticky top-0 z-20 flex border-b border-zinc-200",children:[c,p]}),e[17]=c,e[18]=p,e[19]=y):y=e[19],y}const kl=16;function Cl(i){const e=je.c(204),{selectedDate:s,canSeePublishedRoster:o,companyRoles:n,filteredEmployees:d,flatShifts:a,allLocationFlatShifts:l,managerOpenShifts:f,employeeOpenShifts:r,flatAbsences:m,flatAvailabilities:c,hideEmptyRows:h,isLoadingShifts:p,onToggleHideEmptyRows:y,onEmployeeClick:g,onCreateShiftClick:u,onCreateOpenShiftClick:x,onShiftClick:b,onEmployeeOpenShiftClick:v,onShiftTimeUpdate:j,activeShift:w,searchTerm:C,setSearchTerm:D,viewStartTime:_,viewEndTime:S,autoScrollToCurrentTime:N,branches:B,selectedBranchId:A,groupByRole:R,roleFilterIds:F}=i,H=N===void 0?!0:N,{i18n:M}=at(),O=bn();let Q;e[0]!==O?(Q=O.check("shifts","create"),e[0]=O,e[1]=Q):Q=e[1];const $=Q;let E;e[2]!==O?(E=O.check("shifts","update"),e[2]=O,e[3]=E):E=e[3];const I=E,P=ee.useRef(null),G=ee.useRef(null),[k,T]=ee.useState(0);let W;e[4]===Symbol.for("react.memo_cache_sentinel")?(W=new Set,e[4]=W):W=e[4];const[L,q]=ee.useState(W);let Z;e[5]===Symbol.for("react.memo_cache_sentinel")?(Z=z=>{q(xe=>{const ye=new Set(xe);return ye.has(z)?ye.delete(z):ye.add(z),ye})},e[5]=Z):Z=e[5];const ne=Z,Y=Ft(_),ae=Ft(S);let le;e[6]!==s?(le=Io(s,"yyyy-MM-dd"),e[6]=s,e[7]=le):le=e[7];const U=le;let te;if(e[8]!==a||e[9]!==U){let z;e[11]!==U?(z=xe=>xe.date===U,e[11]=U,e[12]=z):z=e[12],te=a.filter(z),e[8]=a,e[9]=U,e[10]=te}else te=e[10];const se=te;let oe;if(e[13]!==l||e[14]!==U){let z;e[16]!==U?(z=xe=>xe.date===U,e[16]=U,e[17]=z):z=e[17],oe=l.filter(z),e[13]=l,e[14]=U,e[15]=oe}else oe=e[15];const be=oe;let ie;e[18]!==m||e[19]!==s?(ie={},m.forEach(z=>{const xe=new Date(z.startAt),ye=new Date(z.endAt),Fe=new Date(s);Fe.setHours(0,0,0,0);const lt=new Date(s);lt.setHours(23,59,59,999),xe<=lt&&ye>=Fe&&(ie[z.employeeId]||(ie[z.employeeId]=[]),ie[z.employeeId].push(z))}),e[18]=m,e[19]=s,e[20]=ie):ie=e[20];const fe=ie;let he;if(e[21]!==d||e[22]!==c||e[23]!==s){const z=Hi({employees:d,flatAvailabilities:c,startDate:s,dayCount:1});he=Object.fromEntries(Object.entries(z).map(Rl)),e[21]=d,e[22]=c,e[23]=s,e[24]=he}else he=e[24];const Ie=he;let de;e[25]!==s?(de=new Date(s),de.setHours(0,0,0,0),e[25]=s,e[26]=de):de=e[26];let re;e[27]!==s?(re=new Date(s),re.setHours(23,59,59,999),e[27]=s,e[28]=re):re=e[28];let Se;e[29]!==fe||e[30]!==re||e[31]!==de?(Se={},Object.entries(fe).forEach(z=>{const[xe,ye]=z;Se[xe]=ye.some(Fe=>{const lt=new Date(Fe.startAt),ct=new Date(Fe.endAt);return lt<=de&&ct>=re})}),e[29]=fe,e[30]=re,e[31]=de,e[32]=Se):Se=e[32];const X=Se;let ge;e[33]!==se?(ge={},se.forEach(z=>{z.assignedEmployeeId&&(ge[z.assignedEmployeeId]||(ge[z.assignedEmployeeId]=[]),ge[z.assignedEmployeeId].push(z))}),e[33]=se,e[34]=ge):ge=e[34];const ce=ge;let Ce;e[35]!==be?(Ce={},be.forEach(z=>{z.assignedEmployeeId&&(Ce[z.assignedEmployeeId]||(Ce[z.assignedEmployeeId]=[]),Ce[z.assignedEmployeeId].push(z))}),e[35]=be,e[36]=Ce):Ce=e[36];const Ee=Ce;let ue;e[37]!==B?(ue=Object.fromEntries(B.map(El)),e[37]=B,e[38]=ue):ue=e[38];const me=ue;let _e;
36e[39]!==d||e[40]!==U?(_e=Ye(De.employeeContracts.listDailyQuotaMinutes,{employeeIds:d.map(Ml),atDate:U}),e[39]=d,e[40]=U,e[41]=_e):_e=e[41];const pe=d.length>0;let Me;e[42]===Symbol.for("react.memo_cache_sentinel")?(Me={},e[42]=Me):Me=e[42];let Pe;e[43]!==_e||e[44]!==pe?(Pe={..._e,enabled:pe,placeholderData:Me},e[43]=_e,e[44]=pe,e[45]=Pe):Pe=e[45];const ze=ut(Pe);let He;e[46]!==ze.data?(He=Object.fromEntries(Object.entries(ze.data??{}).map(Nl)),e[46]=ze.data,e[47]=He):He=e[47];const Ue=He,Ge=!A&&B.length>1;let Le;e[48]!==r?(Le=r.map(jn),e[48]=r,e[49]=Le):Le=e[49];const Ke=Le,Re=$,qe=!$&&Ke.length>0,st=Re||qe;let Ve;if(e[50]!==ae||e[51]!==Y){Ve=[];const z=Math.floor(Y/60),xe=Math.ceil(ae/60);for(let ye=z;ye<xe;ye++)Ve.push(ye);e[50]=ae,e[51]=Y,e[52]=Ve}else Ve=e[52];const we=Ve;let et;e[53]===Symbol.for("react.memo_cache_sentinel")?(et=()=>{const z=P.current;if(!z)return;const xe=z.getBoundingClientRect(),ye=document.documentElement.clientWidth,Fe=Math.max(0,ye-Math.max(0,xe.left)),lt=Math.min(z.clientWidth,Fe);T(ct=>Math.abs(ct-lt)>1?lt:ct)},e[53]=et):et=e[53];const tt=et;let Xe;e:{if(we.length===0){Xe=ks;break e}const z=Math.max(0,k-Xt-kl);if(z===0){Xe=ks;break e}const xe=z/we.length;Xe=Math.max(ks,xe)}const ve=Xe;let Ne;if(e[54]!==se||e[55]!==we||e[56]!==ae){const z=new Map,xe=new Map;we.forEach(ye=>{z.set(ye,new Set),xe.set(ye,new Map)}),se.forEach(ye=>{const Fe=ye.assignedEmployeeId;if(!Fe)return;const lt=Ft(ye.startTime);let ct=Ft(ye.endTime);Ks({startTime:ye.startTime,endTime:ye.endTime})&&(ct=ae),we.forEach(It=>{const Ht=It*60,Ut=(It+1)*60;if(lt<Ut&&ct>Ht){z.get(It)?.add(Fe);const ot=ye.companyRoleId??"unknown",Gt=xe.get(It);if(!Gt)return;Gt.has(ot)||Gt.set(ot,new Set),Gt.get(ot)?.add(Fe)}})}),Ne=new Map,we.forEach(ye=>{const Fe=xe.get(ye)??new Map,lt=new Map;Fe.forEach((ct,It)=>{lt.set(It,ct.size)}),Ne.set(ye,{total:z.get(ye)?.size??0,byRole:lt})}),e[54]=se,e[55]=we,e[56]=ae,e[57]=Ne}else Ne=e[57];const it=Ne;let rt;if(e[58]!==d||e[59]!==h||e[60]!==ce){let z;e[62]!==h||e[63]!==ce?(z=xe=>!(!xe.isVisibleInRoster||h&&!((ce[xe._id]?.length??0)>0)),e[62]=h,e[63]=ce,e[64]=z):z=e[64],rt=d.filter(z),e[58]=d,e[59]=h,e[60]=ce,e[61]=rt}else rt=e[61];const K=rt;let Te;e:{if(!h){Te=0;break e}let z;if(e[65]!==d||e[66]!==ce){let xe;e[68]!==ce?(xe=ye=>ye.isVisibleInRoster?(ce[ye._id]?.length??0)===0:!1,e[68]=ce,e[69]=xe):xe=e[69],z=d.filter(xe),e[65]=d,e[66]=ce,e[67]=z}else z=e[67];Te=z.length}const $e=Te;let ke,Qe;e[70]!==H||e[71]!==ve||e[72]!==s||e[73]!==Y?(ke=()=>{if(!G.current||!Tn(s)||!H)return;const z=new Date,xe=z.getHours()*60+z.getMinutes(),ye=qs(xe,Y,ve)-ve*5;G.current.scrollLeft=Math.max(0,ye)},Qe=[H,ve,s,Y],e[70]=H,e[71]=ve,e[72]=s,e[73]=Y,e[74]=ke,e[75]=Qe):(ke=e[74],Qe=e[75]),ee.useEffect(ke,Qe);let nt,gt;e[76]===Symbol.for("react.memo_cache_sentinel")?(nt=()=>{const z=P.current;if(!z)return;tt();const xe=()=>{tt()},ye=new ResizeObserver(xe);return ye.observe(z),window.addEventListener("resize",xe),()=>{ye.disconnect(),window.removeEventListener("resize",xe)}},gt=[tt],e[76]=nt,e[77]=gt):(nt=e[76],gt=e[77]),ee.useEffect(nt,gt);let Ze;e[78]===Symbol.for("react.memo_cache_sentinel")?(Ze=()=>{tt()},e[78]=Ze):Ze=e[78];let xt;e[79]!==we.length||e[80]!==S||e[81]!==_?(xt=[we.length,tt,S,_],e[79]=we.length,e[80]=S,e[81]=_,e[82]=xt):xt=e[82],ee.useEffect(Ze,xt);const pt=we.length*ve;let Ot;e[83]!==$||e[84]!==ve||e[85]!==u||e[86]!==s||e[87]!==Y?(Ot=(z,xe,ye)=>{if(!$||!ye)return;const Fe=ti({event:z,hourWidth:ve,viewStartMinutes:Y});u({employeeId:xe,companyRoleId:ye,date:s,startTime:Fe})},e[83]=$,e[84]=ve,e[85]=u,e[86]=s,e[87]=Y,e[88]=Ot):Ot=e[88];const Mt=Ot;let Pt;e[89]!==w||e[90]!==Ee||e[91]!==me||e[92]!==$||e[93]!==I||e[94]!==n||e[95]!==fe||e[96]!==Ie||e[97]!==Ue||e[98]!==Mt||e[99]!==X||e[100]!==we||e[101]!==ve||e[102]!==g||e[103]!==b||e[104]!==j||e[105]!==A||e[106]!==U||e[107]!==ce||e[108]!==Ge||e[109]!==pt||e[110]!==ae||e[111]!==Y?(Pt=(z,xe)=>t.jsx(jl,{employee:z,companyRoles:n,createRoleId:xe,employeeShifts:xe?(ce[z._id]??[]).filter(ye=>ye.companyRoleId===xe):ce[z._id]??[],allLocationEmployeeShifts:Ee[z._id]??[],employeeAbsence
36s:fe[z._id]??[],employeeAvailabilities:Ie[z._id]??[],branchNameById:me,hasFullDayAbsence:X[z._id]??!1,hourSlots:we,canCreateShifts:$,totalTimelineWidth:pt,hourWidth:ve,viewStartMinutes:Y,viewEndMinutes:ae,onEmployeeClick:g,onTimelineClick:Mt,onShiftClick:b,onShiftTimeUpdate:j,activeShift:w,selectedDateStr:U,canUpdateShifts:I,locationBreakdown:Mn({allShifts:Ee[z._id]??[],visibleShifts:ce[z._id]??[],branchNameById:me,selectedBranchId:A}),dailyQuotaHours:Ue[z._id],showShiftBranchName:Ge},xe?`${xe}-${z._id}`:z._id),e[89]=w,e[90]=Ee,e[91]=me,e[92]=$,e[93]=I,e[94]=n,e[95]=fe,e[96]=Ie,e[97]=Ue,e[98]=Mt,e[99]=X,e[100]=we,e[101]=ve,e[102]=g,e[103]=b,e[104]=j,e[105]=A,e[106]=U,e[107]=ce,e[108]=Ge,e[109]=pt,e[110]=ae,e[111]=Y,e[112]=Pt):Pt=e[112];const Tt=Pt;if(p){let z;return e[113]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx("div",{className:"space-y-0",children:Array.from({length:6}).map(Tl)}),e[113]=z):z=e[113],z}if(!o){let z;e[114]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx($s,{children:t.jsx(Oi,{className:"size-10"})}),e[114]=z):z=e[114];let xe;e[115]===Symbol.for("react.memo_cache_sentinel")?(xe=t.jsx(Os,{children:t.jsx(J,{id:"dayView.empty.notPublishedTitle"})}),e[115]=xe):xe=e[115];let ye;return e[116]===Symbol.for("react.memo_cache_sentinel")?(ye=t.jsx(Ps,{className:"flex-center mx-auto min-h-[50vh] max-w-md",children:t.jsxs(Ls,{children:[z,xe,t.jsx(Fs,{children:t.jsx(J,{id:"dayView.empty.notPublishedDescription"})})]})}),e[116]=ye):ye=e[116],ye}if(h&&K.length===0&&!st){let z;e[117]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx($s,{children:t.jsx(fs,{className:"size-10"})}),e[117]=z):z=e[117];let xe;e[118]===Symbol.for("react.memo_cache_sentinel")?(xe=t.jsx(Os,{children:t.jsx(J,{id:"dayView.empty.noEmployeesTitle"})}),e[118]=xe):xe=e[118];let ye;e[119]===Symbol.for("react.memo_cache_sentinel")?(ye=t.jsxs(Ls,{children:[z,xe,t.jsx(Fs,{children:t.jsx(J,{id:"dayView.empty.noEmployeesDescription"})})]}),e[119]=ye):ye=e[119];let Fe,lt;e[120]===Symbol.for("react.memo_cache_sentinel")?(Fe=t.jsx(fs,{className:"size-4"}),lt=t.jsx(J,{id:"dayView.empty.showEmptyRows"}),e[120]=Fe,e[121]=lt):(Fe=e[120],lt=e[121]);let ct;return e[122]!==y?(ct=t.jsxs(Ps,{className:"flex-center mx-auto min-h-[50vh] max-w-md",children:[ye,t.jsx(Di,{children:t.jsxs(bt,{variant:"outline",onClick:y,children:[Fe,lt]})})]}),e[122]=y,e[123]=ct):ct=e[123],ct}const Lt=Xt+pt;let _t;e[124]!==Lt?(_t={minWidth:Lt},e[124]=Lt,e[125]=_t):_t=e[125];let Et;e[126]!==M?(Et=M._({id:"dayView.searchEmployees"}),e[126]=M,e[127]=Et):Et=e[127];let kt;e[128]!==we||e[129]!==ve||e[130]!==C||e[131]!==D||e[132]!==Et?(kt=t.jsx(_l,{hourSlots:we,hourWidth:ve,searchTerm:C,setSearchTerm:D,searchPlaceholder:Et}),e[128]=we,e[129]=ve,e[130]=C,e[131]=D,e[132]=Et,e[133]=kt):kt=e[133];let Rt;e[134]!==n||e[135]!==we||e[136]!==ve||e[137]!==it?(Rt=t.jsx(el,{hourSlots:we,hourWidth:ve,shiftsByHour:it,companyRoles:n}),e[134]=n,e[135]=we,e[136]=ve,e[137]=it,e[138]=Rt):Rt=e[138];let At;e[139]!==ve||e[140]!==s||e[141]!==ae||e[142]!==Y?(At=t.jsx(sl,{viewStartMinutes:Y,viewEndMinutes:ae,hourWidth:ve,selectedDate:s}),e[139]=ve,e[140]=s,e[141]=ae,e[142]=Y,e[143]=At):At=e[143];let Ct;e[144]!==w||e[145]!==$||e[146]!==I||e[147]!==n||e[148]!==we||e[149]!==ve||e[150]!==f||e[151]!==x||e[152]!==b||e[153]!==j||e[154]!==s||e[155]!==U||e[156]!==Re||e[157]!==pt||e[158]!==ae||e[159]!==Y?(Ct=Re?t.jsx(ni,{selectedDate:s,selectedDateStr:U,companyRoles:n,openShifts:f,hourSlots:we,hourWidth:ve,totalTimelineWidth:pt,viewStartMinutes:Y,viewEndMinutes:ae,canCreateOpenShifts:$,canManageShiftTime:I,activeShift:w,onTimelineClick:z=>{x({date:s,startTime:ti({event:z,hourWidth:ve,viewStartMinutes:Y})})},onShiftClick:b,onShiftTimeUpdate:j}):null,e[144]=w,e[145]=$,e[146]=I,e[147]=n,e[148]=we,e[149]=ve,e[150]=f,e[151]=x,e[152]=b,e[153]=j,e[154]=s,e[155]=U,e[156]=Re,e[157]=pt,e[158]=ae,e[159]=Y,e[160]=Ct):Ct=e[160];let Bt;e[161]!==w||e[162]!==n||e[163]!==Ke||e[164]!==r||e[165]!==we||e[166]!==ve||e[167]!==v||e[168]!==s||e[169]!==U||e[170]!==qe||e[171]!==pt||e[172]!==ae||e[173]!==Y?(Bt=qe?t.jsx(ni,{selectedDate:s,selectedDateStr:U,
36companyRoles:n,openShifts:Ke,hourSlots:we,hourWidth:ve,totalTimelineWidth:pt,viewStartMinutes:Y,viewEndMinutes:ae,canCreateOpenShifts:!1,canManageShiftTime:!1,activeShift:w,onTimelineClick:Il,onShiftClick:z=>{const xe=yt(z),ye=r.find(Fe=>(Fe.shiftId??`open-shift:${Fe.shiftKey}`)===xe);ye&&v(ye)},onShiftTimeUpdate:Dl}):null,e[161]=w,e[162]=n,e[163]=Ke,e[164]=r,e[165]=we,e[166]=ve,e[167]=v,e[168]=s,e[169]=U,e[170]=qe,e[171]=pt,e[172]=ae,e[173]=Y,e[174]=Bt):Bt=e[174];let $t;e[175]!==L||e[176]!==n||e[177]!==d||e[178]!==R||e[179]!==h||e[180]!==Tt||e[181]!==F||e[182]!==ce||e[183]!==K?($t=R?n.map(z=>{if(F.size>0&&!F.has(z._id))return null;const xe=d.filter(Fe=>!(!Fe.isVisibleInRoster||!Fe.companyRoles.some(lt=>lt._id===z._id)||h&&!(ce[Fe._id]??[]).some(ct=>ct.companyRoleId===z._id)));if(xe.length===0)return null;const ye=L.has(z._id);return t.jsxs("div",{children:[t.jsx(En,{color:z.color,name:z.name,count:xe.length,open:!ye,onToggle:()=>ne(z._id),stickyLabelWidth:Xt,className:"border-border border-b"}),!ye&&xe.map(Fe=>Tt(Fe,z._id))]},z._id)}):K.map(z=>Tt(z)),e[175]=L,e[176]=n,e[177]=d,e[178]=R,e[179]=h,e[180]=Tt,e[181]=F,e[182]=ce,e[183]=K,e[184]=$t):$t=e[184];let vt;e[185]!==At||e[186]!==Ct||e[187]!==Bt||e[188]!==$t?(vt=t.jsxs("div",{className:"relative",children:[At,Ct,Bt,$t]}),e[185]=At,e[186]=Ct,e[187]=Bt,e[188]=$t,e[189]=vt):vt=e[189];let Nt;e[190]!==_t||e[191]!==kt||e[192]!==Rt||e[193]!==vt?(Nt=t.jsx("div",{className:"min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-auto pr-4 print:overflow-visible",ref:G,children:t.jsxs("div",{style:_t,children:[kt,Rt,vt]})}),e[190]=_t,e[191]=kt,e[192]=Rt,e[193]=vt,e[194]=Nt):Nt=e[194];let wt;e[195]!==$e||e[196]!==h||e[197]!==y||e[198]!==st||e[199]!==K?(wt=h&&$e>0&&(K.length>0||st)&&t.jsx(Rn,{count:$e,onShowAll:y}),e[195]=$e,e[196]=h,e[197]=y,e[198]=st,e[199]=K,e[200]=wt):wt=e[200];let Dt;return e[201]!==Nt||e[202]!==wt?(Dt=t.jsxs("div",{className:"flex min-h-0 w-full max-w-full min-w-0 flex-1 flex-col overflow-hidden",ref:P,children:[Nt,wt]}),e[201]=Nt,e[202]=wt,e[203]=Dt):Dt=e[203],Dt}function Dl(){}function Il(){}function Tl(i,e){return t.jsxs("div",{className:"border-border flex border-b",style:{height:Ys},children:[t.jsxs("div",{className:"flex shrink-0 flex-col gap-1 p-2",style:{width:Xt},children:[t.jsx(rs,{className:"h-4 w-24"}),t.jsx(rs,{className:"h-3 w-16"})]}),t.jsx("div",{className:"grow p-2",children:t.jsx(rs,{className:"h-9 w-48"})})]},e)}function Nl(i){const[e,s]=i;return[e,s/60]}function Ml(i){return i._id}function El(i){return[i._id,i.name]}function Rl(i){const[e,s]=i;return[e,s[0]??[]]}const so=ee.createContext(null);function Al(i){const e=je.c(3),{value:s,children:o}=i;let n;return e[0]!==o||e[1]!==s?(n=t.jsx(so.Provider,{value:s,children:o}),e[0]=o,e[1]=s,e[2]=n):n=e[2],n}function ys(){const i=ee.useContext(so);if(!i)throw new Error("useMonthGrid must be used within a MonthGridProvider");return i}const Bl="bg-blue-2/50",$l="bg-slate-2/50";function $n(i,e){return i?Bl:e?$l:""}function On(i){const e=je.c(83),{shift:s,open:o,hasAbsenceConflict:n,hasAvailabilityConflict:d,onClick:a,statusLabel:l,draggable:f}=i,r=o===void 0?!1:o,m=n===void 0?!1:n,c=d===void 0?!1:d,h=f===void 0?!0:f,{activeShift:p,canManageShifts:y,companyRoleById:g,branchNameById:u,showShiftBranchName:x,onShiftClick:b}=ys(),v=Ns(),{formatRange:j}=Wt();let w;e[0]!==s?(w=yt(s),e[0]=s,e[1]=w):w=e[1];const C=w,D=Ci(C),_=h&&y;let S;e[2]!==s?(S={...s,dragContext:"month"},e[2]=s,e[3]=S):S=e[3];const N=!_,B=`month-shift-${C}`;let A;e[4]!==S||e[5]!==N||e[6]!==B?(A={data:S,disabled:N,id:B},e[4]=S,e[5]=N,e[6]=B,e[7]=A):A=e[7];const{attributes:R,listeners:F,setNodeRef:H}=wi(A),M=s.companyRoleId?g[s.companyRoleId]:void 0,O=M?.color??"slate",Q=(s.overlappingShifts?.length??0)>0,$=Q||m||c,E=s.workedMinutes===void 0?null:s.workedMinutes/60,I=x?u[s.branchId]:void 0;let P;e[8]!==p||e[9]!==C?(P=p?yt(p)===C:!1,e[8]=p,e[9]=C,e[10]=P):P=e[10];const G=P,k=$?"var(--red-9)":D?"var(--amber-9)":`var(--${O}-9)`,T=`var(--${O}-3)`,W=$?"var(--red-9)":D?"var(--amber-9)":`var(--${O}-6)`,L=`var(--${O}-4)`;let q;e[11]!==k||e[12]!==T||e[13]!==W||e[14]!==L?(q={"--chip-edge":k,"--chip-bg":T,"--chip-border":W,"--chip-hover-bg":L},e[11]=k,e[12]=T,e[13]=W,e[14]=L,e[15]=q):q=e[15];const Z=q;let ne;e[16]!==a||e[17]!==b||e[18]!==s?(ne=pe=>{pe.stopPropagation(),a?a():b(s)},e[16]=a,e[17]=b,e[18]=s,e[19]=ne):ne=e[19];const Y=_&&"touch-none",ae=G&&"z-20 opacity-60 shadow-sm";let le;e[20]!==Y||e[21]!==ae?(le=Be("group relative flex w-full min-w-0 cursor-pointer flex-col items-start justify-center overflow-hidden rounded-xs border border-t-2 border-(--chip-border) border-t-(--chip-edge) bg-(--chip-bg) px-1 py-0.5 text-left leading-tight font-medium tabular-nums transition-colors hover:bg-(--chip-hover-bg)","focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none",Y,ae),e[20]=Y,e[21]=ae,e[22]=le):le=e[22];let U;e[23]!==R||e[24]!==_?(U=_?R:{},e[23]=R,e[24]=_,e[25]=U):U=e[25];let te;e[26]!==_||e[27]!==F?(te=_?F:{},e[26]=_,e[27]=F,e[28]=te):te=e[28];const se=s.startTime,oe=($||D)&&"pr-3";let be;e[29]!==oe?(be=Be("text-slate-12 text-[10px]",oe),e[29]=oe,e[30]=be):be=e[30];let ie;e[31]!==s.startTime||e[32]!==be?(ie=t.jsx(ii,{time:se,className:be}),e[31]=s.startTime,e[32]=be,e[33]=ie):ie=e[33];let fe;e[34]!==s.endTime?(fe=t.jsx(ii,{time:s.endTime,className:"text-slate-11 text-[10px]"}),e[34]=s.endTime,e[35]=fe):fe=e[35];let he;e[36]!==$||e[37]!==D?(he=$?t.jsx("span",{className:"absolute top-0 right-0 flex items-center justify-center rounded-bl-xs bg-(--chip-bg) pb-0.5 pl-0.5 transition-colors group-hover:bg-(--chip-hover-bg)",children:t.jsx(yn,{className:"text-red-9 size-2.5"})}):D?t.jsx("span",{className:"absolute top-0 right-0 flex items-center justify-center rounded-bl-xs bg-(--chip-bg) pb-0.5 pl-0.5 transition-colors group-hover:bg-(--chip-hover-bg)",children:t.jsx($i,{className:"text-amber-9 size-2.5","aria-hidden":"true"})}):null,e[36]=$,e[37]=D,e[38]=he):he=e[38];let Ie;e[39]!==Z||e[40]!==H||e[41]!==ne||e[42]!==le||e[43]!==U||e[44]!==te||e[45]!==ie||e[46]!==fe||e[47]!==he?(Ie=t.jsx(ft,{asChild:!0,children:t.jsxs("button",{ref:H,type:"button",onClick:ne,style:Z,className:le,...U,...te,children:[ie,fe,he]})}),e[39]=Z,e[40]=H,e[41]=ne,e[42]=le,e[43]=U,e[44]=te,e[45]=ie,e[46]=fe,e[47]=he,e[48]=Ie):Ie=e[48];const de=M?.name?`${M.name} · `:"";let re;e[49]!==j||e[50]!==s.endTime||e[51]!==s.startTime?(re=j(s.startTime,s.endTime),e[49]=j,e[50]=s.endTime,e[51]=s.startTime,e[52]=re):re=e[52];let Se;e[53]!==de||e[54]!==re?(Se=t.jsxs("p",{className:"font-medium",children:[de,re]}),e[53]=de,e[54]=re,e[55]=Se):Se=e[55];let X;e[56]!==E?(X=E===null?"â¦":Kt(E),e[56]=E,e[57]=X):X=e[57];let ge;e[58]!==X?(ge=t.jsx("p",{className:"text-xs",children:X}),e[58]=X,e[59]=ge):ge=e[59];let ce;e[60]!==I?(ce=I&&t.jsx("p",{className:"text-xs",children:I}),e[60]=I,e[61]=ce):ce=e[61];let Ce;e[62]!==r||e[63]!==l?(Ce=r&&t.jsxs("p",{className:"text-xs",children:[t.jsx(J,{id:"roster.month.chip.open"}),l?t.jsxs(t.Fragment,{children:[" · ",l]}):null]}),e[62]=r,e[63]=l,e[64]=Ce):Ce=e[64];let Ee;e[65]!==m||e[66]!==c||e[67]!==$||e[68]!==Q?(Ee=$&&t.jsxs(Ei,{className:"mt-1",children:[Q&&t.jsx("p",{children:t.jsx(J,{id:"roster.month.chip.overlap"})}),m&&t.jsx("p",{children:t.jsx(J,{id:"roster.month.chip.absence"})}),c&&t.jsx("p",{children:t.jsx(J,{id:"roster.month.chip.unavailable"})})]}),e[65]=m,e[66]=c,e[67]=$,e[68]=Q,e[69]=Ee):Ee=e[69];let ue;e[70]!==v||e[71]!==D?(ue=D&&t.jsxs("div",{className:"text-amber-9 text-xs",children:[t.jsx("p",{className:"font-medium",children:t.jsx(J,{id:"roster.compliance.tooltipTitle"})}),D.map(pe=>t.jsx("p",{children:Hs[pe.code]?v(Hs[pe.code].label):pe.code},pe.code))]}),e[70]=v,e[71]=D,e[72]=ue):ue=e[72];let me;e[73]!==Se||e[74]!==ge||e[75]!==ce||e[76]!==Ce||e[77]!==Ee||e[78]!==ue?(me=t.jsx(ht,{children:t.jsxs("div",{className:"space-y-0.5",children:[Se,ge,ce,Ce,Ee,ue]})}),e[73]=Se,e[74]=ge,e[75]=ce,e[76]=Ce,e[77]=Ee,e[78]=ue,e[79]=me):me=e[79];let _e;return e[80]!==Ie||e[81]!==me?(_e=t.jsxs(mt,{children:[Ie,me]}),e[80]=Ie,e[81]=me,e[82]=_e):_e=e[82],_e}function ii(i){const e=je.c(12),{time:s,className:o}=i,{timeFormat:n}=Wt();let d;e[0]!==s||e[1]!==n?(d=da(s,n),e[0]=s,e[1]=n,e[2]=d):d=e[2];const{hour:a,minutes:l,suffix:f}=d;let r;e[3]!==o?(r=Be("tabular-nums",o),e[3]=o,e[4]=r):r=e[4];let m;e[5]!==l?(m=t.jsxs("span",{className:"hidden group-hover:inline",children:[":",l]}),e[5]=l,e[6]=m):m=e[6];let c;return e[7]!==a||e[8]!==f||e[9]!==r||e[10]!==m?(c=t.jsxs("span",{className:r,children:[a,m,f]}),e[7]=a,e[8]=f,e[9]=r,e[10]=m,e[11]=c):c=e[11],c}function Ol(i){const e=je.c(19),{openShiftsByDate:s,onEmployeeOpenShiftClick:o}=i,{i18n:n}=at(),{monthDates:d,monthDateStrings:a,todayStr:l,gridTemplateColumns:f}=ys();let r;e[0]!==f?(r={display:"grid",gridTemplateColumns:f},e[0]=f,e[1]=r):r=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"border-border bg-slate-1 sticky left-0 z-3 flex items-center border-r border-b px-2.5 py-1",children:t.jsx("span",{className:"text-slate-11 truncate text-xs font-medium",children:t.jsx(J,{id:"roster.month.openShifts.label"})})}),e[2]=m):m=e[2];let c;if(e[3]!==n||e[4]!==a||e[5]!==d||e[6]!==o||e[7]!==s||e[8]!==l){let p;e[10]!==n||e[11]!==a||e[12]!==o||e[13]!==s||e[14]!==l?(p=(y,g)=>{const u=a[g],x=s[u]??[],b=Ts(y)>=6;return t.jsx("div",{className:Be("border-border flex min-w-0 flex-col justify-start gap-0.5 border-r border-b p-0.5",$n(u===l,b)),children:x.map(v=>t.jsx(On,{shift:jn(v),open:!0,draggable:!1,onClick:()=>o(v),statusLabel:v.applicationStatus==="pending"?n._({id:"openShift.applied"}):void 0},v.shiftKey))},u)},e[10]=n,e[11]=a,e[12]=o,e[13]=s,e[14]=l,e[15]=p):p=e[15],c=d.map(p),e[3]=n,e[4]=a,e[5]=d,e[6]=o,e[7]=s,e[8]=l,e[9]=c}else c=e[9];let h;return e[16]!==r||e[17]!==c?(h=t.jsxs("div",{className:"min-h-[34px]",style:r,children:[m,c]}),e[16]=r,e[17]=c,e[18]=h):h=e[18],h}function Pn(i){const e=je.c(8),{minutes:s,show:o,className:n}=i;if(!o||s===void 0)return null;const d=s===0?"text-slate-10 italic":"text-slate-11";let a;e[0]!==n||e[1]!==d?(a=Be("bg-background/85 pointer-events-none absolute inset-x-0 bottom-0 z-1 truncate px-0.5 text-center text-[11px] leading-tight font-medium tabular-nums",d,n),e[0]=n,e[1]=d,e[2]=a):a=e[2];let l;e[3]!==s?(l=s===0?t.jsx(J,{id:"roster.month.cell.free"}):Kt(s/60),e[3]=s,e[4]=l):l=e[4];let f;
36return e[5]!==a||e[6]!==l?(f=t.jsx("span",{"aria-hidden":!0,className:a,children:l}),e[5]=a,e[6]=l,e[7]=f):f=e[7],f}function Pl(){const i=je.c(7);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e={left:0,top:0,width:0,height:0},i[0]=e):e=i[0];const[s,o]=ee.useState(e),[n,d]=ee.useState(null);let a;i[1]===Symbol.for("react.memo_cache_sentinel")?(a=c=>{d(c)},i[1]=a):a=i[1];const l=a;let f,r;i[2]!==n?(f=()=>{if(!n)return;const c=()=>{const p=n.getBoundingClientRect();o({left:p.left,top:p.top,width:p.width,height:p.height})};c();const h=new ResizeObserver(()=>{c()});return h.observe(n),window.addEventListener("resize",c),()=>{h.disconnect(),window.removeEventListener("resize",c)}},r=[n],i[2]=n,i[3]=f,i[4]=r):(f=i[3],r=i[4]),ee.useLayoutEffect(f,r);let m;return i[5]!==s?(m=[l,s],i[5]=s,i[6]=m):m=i[6],m}function no(i){const e=je.c(25),{className:s,strokeColor:o,strokeWidth:n,dashLength:d,gapLength:a,animationDuration:l,padding:f,borderRadius:r}=i,m=o===void 0?"currentColor":o,c=n===void 0?2:n,h=d===void 0?6:d,p=a===void 0?3:a,y=l===void 0?"10s":l,g=f===void 0?2:f,u=r===void 0?6:r,[x,b]=Pl(),v=b.width||100,j=b.height||100,w=g,C=g,D=v-2*g,_=j-2*g,S=2*(D+_)-8*u+Math.PI*2*u,N=`${h} ${p}`;let B;e[0]!==S?(B=Math.round(S),e[0]=S,e[1]=B):B=e[1];const A=`dash-flow-${B}`;let R;e[2]!==s?(R=Be("pointer-events-none absolute inset-0 h-full w-full",s),e[2]=s,e[3]=R):R=e[3];const F=`0 0 ${v} ${j}`;let H;e[4]!==S?(H=Math.round(S),e[4]=S,e[5]=H):H=e[5];const M=` 37 .animated-dash-${H} { 38 stroke-dasharray: ${N}; 39 stroke-dashoffset: ${S}; 40 animation: ${A} ${y} linear infinite; 41 stroke-linecap: round; 42 stroke-linejoin: round; 43 } 44 45 @keyframes ${A} { 46 0% { 47 stroke-dashoffset: ${S}; 48 } 49 100% { 50 stroke-dashoffset: 0; 51 } 52 } 53 `;let O;e[6]!==M?(O=t.jsx("defs",{children:t.jsx("style",{children:M})}),e[6]=M,e[7]=O):O=e[7];let Q;e[8]!==S?(Q=Math.round(S),e[8]=S,e[9]=Q):Q=e[9];const $=`animated-dash-${Q}`;let E;e[10]!==u||e[11]!==_||e[12]!==D||e[13]!==w||e[14]!==C||e[15]!==m||e[16]!==c||e[17]!==$?(E=t.jsx("rect",{x:w,y:C,width:D,height:_,fill:"none",stroke:m,strokeWidth:c,className:$,rx:u,ry:u}),e[10]=u,e[11]=_,e[12]=D,e[13]=w,e[14]=C,e[15]=m,e[16]=c,e[17]=$,e[18]=E):E=e[18];let I;return e[19]!==x||e[20]!==F||e[21]!==O||e[22]!==E||e[23]!==R?(I=t.jsxs("svg",{ref:x,className:R,viewBox:F,preserveAspectRatio:"none",children:[O,E]}),e[19]=x,e[20]=F,e[21]=O,e[22]=E,e[23]=R,e[24]=I):I=e[24],I}function io(i){const e=je.c(15),{operation:s}=i,o=s==="copy",n=o?Cn:Dn,d=o?"bg-green-3/80":"bg-blue-3/80";let a;e[0]!==d?(a=Be("pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-xs",d),e[0]=d,e[1]=a):a=e[1];const l=o?"hsl(151 55% 41.5%)":"hsl(206 100% 50%)";let f;e[2]!==l?(f=t.jsx(no,{strokeColor:l,strokeWidth:2,dashLength:6,gapLength:3,animationDuration:"40s",borderRadius:4}),e[2]=l,e[3]=f):f=e[3];const r=o?"bg-green-9":"bg-blue-9";let m;e[4]!==r?(m=Be("flex size-5 items-center justify-center rounded-full text-white shadow-sm",r),e[4]=r,e[5]=m):m=e[5];let c;e[6]!==n?(c=t.jsx(n,{className:"size-3"}),e[6]=n,e[7]=c):c=e[7];let h;e[8]!==m||e[9]!==c?(h=t.jsx("span",{className:m,children:c}),e[8]=m,e[9]=c,e[10]=h):h=e[10];let p;return e[11]!==a||e[12]!==f||e[13]!==h?(p=t.jsxs("span",{"aria-hidden":!0,className:a,children:[f,h]}),e[11]=a,e[12]=f,e[13]=h,e[14]=p):p=e[14],p}function Ll(i){const e=je.c(78),{date:s,isToday:o,shifts:n,absences:d,availabilities:a,employeeId:l,companyRoleId:f,dailyQuotaMinutes:r,showDailyQuota:m}=i,c=m===void 0?!1:m,{i18n:h}=at(),p=gn(),{canCreateShifts:y,activeShift:g,isMoveModifierActive:u,onCreateShiftClick:x}=ys();let b;e[0]!==s?(b=Oe(s,Je),e[0]=s,e[1]=b):b=e[1];const v=b,j=Ts(s)>=6;let w;e[2]!==a?(w=a.filter(Vl),e[2]=a,e[3]=w):w=e[3];const C=w;let D;e[4]!==a?(D=a.filter(Hl),e[4]=a,e[5]=D):D=e[5];const _=D,S=n.length>0,N=d.find(zl)??d.find(Wl);let B;e[6]!==d?(B=d.some(Fl),e[6]=d,e[7]=B):B=e[7];const A=B,R=!S&&C.length>0,F=!S&&!N&&C.length===0&&_.length>0;let H="",M,O,Q,$,E;if(N){E=N.absenceType?.colorToken??"orange",O=p(N.absenceType,h._({id:"roster.month.cell.absence"})),$=S?void 0:O,Q=t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"font-medium",children:O}),N.status==="pending"?t.jsx("p",{className:"text-xs",children:t.jsx(J,{id:"roster.grid.absence.pending"})}):null,t.jsxs("p",{className:"text-xs",children:[We(new Date(N.startAt),{month:"short",day:"numeric"},h.locale)," â ",We(new Date(N.endAt),{month:"short",day:"numeric"},h.locale)]}),N.absenceType?.paid!==void 0&&t.jsx("p",{className:"text-xs",children:N.absenceType.paid?t.jsx(J,{id:"roster.grid.absence.paid"}):t.jsx(J,{id:"roster.grid.absence.unpaid"})}),N.reason&&t.jsx("p",{className:"max-w-[200px] text-xs italic",children:N.reason})]});const pe=`var(--${E}-3)`;let Me;e[8]!==pe?(Me={backgroundColor:pe},e[8]=pe,e[9]=Me):Me=e[9],M=Me}else if(R){let pe;e[10]!==h?(pe=h._({id:"roster.month.cell.unavailable"}),e[10]=h,e[11]=pe):pe=e[11],O=pe;let Me;e[12]!==C?(Me=t.jsx(oi,{availabilities:C}),e[12]=C,e[13]=Me):Me=e[13],Q=Me,H="bg-red-3"}else if(F){let pe;e[14]!==h?(pe=h._({id:"roster.month.cell.available"}),e[14]=h,e[15]=pe):pe=e[15],O=pe;let Me;e[16]!==_?(Me=t.jsx(oi,{availabilities:_}),e[16]=_,e[17]=Me):Me=e[17],Q=Me,H="bg-green-3"}else H=$n(o,j);const I=y&&!S&&f!==void 0,P=y&&f!==void 0,k=g!=null&&!g.assignedEmployeeId||u?"move":"copy";let T;e[18]!==f||e[19]!==v||e[20]!==k||e[21]!==l?(T={assignedEmployeeId:l,companyRoleId:f,date:v,operation:k},e[18]=f,e[19]=v,e[20]=k,e[21]=l,e[22]=T):T=e[22];const W=T,L=`month-drop-${l}-${f??"role"}-${v}`,q=!P;let Z;e[23]!==W||e[24]!==L||e[25]!==q?(Z={id:L,data:W,disabled:q},e[23]=W,e[24]=L,e[25]=q,e[26]=Z):Z=e[26];const{isOver:ne,setNodeRef:Y}=ms(Z);let ae;e[27]!==h?(ae=h._({id:"roster.month.cell.addShift"}),e[27]=h,e[28]=ae):ae=e[28];const le=ae;let U;e[29]!==I||e[30]!==f||e[31]!==s||e[32]!==l||e[33]!==x?(U=()=>{I&&x({employeeId:l,companyRoleId:f,date:s})},e[29]=I,e[30]=f,e[31]=s,e[32]=l,e[33]=x,e[34]=U):U=e[34];const te=U,se=I?le:void 0,oe=O??(I?le:void 0),be=I?"button":void 0,ie=I?0:void 0,fe=I?te:void 0;let he;e[35]!==I||e[36]!==te?(he=I?pe=>
53{pe.key!=="Enter"&&pe.key!==" "||(pe.preventDefault(),te())}:void 0,e[35]=I,e[36]=te,e[37]=he):he=e[37];const Ie=M,de=Be("group border-border relative flex min-w-0 flex-col justify-start gap-0.5 border-r border-b p-0.5",H,I&&"hover:bg-slate-3/60 cursor-pointer",ne&&"z-2");let re;e[38]!==k||e[39]!==ne?(re=ne&&t.jsx(io,{operation:k}),e[38]=k,e[39]=ne,e[40]=re):re=e[40];let Se;e[41]!==$||e[42]!==E?(Se=$&&t.jsx("span",{"aria-hidden":!0,className:"m-auto w-full truncate px-0.5 text-center text-[8px] leading-tight font-medium",style:{color:`var(--${E}-11)`},children:$}),e[41]=$,e[42]=E,e[43]=Se):Se=e[43];let X;e[44]!==I?(X=I&&t.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100 motion-reduce:transition-none",children:t.jsx("span",{className:"bg-background text-foreground/50 flex size-4 items-center justify-center rounded-full shadow-sm",children:t.jsx("span",{className:"text-xs leading-none font-medium",children:"+"})})}),e[44]=I,e[45]=X):X=e[45];let ge;if(e[46]!==A||e[47]!==n||e[48]!==C){let pe;e[50]!==A||e[51]!==C?(pe=Me=>{const Pe=C.some(ze=>Xs(Me,[ze]));return t.jsx(On,{shift:Me,hasAbsenceConflict:A,hasAvailabilityConflict:Pe},yt(Me))},e[50]=A,e[51]=C,e[52]=pe):pe=e[52],ge=n.map(pe),e[46]=A,e[47]=n,e[48]=C,e[49]=ge}else ge=e[49];let ce;e[53]!==r||e[54]!==c?(ce=t.jsx(Pn,{minutes:r,show:c}),e[53]=r,e[54]=c,e[55]=ce):ce=e[55];let Ce;e[56]!==M||e[57]!==Y||e[58]!==se||e[59]!==oe||e[60]!==be||e[61]!==ie||e[62]!==fe||e[63]!==he||e[64]!==de||e[65]!==re||e[66]!==Se||e[67]!==X||e[68]!==ge||e[69]!==ce?(Ce=t.jsxs("div",{ref:Y,"aria-label":se,title:oe,role:be,tabIndex:ie,onClick:fe,onKeyDown:he,style:Ie,className:de,children:[re,Se,X,ge,ce]}),e[56]=M,e[57]=Y,e[58]=se,e[59]=oe,e[60]=be,e[61]=ie,e[62]=fe,e[63]=he,e[64]=de,e[65]=re,e[66]=Se,e[67]=X,e[68]=ge,e[69]=ce,e[70]=Ce):Ce=e[70];const Ee=Ce;if(!Q)return Ee;let ue;e[71]!==Ee?(ue=t.jsx(ft,{asChild:!0,children:Ee}),e[71]=Ee,e[72]=ue):ue=e[72];let me;e[73]!==Q?(me=t.jsx(ht,{children:Q}),e[73]=Q,e[74]=me):me=e[74];let _e;return e[75]!==ue||e[76]!==me?(_e=t.jsxs(mt,{children:[ue,me]}),e[75]=ue,e[76]=me,e[77]=_e):_e=e[77],_e}function Fl(i){return i.status==="approved"}function Wl(i){return i.status==="pending"}function zl(i){return i.status==="approved"}function Hl(i){return i.kind==="available"}function Vl(i){return i.kind==="unavailable"}function oi(i){const e=je.c(11),{availabilities:s}=i,{i18n:o}=at(),{formatRange:n,intlOptions:d}=Wt();let a;if(e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==d){let f;e[5]!==n||e[6]!==o||e[7]!==d?(f=r=>{const m=r.kind==="available",{start:c,end:h}=yi(r),{start:p,end:y}=Mi(r),g=m?o._({id:"roster.grid.availability.available"}):o._({id:"roster.grid.availability.unavailable"}),u=r.isAllDay?o._({id:"roster.grid.availability.allDay"}):r.startTime&&r.endTime?n(r.startTime,r.endTime," - "):`${We(c,{timeStyle:"short",...d},o.locale)} - ${We(h,{timeStyle:"short",...d},o.locale)}`;return t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"font-medium",children:g}),t.jsxs("p",{className:"text-xs",children:[We(p,{month:"short",day:"numeric"},o.locale),Bs(p)!==Bs(y)&&t.jsxs(t.Fragment,{children:[" â ",We(y,{month:"short",day:"numeric"},o.locale)]})]}),t.jsx("p",{className:"text-xs",children:u}),r.note&&t.jsx("p",{className:"max-w-[200px] text-xs italic",children:r.note})]},r._id)},e[5]=n,e[6]=o,e[7]=d,e[8]=f):f=e[8],a=s.map(f),e[0]=s,e[1]=n,e[2]=o,e[3]=d,e[4]=a}else a=e[4];let l;return e[9]!==a?(l=t.jsx("div",{className:"space-y-1",children:a}),e[9]=a,e[10]=l):l=e[10],l}function ai(i){const e=je.c(43),{employee:s,shiftsByDate:o,absencesByDate:n,availabilitiesByDate:d,allLocationShifts:a,quotaHours:l,timeAccountBalance:f,weekdayQuotaMinutes:r,createRoleId:m}=i,{monthDates:c,monthDateStrings:h,todayStr:p,gridTemplateColumns:y,onEmployeeClick:g}=ys(),u=Gs(a),x=u-l,[b,v]=ee.useState(!1);let j;e[0]!==y?(j={display:"grid",gridTemplateColumns:y},e[0]=y,e[1]=j):j=e[1];let w;e[2]!==s._id||e[3]!==g?(w=()=>g(s._id),e[2]=s._id,e[3]=g,e[4]=w):w=e[4];let C,D;e[5]===Symbol.for("react.memo_cache_sentinel")?(C=()=>v(!0),D=()=>v(!1),e[5]=C,e[6]=D):(C=e[5],D=e[6]);let _;e[7]!==s.name?(_=t.jsx("span",{className:"text-slate-12 min-w-0 truncate text-xs font-medium",title:s.name,children:s.name}),e[7]=s.name,e[8]=_):_=e[8];let S;e[9]!==x||e[10]!==l||e[11]!==u||e[12]!==_||e[13]!==f?(S=t.jsx(Bn,{peri
53od:"month",layout:"stacked",scheduledHours:u,quotaHours:l,delta:x,timeAccountBalanceMinutes:f,name:_}),e[9]=x,e[10]=l,e[11]=u,e[12]=_,e[13]=f,e[14]=S):S=e[14];let N;e[15]!==w||e[16]!==S?(N=t.jsx("div",{className:"border-border bg-slate-1 sticky left-0 z-3 flex cursor-pointer flex-col justify-center border-r border-b px-2.5 py-1",onClick:w,onMouseEnter:C,onMouseLeave:D,children:S}),e[15]=w,e[16]=S,e[17]=N):N=e[17];let B;if(e[18]!==n||e[19]!==d||e[20]!==m||e[21]!==s._id||e[22]!==h||e[23]!==c||e[24]!==o||e[25]!==b||e[26]!==p||e[27]!==r){let R;e[29]!==n||e[30]!==d||e[31]!==m||e[32]!==s._id||e[33]!==h||e[34]!==o||e[35]!==b||e[36]!==p||e[37]!==r?(R=(F,H)=>{const M=h[H];return t.jsx(Ll,{date:F,isToday:M===p,shifts:o[M]??[],absences:n[M]??[],availabilities:d[M]??[],employeeId:s._id,companyRoleId:m,dailyQuotaMinutes:r?.[In(F)],showDailyQuota:b},M)},e[29]=n,e[30]=d,e[31]=m,e[32]=s._id,e[33]=h,e[34]=o,e[35]=b,e[36]=p,e[37]=r,e[38]=R):R=e[38],B=c.map(R),e[18]=n,e[19]=d,e[20]=m,e[21]=s._id,e[22]=h,e[23]=c,e[24]=o,e[25]=b,e[26]=p,e[27]=r,e[28]=B}else B=e[28];let A;return e[39]!==j||e[40]!==N||e[41]!==B?(A=t.jsxs("div",{className:"min-h-[34px]",style:j,children:[N,B]}),e[39]=j,e[40]=N,e[41]=B,e[42]=A):A=e[42],A}function Ql(i){const e=je.c(17),{openShiftsByDate:s}=i,{i18n:o}=at(),{monthDates:n,monthDateStrings:d,gridTemplateColumns:a}=ys();let l;e[0]!==o?(l=o._({id:"roster.month.openShifts.add"}),e[0]=o,e[1]=l):l=e[1];const f=l;let r;e[2]!==a?(r={display:"grid",gridTemplateColumns:a},e[2]=a,e[3]=r):r=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"border-border bg-slate-1 sticky left-0 z-3 flex items-center border-r border-b px-2.5 py-1",children:t.jsx("span",{className:"text-slate-11 truncate text-xs font-medium",children:t.jsx(J,{id:"roster.month.openShifts.label"})})}),e[4]=m):m=e[4];let c;if(e[5]!==f||e[6]!==d||e[7]!==n||e[8]!==s){let p;e[10]!==f||e[11]!==d||e[12]!==s?(p=(y,g)=>{const u=d[g];return t.jsx(Ul,{date:y,dateStr:u,dayOpenShifts:s[u]??[],addOpenShiftLabel:f},u)},e[10]=f,e[11]=d,e[12]=s,e[13]=p):p=e[13],c=n.map(p),e[5]=f,e[6]=d,e[7]=n,e[8]=s,e[9]=c}else c=e[9];let h;return e[14]!==r||e[15]!==c?(h=t.jsxs("div",{className:"min-h-[34px]",style:r,children:[m,c]}),e[14]=r,e[15]=c,e[16]=h):h=e[16],h}function Ul(i){const e=je.c(37),{date:s,dateStr:o,dayOpenShifts:n,addOpenShiftLabel:d}=i,{todayStr:a,canManageShifts:l,canCreateShifts:f,onCreateOpenShiftClick:r}=ys(),m=Ts(s)>=6,c=f&&n.length===0;let h;e[0]!==o?(h={assignedEmployeeId:void 0,date:o,operation:"move"},e[0]=o,e[1]=h):h=e[1];const p=h,y=`month-open-shifts-drop-${o}`,g=!l;let u;e[2]!==p||e[3]!==y||e[4]!==g?(u={id:y,data:p,disabled:g},e[2]=p,e[3]=y,e[4]=g,e[5]=u):u=e[5];const{isOver:x,setNodeRef:b}=ms(u);let v;e[6]!==c||e[7]!==s||e[8]!==r?(v=()=>{c&&r({date:s})},e[6]=c,e[7]=s,e[8]=r,e[9]=v):v=e[9];const j=v,w=c?d:void 0,C=c?d:void 0,D=c?"button":void 0,_=c?0:void 0,S=c?j:void 0;let N;e[10]!==c||e[11]!==j?(N=c?M=>{M.key!=="Enter"&&M.key!==" "||(M.preventDefault(),j())}:void 0,e[10]=c,e[11]=j,e[12]=N):N=e[12];let B;e[13]!==c||e[14]!==o||e[15]!==x||e[16]!==m||e[17]!==a?(B=Be("group border-border relative flex min-w-0 flex-col justify-start gap-0.5 border-r border-b p-0.5",$n(o===a,m),c&&"hover:bg-slate-3/60 cursor-pointer",x&&"z-2"),e[13]=c,e[14]=o,e[15]=x,e[16]=m,e[17]=a,e[18]=B):B=e[18];let A;e[19]!==x?(A=x&&t.jsx(io,{operation:"move"}),e[19]=x,e[20]=A):A=e[20];let R;e[21]!==c?(R=c&&t.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100 motion-reduce:transition-none",children:t.jsx("span",{className:"bg-background text-foreground/50 flex size-4 items-center justify-center rounded-full shadow-sm",children:t.jsx(pa,{className:"size-3"})})}),e[21]=c,e[22]=R):R=e[22];let F;e[23]!==n?(F=n.map(Gl),e[23]=n,e[24]=F):F=e[24];let H;return e[25]!==b||e[26]!==S||e[27]!==N||e[28]!==B||e[29]!==A||e[30]!==R||e[31]!==F||e[32]!==w||e[33]!==C||e[34]!==D||e[35]!==_?(H=t.jsxs("div",{ref:b,"aria-label":w,title:C,role:D,tabIndex:_,onClick:S,onKeyDown:N,className:B,children:[A,R,F]}),e[25]=b,e[26]=S,e[27]=N,e[28]=B,e[29]=A,e[30]=R,e[31]=F,e[32]=w,e[33]=C,e[34]=D,e[35]=_,e[36]=H):H=e[36],H}function Gl(i){return t.jsx(On,{shift:i,open:!0},yt(i))}const sn=190,li=34;function Kl(i){const e=je.c(115),{monthDates:s,monthDateStrings:o,companyRoles:n,filteredEmployees:d,shiftsByEmployeeByDate:a,allLocationShiftsByEmployee:l,absencesByEmployeeByDate:f,availabilitiesByEmployeeByDate:r,managerOpenShiftsByDate:m,employeeOpenShiftsByDate:c,searchTerm:h,setSearchTerm:p,hideEmptyRows:y,hiddenEmptyRowsCount:g,onToggleHideEmptyRows:u,groupByRole:x,isLoading:b,canManageShifts:v,canCreateShifts:j,isWeekPublished:w,activeShift:C,isMoveModifierActive:D,roleFilterIds:_,canPublishWeeks:S,onDayHeaderClick:N,onWeekHeaderClick:B,onPublishWeekClick:A,onShiftClick:R,onEmployeeClick:F,onEmployeeOpenShiftClick:H,onCreateShiftClick:M,onCreateOpenShiftClick:O,branches:Q,selectedBranchId:$,timeAccountBalances:E,monthlyQuotaHoursById:I,weekdayQuotaMinutesById:P,addresses:G,tags:k}=i,T=g===void 0?0:g,W=D===void 0?!1:D,{i18n:L}=at();let q;e[0]===Symbol.for("react.memo_cache_sentinel")?(q=new Set,e[0]=q):q=e[0];const[Z,ne]=ee.useState(q);let Y;e[1]===Symbol.for("react.memo_cache_sentinel")?(Y=Oe(new Date,Je),e[1]=Y):Y=e[1];const ae=Y,le=s.length,U=`${sn}px repeat(${le}, minmax(${li}px, 1fr))`;let te;e[2]!==n?(te=Object.fromEntries(n.map(er)),e[2]=n,e[3]=te):te=e[3];const se=te;let oe;e[4]!==G?(oe=Object.fromEntries((G??[]).map(Jl)),e[4]=G,e[5]=oe):oe=e[5];const be=oe;let ie;e[6]!==k?(ie=Object.fromEntries((k??[]).map(Zl)),e[6]=k,e[7]=ie):ie=e[7];const fe=ie;let he;e[8]!==Q?(he=Object.fromEntries(Q.map(Xl)),e[8]=Q,e[9]=he):he=e[9];const Ie=he,de=!$&&Q.length>1;let re;
53e[10]!==s?(re=[],s.forEach((K,Te)=>{const $e=Qt(K),ke=Oe($e,Je),Qe=re[re.length-1];if(Qe&&Qe.weekStartStr===ke){Qe.span=Qe.span+1;return}re.push({weekNumber:gi(K),weekStartStr:ke,weekStartDate:$e,span:1,startIndex:Te})}),e[10]=s,e[11]=re):re=e[11];const Se=re;let X;e[12]!==I?(X=K=>I?.[K]??kn*4.333333333333333,e[12]=I,e[13]=X):X=e[13];const ge=X;let ce;e[14]!==a?(ce=K=>{const Te=a[K];return Te?Object.values(Te).some(ql):!1},e[14]=a,e[15]=ce):ce=e[15];const Ce=ce;let Ee;e[16]!==a?(Ee=(K,Te)=>{const $e=a[K];return $e?Object.values($e).some(ke=>ke.some(Qe=>Qe.companyRoleId===Te)):!1},e[16]=a,e[17]=Ee):Ee=e[17];const ue=Ee;let me;e[18]===Symbol.for("react.memo_cache_sentinel")?(me=K=>ne(Te=>{const $e=new Set(Te);return $e.has(K)?$e.delete(K):$e.add(K),$e}),e[18]=me):me=e[18];const _e=me;let pe;e[19]!==C||e[20]!==be||e[21]!==Ie||e[22]!==j||e[23]!==v||e[24]!==se||e[25]!==U||e[26]!==W||e[27]!==o||e[28]!==s||e[29]!==O||e[30]!==M||e[31]!==F||e[32]!==R||e[33]!==de||e[34]!==fe?(pe={monthDates:s,monthDateStrings:o,todayStr:ae,gridTemplateColumns:U,companyRoleById:se,addressById:be,tagById:fe,branchNameById:Ie,showShiftBranchName:de,canManageShifts:v,canCreateShifts:j,activeShift:C,isMoveModifierActive:W,onShiftClick:R,onEmployeeClick:F,onCreateShiftClick:M,onCreateOpenShiftClick:O},e[19]=C,e[20]=be,e[21]=Ie,e[22]=j,e[23]=v,e[24]=se,e[25]=U,e[26]=W,e[27]=o,e[28]=s,e[29]=O,e[30]=M,e[31]=F,e[32]=R,e[33]=de,e[34]=fe,e[35]=pe):pe=e[35];const Me=pe,Pe=sn+le*li;let ze;e[36]!==Pe?(ze={minWidth:Pe},e[36]=Pe,e[37]=ze):ze=e[37];let He;e[38]!==U?(He={display:"grid",gridTemplateColumns:U},e[38]=U,e[39]=He):He=e[39];let Ue;e[40]===Symbol.for("react.memo_cache_sentinel")?(Ue=t.jsx("div",{className:"border-border bg-background sticky left-0 z-6 border-r border-b"}),e[40]=Ue):Ue=e[40];let Ge;e[41]!==S||e[42]!==L||e[43]!==w||e[44]!==A||e[45]!==B||e[46]!==Se?(Ge=Se.map(K=>{const Te=w(K.weekStartStr),$e=Oe(jt(K.weekStartDate,6),Je),ke=L._({id:"roster.month.header.openWeek",message:"Open week {week}",values:{week:K.weekNumber}}),Qe=Te?L._({id:"roster.month.header.unpublishWeek"}):L._({id:"roster.month.header.publishWeek"});return t.jsxs("div",{className:"border-border flex min-w-0 items-center gap-1 border-r border-b px-1.5 py-1",style:{gridColumn:`${2+K.startIndex} / span ${K.span}`},children:[t.jsxs("button",{type:"button","aria-label":ke,title:ke,onClick:()=>B(K.weekStartDate),className:"text-slate-11 hover:text-foreground focus-visible:ring-ring flex min-w-0 flex-1 cursor-pointer items-center gap-1 truncate rounded-sm px-0.5 text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[t.jsx(J,{id:"roster.month.weekShort"})," ",K.weekNumber]}),t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:S?t.jsx("button",{type:"button","aria-label":Qe,title:Qe,onClick:nt=>{nt.stopPropagation(),A({weekStartDate:K.weekStartDate,weekStartStr:K.weekStartStr,weekEndStr:$e,isPublished:Te})},className:"hover:bg-slate-3 focus-visible:ring-ring inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm transition-colors focus-visible:ring-2 focus-visible:outline-none",children:Te?t.jsx(Vs,{className:"text-slate-10 size-3"}):t.jsx(Qs,{className:"text-amber-11 size-3"})}):t.jsx("span",{className:"inline-flex size-5 shrink-0 items-center justify-center",children:Te?t.jsx(Vs,{className:"text-slate-10 size-3"}):t.jsx(Qs,{className:"text-amber-11 size-3"})})}),t.jsx(ht,{children:Te?t.jsx(J,{id:"roster.month.week.published"}):t.jsx(J,{id:"roster.month.week.unpublished"})})]})]},K.weekStartStr)}),e[41]=S,e[42]=L,e[43]=w,e[44]=A,e[45]=B,e[46]=Se,e[47]=Ge):Ge=e[47];let Le;e[48]!==He||e[49]!==Ge?(Le=t.jsxs("div",{style:He,children:[Ue,Ge]}),e[48]=He,e[49]=Ge,e[50]=Le):Le=e[50];let Ke;e[51]!==U?(Ke={display:"grid",gridTemplateColumns:U},e[51]=U,e[52]=Ke):Ke=e[52];let Re;e[53]===Symbol.for("react.memo_cache_sentinel")?(Re=t.jsx(vn,{align:"inline-start",children:t.jsx(xn,{})}),e[53]=Re):Re=e[53];let qe;e[54]!==L?(qe=L._({id:"roster.month.searchPlaceholder"}),e[54]=L,e[55]=qe):qe=e[55];let st;e[56]!==p?(st=K=>p(K.target.value),e[56]=p,e[57]=st):st=e[57];let Ve;e[58]!==h||e[59]!==qe||e[60]!==st?(Ve=t.jsx("div",{className:"border-border bg-background sticky left-0 z-6 flex items-center border-r border-b p-1",children:t.jsxs(wn,{children:[Re,t.jsx(_n,{type:"search",placeholder:qe,value:h,onChange:st})]})}),e[58]=h,e[59]=qe,e[60]=st,e[61]=Ve):Ve=e[61];let we;if(e[62]!==L||e[63]!==o||e[64]!==s||e[65]!==N){let K;e[67]!==L||e[68]!==o||e[69]!==N?(K=(Te,$e)=>{const ke=o[$e]===ae,Qe=L._({id:"roster.month.header.openDay",message:"Open day view for {date}",values:{date:We(Te,{weekday:"short",month:"short",day:"numeric"},L.locale)}});return t.jsxs("button",{type:"button","aria-label":Qe,title:Qe,onClick:()=>N(Te),className:Be("border-border hover:bg-slate-3/60 focus-visible:ring-ring flex cursor-pointer flex-col items-center justify-center gap-0.5 border-r border-b py-1 transition-colors focus-visible:ring-2 focus-visible:outline-none",ke&&"bg-blue-2/50"),children:[t.jsx("span",{className:"text-slate-10 text-[9px] uppercase",children:We(Te,{weekday:"narrow"},L.locale)}),t.jsx("span",{className:Be("flex h-4 min-w-4 items-center justify-center px-1 text-[11px] tabular-nums",ke?"bg-blue-9 rounded-full font-semibold text-white":"text-slate-11"),
53children:Te.getDate()})]},o[$e])},e[67]=L,e[68]=o,e[69]=N,e[70]=K):K=e[70],we=s.map(K),e[62]=L,e[63]=o,e[64]=s,e[65]=N,e[66]=we}else we=e[66];let et;e[71]!==Ke||e[72]!==Ve||e[73]!==we?(et=t.jsxs("div",{style:Ke,children:[Ve,we]}),e[71]=Ke,e[72]=Ve,e[73]=we,e[74]=et):et=e[74];let tt;e[75]!==Le||e[76]!==et?(tt=t.jsxs("div",{className:"bg-background sticky top-0 z-5",children:[Le,et]}),e[75]=Le,e[76]=et,e[77]=tt):tt=e[77];let Xe;e[78]!==f||e[79]!==l||e[80]!==r||e[81]!==v||e[82]!==Z||e[83]!==n||e[84]!==le||e[85]!==ue||e[86]!==Ce||e[87]!==c||e[88]!==d||e[89]!==ge||e[90]!==U||e[91]!==x||e[92]!==y||e[93]!==b||e[94]!==m||e[95]!==H||e[96]!==_||e[97]!==a||e[98]!==E||e[99]!==P?(Xe=b?t.jsx(sr,{gridTemplateColumns:U,dayCount:le}):t.jsxs(t.Fragment,{children:[v&&t.jsx(Ql,{openShiftsByDate:m}),!v&&Object.keys(c).length>0&&t.jsx(Ol,{openShiftsByDate:c,onEmployeeOpenShiftClick:H}),!x&&d.filter(K=>!(!K.isVisibleInRoster||y&&!Ce(K._id))).map(K=>{const Te=K.companyRoles.find(Yl);return t.jsx(ai,{employee:K,shiftsByDate:a[K._id]??{},absencesByDate:f[K._id]??{},availabilitiesByDate:r[K._id]??{},allLocationShifts:l[K._id]??[],quotaHours:ge(K._id),timeAccountBalance:E?.[K._id],weekdayQuotaMinutes:P?.[K._id],createRoleId:Te?._id},K._id)}),x&&n.map(K=>{if(_&&_.size>0&&!_.has(K._id))return null;const Te=d.filter(ke=>!(!ke.isVisibleInRoster||!ke.companyRoles.some(nt=>nt?._id===K._id)||y&&!ue(ke._id,K._id)));if(Te.length===0)return null;const $e=Z.has(K._id);return t.jsxs("div",{children:[t.jsx(En,{color:K.color,name:K.name,count:Te.length,open:!$e,onToggle:()=>_e(K._id),stickyLabelWidth:sn,className:"border-border border-t border-b"}),!$e&&Te.map(ke=>{const Qe=tr(a[ke._id],K._id);return t.jsx(ai,{employee:ke,shiftsByDate:Qe,absencesByDate:f[ke._id]??{},availabilitiesByDate:r[ke._id]??{},allLocationShifts:l[ke._id]??[],quotaHours:ge(ke._id),timeAccountBalance:E?.[ke._id],weekdayQuotaMinutes:P?.[ke._id],createRoleId:K._id},`${K._id}-${ke._id}`)})]},K._id)})]}),e[78]=f,e[79]=l,e[80]=r,e[81]=v,e[82]=Z,e[83]=n,e[84]=le,e[85]=ue,e[86]=Ce,e[87]=c,e[88]=d,e[89]=ge,e[90]=U,e[91]=x,e[92]=y,e[93]=b,e[94]=m,e[95]=H,e[96]=_,e[97]=a,e[98]=E,e[99]=P,e[100]=Xe):Xe=e[100];let ve;e[101]!==ze||e[102]!==tt||e[103]!==Xe?(ve=t.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t.jsxs("div",{className:"grid",style:ze,children:[tt,Xe]})}),e[101]=ze,e[102]=tt,e[103]=Xe,e[104]=ve):ve=e[104];let Ne;e[105]!==T||e[106]!==y||e[107]!==u?(Ne=y&&T>0&&t.jsx(Rn,{count:T,onShowAll:u}),e[105]=T,e[106]=y,e[107]=u,e[108]=Ne):Ne=e[108];let it;e[109]!==ve||e[110]!==Ne?(it=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[ve,Ne]}),e[109]=ve,e[110]=Ne,e[111]=it):it=e[111];let rt;return e[112]!==Me||e[113]!==it?(rt=t.jsx(Al,{value:Me,children:it}),e[112]=Me,e[113]=it,e[114]=rt):rt=e[114],rt}function Yl(i){return i?._id}function ql(i){return i.length>0}function Xl(i){return[i._id,i.name]}function Zl(i){return[i._id,i]}function Jl(i){return[i._id,i]}function er(i){return[i._id,i]}function tr(i,e){if(!i)return{};const s={};for(const[o,n]of Object.entries(i)){const d=n.filter(a=>a.companyRoleId===e);d.length>0&&(s[o]=d)}return s}function sr(i){const e=je.c(4),{gridTemplateColumns:s,dayCount:o}=i;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Array.from({length:8}),e[0]=n):n=e[0];let d;return e[1]!==o||e[2]!==s?(d=t.jsx(t.Fragment,{children:n.map((a,l)=>t.jsxs("div",{className:"min-h-[34px]",style:{display:"grid",gridTemplateColumns:s},children:[t.jsxs("div",{className:"border-border bg-slate-1 sticky left-0 z-3 flex flex-col justify-center gap-1 border-r border-b px-2.5 py-1",children:[t.jsx("div",{className:"bg-slate-3 h-3 w-24 animate-pulse rounded"}),t.jsx("div",{className:"bg-slate-3 h-2.5 w-16 animate-pulse rounded"})]}),Array.from({length:o}).map(nr)]},l))}),e[1]=o,e[2]=s,e[3]=d):d=e[3],d}function nr(i,e){return t.jsx("div",{className:"border-border border-r border-b"},e)}function ir(i){const e=je.c(78),{branches:s,selectedBranchId:o,weekStartStr:n,weekEndStr:d,isPublishing:a,onSelectedBranchesChange:l}=i,{i18n:f}=at();let r;e[0]!==s||e[1]!==d||e[2]!==n?(r=Ye(De.publication.getWeekPublishedForBranches,{startDate:n,endDate:d,branchIds:s.map(cr)}),e[0]=s,e[1]=d,e[2]=n,e[3]=r):r=e[3];const{data:m}=ut(r);let c;if(e[4]!==s||e[5]!==a||e[6]!==m){let E;e[8]!==a||e[9]!==m?(E=I=>{const P=m?.[I._id]??!1;return a?!P:P},e[8]=a,e[9]=m,e[10]=E):E=e[10],c=s.filter(E),e[4]=s,e[5]=a,e[6]=m,e[7]=c}else c=e[7];const h=c;let p;e[11]!==h||e[12]!==a||e[13]!==l||e[14]!==m||e[15]!==o?(p=()=>
53{if(!m)return[];if(o){const I=m[o]??!1,G=(a?!I:I)?[o]:[];return l(G),G}const E=h.map(rr);return l(E),E},e[11]=h,e[12]=a,e[13]=l,e[14]=m,e[15]=o,e[16]=p):p=e[16];const y=p;let g;e[17]!==y?(g=()=>y(),e[17]=y,e[18]=g):g=e[18];const[u,x]=ee.useState(g);let b;e[19]!==h||e[20]!==l?(b=E=>{const I=E.length>0?E:h.map(lr);x(I),l(I)},e[19]=h,e[20]=l,e[21]=b):b=e[21];const v=b;let j,w,C,D,_,S,N,B,A,R,F;if(e[22]!==s[0]||e[23]!==s.length||e[24]!==h||e[25]!==v||e[26]!==f||e[27]!==a||e[28]!==m||e[29]!==u){N=Symbol.for("react.early_return_sentinel");e:{const E=h.map(ar),I=s.length===1?s[0]:null;if(I){const G=m?.[I._id]??!1;let k;e[41]!==I.name?(k=t.jsx("span",{className:"font-medium",children:I.name}),e[41]=I.name,e[42]=k):k=e[42];let T;e[43]!==G?(T=G&&t.jsx("span",{className:"text-green-11 bg-green-3 rounded px-2 py-1 text-xs font-medium",children:t.jsx(J,{id:"publishWeek.status.currentlyPublished"})}),e[43]=G,e[44]=T):T=e[44];let W;e[45]!==k||e[46]!==T?(W=t.jsx("div",{className:"space-y-3",children:t.jsx("div",{className:"text-slate-11 text-sm",children:t.jsxs("div",{className:"flex items-center justify-between",children:[k,T]})})}),e[45]=k,e[46]=T,e[47]=W):W=e[47],N=W;break e}S="space-y-3",D="text-sm",e[48]!==a?(_=t.jsx("label",{className:"text-slate-12 mb-2 block font-medium",children:a?t.jsx(J,{id:"publishWeek.label.selectLocationsPublish"}):t.jsx(J,{id:"publishWeek.label.selectLocationsUnpublish"})}),e[48]=a,e[49]=_):_=e[49],w=sa,A=u,R=v,F=E;let P;e[50]!==h.length||e[51]!==f||e[52]!==u.length?(P=u.length===h.length?f._({id:"publishWeek.placeholder.allLocations"}):f._({id:"publishWeek.placeholder.selectLocations"}),e[50]=h.length,e[51]=f,e[52]=u.length,e[53]=P):P=e[53],e[54]!==P?(C=t.jsx(na,{children:t.jsx(ia,{placeholder:P})}),e[54]=P,e[55]=C):C=e[55],j=oa,B=E.map(or)}e[22]=s[0],e[23]=s.length,e[24]=h,e[25]=v,e[26]=f,e[27]=a,e[28]=m,e[29]=u,e[30]=j,e[31]=w,e[32]=C,e[33]=D,e[34]=_,e[35]=S,e[36]=N,e[37]=B,e[38]=A,e[39]=R,e[40]=F}else j=e[30],w=e[31],C=e[32],D=e[33],_=e[34],S=e[35],N=e[36],B=e[37],A=e[38],R=e[39],F=e[40];if(N!==Symbol.for("react.early_return_sentinel"))return N;let H;e[56]!==j||e[57]!==B?(H=t.jsx(j,{children:B}),e[56]=j,e[57]=B,e[58]=H):H=e[58];let M;e[59]!==w||e[60]!==C||e[61]!==H||e[62]!==A||e[63]!==R||e[64]!==F?(M=t.jsxs(w,{value:A,onValueChange:R,items:F,children:[C,H]}),e[59]=w,e[60]=C,e[61]=H,e[62]=A,e[63]=R,e[64]=F,e[65]=M):M=e[65];let O;e[66]!==D||e[67]!==_||e[68]!==M?(O=t.jsxs("div",{className:D,children:[_,M]}),e[66]=D,e[67]=_,e[68]=M,e[69]=O):O=e[69];let Q;e[70]!==h.length||e[71]!==f||e[72]!==u.length?(Q=u.length>0&&t.jsx("div",{className:"text-slate-11 bg-slate-3 rounded-md p-3 text-sm",children:f._({id:"publishWeek.selectedSummary",message:"{selected} of {total, plural, one {# branch} other {# branches}} selected",values:{selected:u.length,total:h.length}})}),e[70]=h.length,e[71]=f,e[72]=u.length,e[73]=Q):Q=e[73];let $;return e[74]!==S||e[75]!==O||e[76]!==Q?($=t.jsxs("div",{className:S,children:[O,Q]}),e[74]=S,e[75]=O,e[76]=Q,e[77]=$):$=e[77],$}function or(i){return t.jsx(ta,{value:i.value,children:i.label},i.value)}function ar(i){return{value:i._id,label:i.name}}function lr(i){return i._id}function rr(i){return i._id}function cr(i){return i._id}function oo(i){const e=je.c(10),{branches:s,selectedBranchId:o}=i,{i18n:n}=at(),{confirm:d,ConfirmationDialog:a}=Pi();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[0]=l):l=e[0];const f=ee.useRef(l);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=y=>{f.current=y},e[1]=r):r=e[1];const m=r;let c;e[2]!==s||e[3]!==d||e[4]!==n||e[5]!==o?(c=y=>{const{startOfWeekDate:g,weekStartStr:u,weekEndStr:x,isWeekPublished:b,conflictShiftCount:v,onConfirm:j}=y;f.current=o?[o]:s.map(dr),d({title:b?n._({id:"roster.publish.confirmTitle.unpublish"}):n._({id:"roster.publish.confirmTitle.publish"}),message:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"text-sm leading-relaxed",children:[b?t.jsx("p",{children:t.jsx(J,{id:"roster.publish.confirmBody.unpublish"})}):t.jsx("p",{children:t.jsx(J,{id:"roster.publish.confirmBody.publish"})}),t.jsxs("p",{className:"text-slate-11 mt-2",children:[We(g,{weekday:"short",month:"short",day:"numeric"},n.locale)," â ",We(jt(g,6),{weekday:"short",month:"short",day:"numeric"},n.locale)]})]}),!b&&t.jsx(Ko,{weekStartStr:u,conflictShiftCount:v}),t.jsx(ir,{branches:s,selectedBranchId:o,weekStartStr:u,weekEndStr:x,isPublishing:!b,onSelectedBranchesChange:m})]}),actions:[{label:b?n._({id:"roster.publish.action.makePrivate"}):n._({id:"roster.publish.action.makePublic"}),icon:b?t.jsx(Qs,{className:"h-4 w-4"}):t.jsx(Vs,{className:"h-4 w-4"}),onClick:async()=>{await j({published:!b,branchIds:f.current})}}]})},e[2]=s,e[3]=d,e[4]=n,e[5]=o,e[6]=c):c=e[6];const h=c;let p;return e[7]!==a||e[8]!==h?(p={openPublishWeekDialog:h,PublishWeekConfirmationDialog:a},e[7]=a,e[8]=h,e[9]=p):p=e[9],p}function dr(i){return i._id}function mr({result:i,args:e,weekStartStr:s,weekEndStr:o}){return{name:i.results.filter(d=>d.published).length>0?"week_published":"week_unpublished",properties:{userId:i.userId,organizationId:i.organizationId,startDate:s??e.startDate,endD
53ate:o??e.endDate,branchCount:i.results.length}}}function ao(i){const e=je.c(16);let s;e[0]!==i?(s=i===void 0?{}:i,e[0]=i,e[1]=s):s=e[1];const{weekStartStr:o,weekEndStr:n}=s,{i18n:d}=at(),a=xi(),l=ps(),f=ss(De.publication.setWeekPublished);let r;e[2]!==f?(r=p=>f(p),e[2]=f,e[3]=r):r=e[3];let m;e[4]!==l||e[5]!==d||e[6]!==n||e[7]!==o?(m=(p,y)=>{const g=p.results.filter(fr).length,u=p.results.length;if(u===0){St.error(d._({id:"weekPublication.toast.noBranchesSelected",message:"No locations selected"}));return}g>0?St.success(u===1?d._({id:"weekPublication.toast.weekPublic",message:"Week is now public"}):d._({id:"weekPublication.toast.branchesPublished",message:"{count, plural, one {# branch} other {# branches}} published",values:{count:g}})):St.success(u===1?d._({id:"weekPublication.toast.weekPrivate",message:"Week is now private"}):d._({id:"weekPublication.toast.branchesUnpublished",message:"{count, plural, one {# branch} other {# branches}} unpublished",values:{count:u}}));const x=mr({result:p,args:y,weekStartStr:o,weekEndStr:n});l.capture(x.name,x.properties)},e[4]=l,e[5]=d,e[6]=n,e[7]=o,e[8]=m):m=e[8];let c;e[9]!==l||e[10]!==a?(c=p=>{const y=a(p);St.error(y),l.capture("week_publish_toggle_failed",{reason:y})},e[9]=l,e[10]=a,e[11]=c):c=e[11];let h;return e[12]!==r||e[13]!==m||e[14]!==c?(h={mutationFn:r,onSuccess:m,onError:c},e[12]=r,e[13]=m,e[14]=c,e[15]=h):h=e[15],es(h)}function fr(i){return i.published}function Ln(i,e,s){const o=je.c(19);let n,d,a,l;o[0]!==e||o[1]!==i?(l=Oe(i,Je),a=Oe(jt(i,6),Je),n=ut,d=Ye(De.publication.getWeekPublishedForBranches,{startDate:l,endDate:a,branchIds:e.map(hr)}),o[0]=e,o[1]=i,o[2]=n,o[3]=d,o[4]=a,o[5]=l):(n=o[2],d=o[3],a=o[4],l=o[5]);const{data:f}=n(d);let r;o[6]!==f?(r=f?Object.values(f).filter(Boolean).length:0,o[6]=f,o[7]=r):r=o[7];const m=r,c=s?f?.[s]??!1:m>0&&m===e.length;let h;o[8]!==a||o[9]!==l?(h={weekStartStr:l,weekEndStr:a},o[8]=a,o[9]=l,o[10]=h):h=o[10];const p=ao(h);let y;return o[11]!==e.length||o[12]!==c||o[13]!==f||o[14]!==m||o[15]!==p||o[16]!==a||o[17]!==l?(y={isWeekPublished:c,publishedByBranch:f,publishedCount:m,totalBranches:e.length,setWeekPublishedMutation:p,weekStartStr:l,weekEndStr:a},o[11]=e.length,o[12]=c,o[13]=f,o[14]=m,o[15]=p,o[16]=a,o[17]=l,o[18]=y):y=o[18],y}function hr(i){return i._id}function lo(i){const e=je.c(51),{id:s,data:o,children:n,className:d,onClick:a}=i,l=`${s}-move`,f=`${s}-copy`;let r;e[0]!==o?(r={...o,operation:"move"},e[0]=o,e[1]=r):r=e[1];const m=r;let c;e[2]!==o?(c={...o,operation:"copy"},e[2]=o,e[3]=c):c=e[3];const h=c;let p;e[4]!==m||e[5]!==l?(p={id:l,data:m},e[4]=m,e[5]=l,e[6]=p):p=e[6];const{isOver:y,setNodeRef:g}=ms(p);let u;e[7]!==h||e[8]!==f?(u={id:f,data:h},e[7]=h,e[8]=f,e[9]=u):u=e[9];const{isOver:x,setNodeRef:b}=ms(u),v=x||y;let j;e[10]!==d?(j=Be("group relative",d),e[10]=d,e[11]=j):j=e[11];let w;e[12]!==n?(w=t.jsx("div",{className:"flex min-h-[60px] min-w-0 flex-col gap-1",children:n}),e[12]=n,e[13]=w):w=e[13];const C=v?"pointer-events-auto opacity-100":"pointer-events-none opacity-0";let D;e[14]!==C?(D=Be("absolute inset-0 grid grid-cols-2 transition-opacity",C),e[14]=C,e[15]=D):D=e[15];const _=y&&"bg-blue-3/90 text-blue-11";let S;e[16]!==_?(S=Be("bg-blue-1/90 text-slate-11 relative flex items-center justify-center rounded-l-xl transition-colors","border-slate-6/30 border-r",_),e[16]=_,e[17]=S):S=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=Be("flex items-center justify-center"),e[18]=N):N=e[18];const B=y&&"drop-shadow-md";let A;e[19]!==B?(A=Be("h-8 w-8 transition-none duration-150",B),e[19]=B,e[20]=A):A=e[20];let R;e[21]!==A?(R=t.jsx("div",{className:N,children:t.jsx(Dn,{className:A})}),e[21]=A,e[22]=R):R=e[22];let F;e[23]!==g||e[24]!==S||e[25]!==R?(F=t.jsx("div",{ref:g,className:S,children:R}),e[23]=g,e[24]=S,e[25]=R,e[26]=F):F=e[26];const H=x&&"bg-green-3/90 text-green-11";let M;e[27]!==H?(M=Be("bg-green-1/90 text-slate-11 relative flex items-center justify-center rounded-r-xl transition-colors",H),e[27]=H,e[28]=M):M=e[28];let O;e[29]===Symbol.for("react.memo_cache_sentinel")?(O=Be("flex items-center justify-center"),e[29]=O):O=e[29];const Q=x&&"drop-shadow-md";let $;e[30]!==Q?($=Be("h-8 w-8",Q),e[30]=Q,e[31]=$):$=e[31];let E;e[32]!==$?(E=t.jsx("div",{className:O,children:t.jsx(Cn,{className:$})}),e[32]=$,e[33]=E):E=e[33];let I;e[34]!==b||e[35]!==M||e[36]!==E?(I=t.jsx("div",{ref:b,className:M,children:E}),e[34]=b,e[35]=M,e[36]=E,e[37]=I):I=e[37];const P=y?"hsl(206 100% 50%)":x?"hsl(151 55% 41.5%)":"hsl(206 6% 56%)";let G;e[38]!==v||e[39]!==P?(G=t.jsx(no,{isActive:v,strokeColor:P,strokeWidth:2,dashLength:8,gapLength:4,animationDuration:"70s",className:"col-span-2",borderRadius:10}),e[38]=v,e[39]=P,e[40]=G):G=e[40];let k;e[41]!==F||e[42]!==I||e[43]!==G||e[44]!==D?(k=t.jsxs("div",{className:D,children:[F,I,G]}),e[41]=F,e[42]=I,e[43]=G,e[44]=D,e[45]=k):k=e[45];let T;return e[46]!==a||e[47]!==k||e[48]!==j||e[49]!==w?(T=t.jsxs("div",{className:j,onClick:a,children:[w,
53k]}),e[46]=a,e[47]=k,e[48]=j,e[49]=w,e[50]=T):T=e[50],T}const ur=190;function us(i){const e=Math.max(i-1,0);return`${ur}px repeat(${e}, minmax(0, 1fr))`}function ro(i){const e=je.c(13),{title:s,description:o,tooltipContent:n,tooltipAriaLabel:d}=i;let a;e[0]!==s?(a=t.jsx("span",{className:"truncate text-sm font-medium",children:s}),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==d||e[3]!==n?(l=n?t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(bt,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground size-8 shrink-0 rounded-full","aria-label":d,children:t.jsx(Ni,{className:"size-4"})})}),t.jsx(ht,{className:"max-w-64 leading-relaxed",children:n})]}):null,e[2]=d,e[3]=n,e[4]=l):l=e[4];let f;e[5]!==a||e[6]!==l?(f=t.jsxs("div",{className:"flex items-center gap-1",children:[a,l]}),e[5]=a,e[6]=l,e[7]=f):f=e[7];let r;e[8]!==o?(r=t.jsx("span",{className:"text-muted-foreground text-xs leading-4",children:o}),e[8]=o,e[9]=r):r=e[9];let m;return e[10]!==f||e[11]!==r?(m=t.jsxs("div",{className:"border-border bg-slate-1 text-slate-12 flex min-h-[60px] flex-col items-start justify-start gap-0.5 border-x px-3 py-2 text-left",children:[f,r]}),e[10]=f,e[11]=r,e[12]=m):m=e[12],m}function pr(i){const e=je.c(41),{visibleDays:s,columnCount:o,openShiftsByDay:n,companyRoles:d,activeShift:a,onOpenShiftClick:l,onCreateOpenShiftClick:f,addressById:r,tagById:m}=i,{i18n:c}=at();let h;e[0]!==n?(h=n.flat(),e[0]=n,e[1]=h):h=e[1];const p=h.length;let y;e[2]!==c?(y=c._({id:"openShifts.manager.tooltip",message:"Open shifts are unassigned shifts made available to eligible employees. Depending on your organization's settings, employees either take them instantly or apply for approval."}),e[2]=c,e[3]=y):y=e[3];const g=y;let u;e[4]!==c?(u=c._({id:"openShifts.whatAria"}),e[4]=c,e[5]=u):u=e[5];const x=u;let b;e[6]!==o?(b=us(o),e[6]=o,e[7]=b):b=e[7];let v;e[8]!==b?(v={gridTemplateColumns:b},e[8]=b,e[9]=v):v=e[9];let j;e[10]!==c?(j=c._({id:"openShifts.rowTitle"}),e[10]=c,e[11]=j):j=e[11];let w;e[12]!==c||e[13]!==p?(w=p>0?c._({id:"openShifts.manager.countUnassigned",message:"{count, plural, one {# unassigned shift} other {# unassigned shifts}}",values:{count:p}}):c._({id:"openShifts.manager.clickToAdd",message:"Click a day to add one"}),e[12]=c,e[13]=p,e[14]=w):w=e[14];let C;e[15]!==g||e[16]!==x||e[17]!==j||e[18]!==w?(C=t.jsx(ro,{title:j,description:w,tooltipContent:g,tooltipAriaLabel:x}),e[15]=g,e[16]=x,e[17]=j,e[18]=w,e[19]=C):C=e[19];let D;if(e[20]!==a||e[21]!==r||e[22]!==d||e[23]!==f||e[24]!==l||e[25]!==n||e[26]!==m||e[27]!==s){let S;e[29]!==a||e[30]!==r||e[31]!==d||e[32]!==f||e[33]!==l||e[34]!==n||e[35]!==m?(S=N=>{const B=n[N.index]??[],A={assignedEmployeeId:void 0,date:Oe(N.date,Je)};return t.jsxs(lo,{id:`open-shifts-${N.index}`,data:A,className:"border-border grid auto-rows-max gap-0.5",onClick:()=>f({date:N.date}),children:[B.length===0&&t.jsx("div",{className:"text-muted-foreground flex min-h-[60px] cursor-pointer items-center justify-center px-2 text-center text-xs",children:t.jsx(J,{id:"openShifts.addOpenShift"})}),B.map((R,F)=>{const H=d.find(O=>O._id===R.companyRoleId),M=yt(R);return t.jsx(_i,{shift:R,companyRoleName:H?.name??"",color:H?.color??"slate",onClick:O=>{O.stopPropagation(),l(R)},dragId:`${M}-open-shift-drag`,dragState:a&&yt(a)===M?"ghost":"default",animationIndex:F,roleLabelVisibility:"visible",addressById:r,tagById:m},M)})]},`open-shifts-${N.index}`)},e[29]=a,e[30]=r,e[31]=d,e[32]=f,e[33]=l,e[34]=n,e[35]=m,e[36]=S):S=e[36],D=s.map(S),e[20]=a,e[21]=r,e[22]=d,e[23]=f,e[24]=l,e[25]=n,e[26]=m,e[27]=s,e[28]=D}else D=e[28];let _;return e[37]!==v||e[38]!==C||e[39]!==D?(_=t.jsxs("div",{className:"border-border grid min-h-[60px] border-r border-b",style:v,children:[C,D]}),e[37]=v,e[38]=C,e[39]=D,e[40]=_):_=e[40],_}function yr(i){const e=je.c(46),{visibleDays:s,columnCount:o,openShiftsByDay:n,companyRoleNameById:d,onOpenShiftClick:a,addressById:l,tagById:f}=i,{i18n:r}=at();let m,c,h,p,y,g,u;if(e[0]!==o||e[1]!==r||e[2]!==n){const j=n.flat().length;let w;e[10]!==r?(w=r._({id:"openShifts.manager.tooltip",message:"Open shifts are unassigned shifts made available to eligible employees. Depending on your organization's settings, employees either take them instantly or apply for approval."}),e[10]=r,e[11]=w):w=e[11],c=w;let C;
53e[12]!==r?(C=r._({id:"openShifts.whatAria"}),e[12]=r,e[13]=C):C=e[13],h=C,g="border-border grid min-h-[60px] border-r border-b";let D;e[14]!==o?(D=us(o),e[14]=o,e[15]=D):D=e[15],e[16]!==D?(u={gridTemplateColumns:D},e[16]=D,e[17]=u):u=e[17],m=ro,e[18]!==r?(p=r._({id:"openShifts.rowTitle"}),e[18]=r,e[19]=p):p=e[19],y=r._({id:"openShifts.employee.shiftsAvailable",message:"{count, plural, one {# shift available} other {# shifts available}}",values:{count:j}}),e[0]=o,e[1]=r,e[2]=n,e[3]=m,e[4]=c,e[5]=h,e[6]=p,e[7]=y,e[8]=g,e[9]=u}else m=e[3],c=e[4],h=e[5],p=e[6],y=e[7],g=e[8],u=e[9];let x;e[20]!==m||e[21]!==c||e[22]!==h||e[23]!==p||e[24]!==y?(x=t.jsx(m,{title:p,description:y,tooltipContent:c,tooltipAriaLabel:h}),e[20]=m,e[21]=c,e[22]=h,e[23]=p,e[24]=y,e[25]=x):x=e[25];let b;if(e[26]!==l||e[27]!==d||e[28]!==r||e[29]!==a||e[30]!==n||e[31]!==f||e[32]!==s){let j;e[34]!==l||e[35]!==d||e[36]!==r||e[37]!==a||e[38]!==n||e[39]!==f?(j=w=>{const C=n[w.index]??[];return t.jsx("div",{className:Be("border-border grid auto-rows-max gap-0.5 p-0.5"),children:C.length===0?t.jsx("div",{className:"text-muted-foreground flex min-h-[60px] items-center justify-center px-2 text-center text-xs",children:t.jsx(J,{id:"openShifts.noOpenShifts"})}):C.map((D,_)=>t.jsx(Lo,{shift:jn(D),companyRoleName:D.companyRoleId?d[D.companyRoleId]:"",onClick:()=>a(D),animationIndex:_,roleLabelVisibility:"visible",statusLabel:D.applicationStatus==="pending"?r._({id:"openShift.applied"}):void 0,addressById:l,tagById:f},D.shiftKey))},`employee-open-shifts-${w.index}`)},e[34]=l,e[35]=d,e[36]=r,e[37]=a,e[38]=n,e[39]=f,e[40]=j):j=e[40],b=s.map(j),e[26]=l,e[27]=d,e[28]=r,e[29]=a,e[30]=n,e[31]=f,e[32]=s,e[33]=b}else b=e[33];let v;return e[41]!==g||e[42]!==u||e[43]!==x||e[44]!==b?(v=t.jsxs("div",{className:g,style:u,children:[x,b]}),e[41]=g,e[42]=u,e[43]=x,e[44]=b,e[45]=v):v=e[45],v}function gr({employees:i,hideEmptyRows:e,roleId:s,shiftsByEmployeeAndDay:o}){return i.filter(n=>n.companyRoles.some(a=>a?._id===s)?e?o[n._id]?.some(a=>a.some(l=>l.companyRoleId===s))??!1:!0:!1)}function xr({absencesByEmployeeAndDay:i,availabilitiesByEmployeeAndDay:e,employeesForRole:s,roleId:o,shiftsByEmployeeAndDay:n}){let d=!1,a=!1,l=!1;for(const f of s){const r=n[f._id];if(r)for(const[m,c]of r.entries()){const h=c.filter(g=>g.companyRoleId===o);if(h.length===0)continue;h.some(g=>g.overlappingShifts&&g.overlappingShifts.length>0)&&(d=!0),(i[f._id]?.[m]??[]).length>0&&(a=!0);const y=(e[f._id]?.[m]??[]).filter(g=>g.kind==="unavailable");if(y.length>0&&h.some(g=>Xs(g,y))&&(l=!0),d&&a&&l)return{hasAbsenceConflicts:a,hasAvailabilityConflicts:l,hasOverlappingShifts:d}}}return{hasAbsenceConflicts:a,hasAvailabilityConflicts:l,hasOverlappingShifts:d}}function br({employee:i,roles:e}){const s=new Set(i.companyRoles.map(o=>o?._id).filter(Boolean));return e.find(o=>s.has(o._id))?._id}function Sr({employees:i,...e}){return i.map(s=>t.jsx(jr,{employee:s,...e},s._id))}function jr(i){const e=je.c(44),{activeShift:s,addressById:o,allLocationGroupShiftsByEmployeeAndDay:n,branchNameById:d,canCreateShifts:a,columnCount:l,companyRoles:f,employee:r,getEmployeeWeeklyQuotaHours:m,groupAbsencesByEmployeeAndDay:c,groupAvailabilitiesByEmployeeAndDay:h,groupShiftsByEmployeeAndDay:p,onCreateShiftClick:y,onEmployeeClick:g,onShiftClick:u,onAbsenceClick:x,onAvailabilityClick:b,selectedBranchId:v,showShiftBranchName:j,tagById:w,timeAccountBalances:C,weekdayQuotaMinutesById:D,visibleDays:_,week:S}=i,[N,B]=ee.useState(!1),A=D?.[r._id];let R,F,H;if(e[0]!==n||e[1]!==d||e[2]!==r._id||e[3]!==m||e[4]!==p||e[5]!==v){F=p[r._id]||[];const Q=n[r._id]||[];R=Vi(Q.flat()||[],m(r._id)),H=Mn({allShifts:Q.flat()||[],visibleShifts:F.flat()||[],branchNameById:d,selectedBranchId:v}),e[0]=n,e[1]=d,e[2]=r._id,e[3]=m,e[4]=p,e[5]=v,e[6]=R,e[7]=F,e[8]=H}else R=e[6],F=e[7],H=e[8];const M=H;let O;if(e[9]!==s||e[10]!==o||e[11]!==d||e[12]!==a||e[13]!==l||e[14]!==f||e[15]!==r||e[16]!==R||e[17]!==F||e[18]!==c||e[19]!==h||e[20]!==M||e[21]!==x||e[22]!==b||e[23]!==y||e[24]!==g||e[25]!==u||e[26]!==N||e[27]!==j||e[28]!==w||e[29]!==C||e[30]!==_||e[31]!==S||e[32]!==A){const Q=r.companyRoles.find(wr);let $;e[34]!==l?($=us(l),e[34]=l,e[35]=$):$=e[35];let E;e[36]!==$?(E={gridTemplateColumns:$},e[36]=$,e[37]=E):E=e[37];const I=C?.[r._id];let P;e[38]!==r||e[39]!==R||e[40]!==M||e[41]!==g||e[42]!==I?(P=t.jsx(co,{employee:r,employeeHours:R,locationBreakdown:M,onEmployeeClick:g,onHoverChange:B,timeAccountBalance:I}),e[38]=r,e[39]=R,e[40]=M,e[41]=g,e[42]=I,e[43]=P):P=e[43],O=t.jsxs("div",{className:"border-border grid min-h-[60
53px] border-r border-b",style:E,children:[P,_.map(G=>{const k=F[G.index]||[],T=A?.[In(G.date)],W=c[r._id]?.[G.index]??[],L=h[r._id]?.[G.index]??[],q=W.some(vr),Z=Oe(G.date,Je),ne=t.jsx(fo,{activeShift:s,addressById:o,branchNameById:d,companyRoles:f,dayAvailabilities:L,dayShifts:k,hasAbsenceConflicts:q,onShiftClick:u,roleLabelVisibility:"visible",showShiftBranchName:j,tagById:w});if(!Q)return t.jsx(Ir,{availabilities:L,absences:W,onAbsenceClick:x,onAvailabilityClick:b,dailyQuotaMinutes:T,showDailyQuota:N,children:ne},`${S}-${G.index}-${r._id}`);const Y=a&&k.length===0;return t.jsx(mo,{id:`drop-${r._id}-${G.index}`,data:{assignedEmployeeId:r._id,date:Z},canCreateShifts:a,showAddShiftHoverAffordance:Y,absences:W,availabilities:L,onAbsenceClick:x,onAvailabilityClick:b,dailyQuotaMinutes:T,showDailyQuota:N,onClick:()=>y({employeeId:r._id,companyRoleId:Q._id,date:G.date}),children:ne},`${S}-${G.index}-${r._id}`)})]}),e[9]=s,e[10]=o,e[11]=d,e[12]=a,e[13]=l,e[14]=f,e[15]=r,e[16]=R,e[17]=F,e[18]=c,e[19]=h,e[20]=M,e[21]=x,e[22]=b,e[23]=y,e[24]=g,e[25]=u,e[26]=N,e[27]=j,e[28]=w,e[29]=C,e[30]=_,e[31]=S,e[32]=A,e[33]=O}else O=e[33];return O}function vr(i){return i.status==="approved"}function wr(i){return i?._id}function _r({employees:i,hideEmptyRows:e,roleFilterIds:s,...o}){return o.companyRoles.map(n=>{if(s&&s.size>0&&!s.has(n._id))return null;const d=gr({employees:i,hideEmptyRows:e,roleId:n._id,shiftsByEmployeeAndDay:o.groupShiftsByEmployeeAndDay});return d.length===0?null:t.jsx(kr,{companyRole:n,employeesForRole:d,...o},n._id)})}function kr(i){const e=je.c(48),{activeShift:s,addressById:o,allLocationGroupShiftsByEmployeeAndDay:n,branchNameById:d,canCreateShifts:a,columnCount:l,companyRole:f,companyRoles:r,employeesForRole:m,getEmployeeWeeklyQuotaHours:c,groupAbsencesByEmployeeAndDay:h,groupAvailabilitiesByEmployeeAndDay:p,groupShiftsByEmployeeAndDay:y,onCreateShiftClick:g,onEmployeeClick:u,onShiftClick:x,onAbsenceClick:b,onAvailabilityClick:v,selectedBranchId:j,showShiftBranchName:w,tagById:C,timeAccountBalances:D,weekdayQuotaMinutesById:_,visibleDays:S,week:N}=i,[B,A]=ee.useState(!0),[R,F]=ee.useState(null);let H;e[0]!==f._id||e[1]!==m||e[2]!==h||e[3]!==p||e[4]!==y?(H=xr({absencesByEmployeeAndDay:h,availabilitiesByEmployeeAndDay:p,employeesForRole:m,roleId:f._id,shiftsByEmployeeAndDay:y}),e[0]=f._id,e[1]=m,e[2]=h,e[3]=p,e[4]=y,e[5]=H):H=e[5];const{hasAbsenceConflicts:M,hasAvailabilityConflicts:O,hasOverlappingShifts:Q}=H;let $;e[6]===Symbol.for("react.memo_cache_sentinel")?($=()=>A(Dr),e[6]=$):$=e[6];let E;e[7]!==M||e[8]!==O||e[9]!==Q?(E=t.jsx(Tr,{hasAbsenceConflicts:M,hasAvailabilityConflicts:O,hasOverlappingShifts:Q}),e[7]=M,e[8]=O,e[9]=Q,e[10]=E):E=e[10];let I;e[11]!==f.color||e[12]!==f.name||e[13]!==m.length||e[14]!==B||e[15]!==E?(I=t.jsx(En,{color:f.color,name:f.name,count:m.length,open:B,onToggle:$,trailing:E,className:"border-x border-b"}),e[11]=f.color,e[12]=f.name,e[13]=m.length,e[14]=B,e[15]=E,e[16]=I):I=e[16];let P;e[17]!==s||e[18]!==o||e[19]!==n||e[20]!==d||e[21]!==a||e[22]!==l||e[23]!==f||e[24]!==r||e[25]!==m||e[26]!==c||e[27]!==h||e[28]!==p||e[29]!==y||e[30]!==R||e[31]!==b||e[32]!==v||e[33]!==g||e[34]!==u||e[35]!==x||e[36]!==B||e[37]!==j||e[38]!==w||e[39]!==C||e[40]!==D||e[41]!==S||e[42]!==N||e[43]!==_?(P=B&&m.map(k=>{if(!k.isVisibleInRoster)return null;const T=y[k._id]?.flat()||[],W=n[k._id]?.flat()||[],L=Vi(W,c(k._id)),q=Mn({allShifts:W,visibleShifts:T,branchNameById:d,selectedBranchId:j}),Z=br({employee:k,roles:r})===f._id,ne=_?.[k._id],Y=R===k._id;return t.jsxs("div",{className:"border-border grid min-h-[60px] border-r border-b",style:{gridTemplateColumns:us(l)},children:[t.jsx(co,{employee:k,employeeHours:L,locationBreakdown:q,onEmployeeClick:u,onHoverChange:ae=>F(ae?k._id:null),timeAccountBalance:D?.[k._id]}),y[k._id].map((ae,le)=>{const U=S.find(fe=>fe.index===le);if(!U)return null;const te=Z?h[k._id]?.[le]??[]:[],se=Z?p[k._id]?.[le]??[]:[],oe=te.some(Cr),be=ae.filter(fe=>fe.companyRoleId===f._id),ie=a&&be.length===0;return t.jsx(mo,{id:`drop-${k._id}-${le}-${f._id}-${Oe(U.date,Je)}`,data:{assignedEmployeeId:k._id,companyRoleId:f._id,date:Oe(U.date,Je)},canCreateShifts:a,showAddShiftHoverAffordance:ie,absences:te,availabilities:se,onAbsenceClick:b,onAvailabilityClick:v,dailyQuotaMinutes:ne?.[In(U.date)],showDailyQuota:Y,onClick:()=>g({employeeId:k._id,companyRoleId:f._id,date:U.date}),children:t.jsx(fo,{activeShift:s,addressById:o,branchNameById:d,companyRoles:[f],dayAvailabilities:se,dayShifts:be,hasAbsenceConflicts:oe,onShiftClick:x,showShiftBranchName:w,tagById:C})},`${N}-${le}-${k._id}`)}
53).filter(Boolean)]},k._id)}),e[17]=s,e[18]=o,e[19]=n,e[20]=d,e[21]=a,e[22]=l,e[23]=f,e[24]=r,e[25]=m,e[26]=c,e[27]=h,e[28]=p,e[29]=y,e[30]=R,e[31]=b,e[32]=v,e[33]=g,e[34]=u,e[35]=x,e[36]=B,e[37]=j,e[38]=w,e[39]=C,e[40]=D,e[41]=S,e[42]=N,e[43]=_,e[44]=P):P=e[44];let G;return e[45]!==I||e[46]!==P?(G=t.jsxs("div",{children:[I,P]}),e[45]=I,e[46]=P,e[47]=G):G=e[47],G}function Cr(i){return i.status==="approved"}function Dr(i){return!i}function co(i){const e=je.c(23),{employee:s,employeeHours:o,locationBreakdown:n,onEmployeeClick:d,onHoverChange:a,timeAccountBalance:l}=i;let f;e[0]!==s._id||e[1]!==d?(f=()=>d(s._id),e[0]=s._id,e[1]=d,e[2]=f):f=e[2];let r,m;e[3]!==a?(r=()=>a?.(!0),m=()=>a?.(!1),e[3]=a,e[4]=r,e[5]=m):(r=e[4],m=e[5]);let c;e[6]!==s._id?(c=JSON.stringify({employeeId:s._id}),e[6]=s._id,e[7]=c):c=e[7];let h;e[8]!==s.name?(h=t.jsx("span",{className:"text-slate-12 min-w-0 truncate text-sm font-medium",title:s.name,children:s.name}),e[8]=s.name,e[9]=h):h=e[9];let p;e[10]!==o.credited||e[11]!==o.overtime||e[12]!==o.quota||e[13]!==n||e[14]!==h||e[15]!==l?(p=t.jsx(Bn,{period:"week",layout:"stacked",scheduledHours:o.credited,quotaHours:o.quota,delta:o.overtime,locationBreakdown:n,timeAccountBalanceMinutes:l,name:h}),e[10]=o.credited,e[11]=o.overtime,e[12]=o.quota,e[13]=n,e[14]=h,e[15]=l,e[16]=p):p=e[16];let y;return e[17]!==f||e[18]!==r||e[19]!==m||e[20]!==c||e[21]!==p?(y=t.jsx("div",{className:"border-border bg-slate-1 text-slate-12 flex cursor-pointer flex-col justify-center border-x px-1.5 py-1.5",onClick:f,onMouseEnter:r,onMouseLeave:m,id:c,children:p}),e[17]=f,e[18]=r,e[19]=m,e[20]=c,e[21]=p,e[22]=y):y=e[22],y}function mo(i){const e=je.c(27),{absences:s,availabilities:o,canCreateShifts:n,children:d,data:a,id:l,onClick:f,onAbsenceClick:r,onAvailabilityClick:m,showAddShiftHoverAffordance:c,dailyQuotaMinutes:h,showDailyQuota:p}=i,y=p===void 0?!1:p,g=n&&"cursor-pointer",u=c&&"hover:bg-slate-2/50 motion-reduce:transition-none";let x;e[0]!==g||e[1]!==u?(x=Be("border-border grid auto-rows-max gap-0.5 transition-colors",g,u),e[0]=g,e[1]=u,e[2]=x):x=e[2];let b;e[3]!==n||e[4]!==f?(b=()=>{n&&f()},e[3]=n,e[4]=f,e[5]=b):b=e[5];let v;e[6]!==c?(v=c&&t.jsx(Mr,{}),e[6]=c,e[7]=v):v=e[7];let j;e[8]!==s||e[9]!==r?(j=s.length>0&&t.jsx(ho,{absences:s,onAbsenceClick:r}),e[8]=s,e[9]=r,e[10]=j):j=e[10];let w;e[11]!==o||e[12]!==m?(w=o.length>0&&t.jsx(uo,{availabilities:o,onAvailabilityClick:m}),e[11]=o,e[12]=m,e[13]=w):w=e[13];let C;e[14]!==h||e[15]!==y?(C=t.jsx(Pn,{minutes:h,show:y}),e[14]=h,e[15]=y,e[16]=C):C=e[16];let D;return e[17]!==d||e[18]!==a||e[19]!==l||e[20]!==x||e[21]!==b||e[22]!==v||e[23]!==j||e[24]!==w||e[25]!==C?(D=t.jsxs(lo,{id:l,data:a,className:x,onClick:b,children:[v,j,w,d,C]}),e[17]=d,e[18]=a,e[19]=l,e[20]=x,e[21]=b,e[22]=v,e[23]=j,e[24]=w,e[25]=C,e[26]=D):D=e[26],D}function Ir(i){const e=je.c(14),{absences:s,availabilities:o,children:n,onAbsenceClick:d,onAvailabilityClick:a,dailyQuotaMinutes:l,showDailyQuota:f}=i,r=f===void 0?!1:f;let m;e[0]!==s||e[1]!==d?(m=s.length>0&&t.jsx(ho,{absences:s,onAbsenceClick:d}),e[0]=s,e[1]=d,e[2]=m):m=e[2];let c;e[3]!==o||e[4]!==a?(c=o.length>0&&t.jsx(uo,{availabilities:o,onAvailabilityClick:a}),e[3]=o,e[4]=a,e[5]=c):c=e[5];let h;e[6]!==l||e[7]!==r?(h=t.jsx(Pn,{minutes:l,show:r}),e[6]=l,e[7]=r,e[8]=h):h=e[8];let p;return e[9]!==n||e[10]!==m||e[11]!==c||e[12]!==h?(p=t.jsxs("div",{className:"border-border relative grid auto-rows-max gap-0.5",children:[m,c,n,h]}),e[9]=n,e[10]=m,e[11]=c,e[12]=h,e[13]=p):p=e[13],p}function fo({activeShift:i,addressById:e,branchNameById:s,companyRoles:o,dayAvailabilities:n,dayShifts:d,hasAbsenceConflicts:a,onShiftClick:l,roleLabelVisibility:f,showShiftBranchName:r,tagById:m}){return d.map((c,h)=>{const p=o.find(u=>u._id===c.companyRoleId),y=yt(c),g=n.filter(u=>u.kind==="unavailable").filter(u=>Xs(c,[u]));return t.jsx(_i,{shift:c,companyRoleName:p?.name??"",color:p?.color??"",onClick:u=>{u.stopPropagation(),l(c)},dragId:y+"drag",dragState:i&&yt(i)===y?"ghost":"default",animationIndex:h,roleLabelVisibility:f,hasAbsenceConflict:a,hasAvailabilityConflict:g.length>0,availabilityConflictWindows:g.map(u=>({_id:u._id,isAllDay:u.isAllDay,startTime:u.startTime,endTime:u.endTime})),branchName:r?s[c.branchId]:void 0,addressById:e,tagById:m},y)})}function Tr(i){const e=je.c(5),{hasOverlappingShifts:s,hasAbsenceConflicts:o,hasAvailabilityConflicts:n}=i;
53if(!(s||o||n))return null;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(ft,{asChild:!0,children:t.jsx("div",{className:"flex-center bg-red-3 shrink-0 rounded-sm p-0.5",children:t.jsx(yn,{className:"text-red-11 size-3 stroke-2"})})}),e[0]=a):a=e[0];let l;return e[1]!==o||e[2]!==n||e[3]!==s?(l=t.jsxs(mt,{children:[a,t.jsx(ht,{children:t.jsx(Nr,{hasOverlappingShifts:s,hasAbsenceConflicts:o,hasAvailabilityConflicts:n})})]}),e[1]=o,e[2]=n,e[3]=s,e[4]=l):l=e[4],l}function Nr(i){const e=je.c(7),{hasOverlappingShifts:s,hasAbsenceConflicts:o,hasAvailabilityConflicts:n}=i,d=s,a=o,l=n;if(d&&a&&l){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("p",{children:t.jsx(J,{id:"roster.grid.roleConflict.oAndAAndU"})}),e[0]=r):r=e[0],r}if(d&&a&&!l){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("p",{children:t.jsx(J,{id:"roster.grid.roleConflict.oAndA"})}),e[1]=r):r=e[1],r}if(d&&!a&&l){let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("p",{children:t.jsx(J,{id:"roster.grid.roleConflict.oAndU"})}),e[2]=r):r=e[2],r}if(!d&&a&&l){let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("p",{children:t.jsx(J,{id:"roster.grid.roleConflict.aAndU"})}),e[3]=r):r=e[3],r}if(d&&!a&&!l){let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("p",{children:t.jsx(J,{id:"roster.grid.roleConflict.oOnly"})}),e[4]=r):r=e[4],r}if(!d&&!a&&l){let r;return e[5]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("p",{children:t.jsx(J,{id:"roster.grid.roleConflict.uOnly"})}),e[5]=r):r=e[5],r}let f;return e[6]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("p",{children:t.jsx(J,{id:"roster.grid.roleConflict.aOnly"})}),e[6]=f):f=e[6],f}function Mr(){const i=je.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center",children:t.jsx("div",{className:"bg-background text-foreground/50 flex size-7 scale-95 items-center justify-center rounded-full opacity-0 shadow-sm transition-[opacity,transform] duration-200 ease-out group-hover:scale-100 group-hover:opacity-100 motion-reduce:transition-none",children:t.jsx("span",{className:"text-base leading-none font-medium",children:"+"})})}),i[0]=e):e=i[0],e}function ho(i){const e=je.c(9),{absences:s,onAbsenceClick:o}=i,{i18n:n}=at(),d=gn();let a,l;if(e[0]!==s||e[1]!==d||e[2]!==n||e[3]!==o){const r=n._({id:"roster.grid.absence.defaultLabel"});a="flex flex-col gap-0.5 px-0.5 pt-0.5",l=s.map(m=>{const c=m.absenceType?.colorToken??"slate",h=d(m.absenceType,r),p=!!o;return t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsxs("div",{role:p?"button":void 0,tabIndex:p?0:void 0,className:Be("flex min-w-0 items-center gap-1 rounded-xs px-1 py-px",p&&"cursor-pointer hover:brightness-95"),style:{backgroundColor:`var(--${c}-3)`,opacity:m.status==="pending"?.82:1},onClick:y=>{y.stopPropagation(),o?.(m)},onKeyDown:y=>{p&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),o?.(m))},children:[t.jsx(Wi,{className:"size-3 shrink-0",style:{color:`var(--${c}-11)`}}),t.jsxs("span",{className:"min-w-0 truncate text-xs font-medium",style:{color:`var(--${c}-12)`},children:[m.reason?`${h} · ${m.reason}`:h,m.status==="pending"?t.jsxs(t.Fragment,{children:[" · ",t.jsx(J,{id:"roster.grid.absence.pending"})]}):null]})]})}),t.jsx(ht,{children:t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"font-medium",children:h}),m.status==="pending"?t.jsx("p",{className:"text-xs",children:t.jsx(J,{id:"roster.grid.absence.pending"})}):null,t.jsxs("p",{className:"text-xs",children:[We(new Date(m.startAt),{month:"short",day:"numeric"},n.locale)," â ",We(new Date(m.endAt),{month:"short",day:"numeric"},n.locale)]}),m.absenceType?.paid!==void 0&&t.jsx("p",{className:"text-xs",children:m.absenceType.paid?t.jsx(J,{id:"roster.grid.absence.paid"}):t.jsx(J,{id:"roster.grid.absence.unpaid"})}),m.reason&&t.jsx("p",{className:"max-w-[200px] text-xs italic",children:m.reason})]})})]},m._id)}),e[0]=s,e[1]=d,e[2]=n,e[3]=o,e[4]=a,e[5]=l}else a=e[4],l=e[5];let f;return e[6]!==a||e[7]!==l?(f=t.jsx("div",{className:a,children:l}),e[6]=a,e[7]=l,e[8]=f):f=e[8],f}function uo(i){const e=je.c(13),{availabilities:s,onAvailabilityClick:o}=i,{i18n:n}=at(),{formatRange:d,intlOptions:a}=Wt();let l;if(e[0]!==s||e[1]!==d||e[2]!==n||e[3]!==a||e[4]!==o){let r;e[6]!==d||e[7]!==n||e[8]!==a||e[9]!==o?(r=m=>{const c=m.kind==="available",{start:h,end:p}=yi(m),{start:y,end:g}=Mi(m),u=c?n._({id:"roster.grid.availability.available"}):n._({id:"roster.grid.availability.unavailable"}),x=m.isAllDay?n._({id:"roster.grid.availability.allDay"}):m.startTime&&m.endTime?d(m.startTime,m.endTime," - "):t.jsxs(t.Fragment,{children:[We(h,{timeStyle:"short",...a},n.locale)," - ",We(p,{timeStyle:"short",...a},n.locale)]}),b=!!o;return t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsxs("div",{role:b?"button":void 0,tabIndex:b?0:void 0,className:Be("flex min-w-0 items-center gap-1 rounded-xs px-1 py-px",c?"bg-green-3":"bg-amber-3",b&&"curs
53or-pointer hover:brightness-95"),onClick:v=>{v.stopPropagation(),o?.(m)},onKeyDown:v=>{b&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),v.stopPropagation(),o?.(m))},children:[c?t.jsx(ya,{className:"text-green-11 size-3 shrink-0"}):t.jsx(Da,{className:"text-amber-11 size-3 shrink-0"}),t.jsxs("span",{className:Be("min-w-0 truncate text-xs font-medium",c?"text-green-12":"text-amber-12"),children:[u," · ",x]})]})}),t.jsx(ht,{children:t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"font-medium",children:u}),t.jsxs("p",{className:"text-xs",children:[We(y,{month:"short",day:"numeric"},n.locale),Bs(y)!==Bs(g)&&t.jsxs(t.Fragment,{children:[" â ",We(g,{month:"short",day:"numeric"},n.locale)]})]}),t.jsx("p",{className:"text-xs",children:x}),m.note&&t.jsx("p",{className:"max-w-[200px] text-xs italic",children:m.note})]})})]},m._id)},e[6]=d,e[7]=n,e[8]=a,e[9]=o,e[10]=r):r=e[10],l=s.map(r),e[0]=s,e[1]=d,e[2]=n,e[3]=a,e[4]=o,e[5]=l}else l=e[5];let f;return e[11]!==l?(f=t.jsx("div",{className:"flex flex-col gap-0.5 px-0.5 pb-0.5",children:l}),e[11]=l,e[12]=f):f=e[12],f}function Er(i){const e=je.c(190),{datesByIndex:s,weekYear:o,searchTerm:n,setSearchTerm:d,companyRoles:a,filteredEmployees:l,groupShiftsByEmployeeAndDay:f,allLocationGroupShiftsByEmployeeAndDay:r,managerOpenShiftsByDay:m,employeeOpenShiftsByDay:c,groupAbsencesByEmployeeAndDay:h,groupAvailabilitiesByEmployeeAndDay:p,roleFilterIds:y,groupByRole:g,hideEmptyRows:u,hiddenEmptyRowsCount:x,isLoadingShifts:b,onToggleHideEmptyRows:v,onEmployeeClick:j,onCreateShiftClick:w,onCreateOpenShiftClick:C,onShiftClick:D,onNavigateToDay:_,onEmployeeOpenShiftClick:S,onAbsenceClick:N,onAvailabilityClick:B,activeShift:A,startOfWeekDate:R,branches:F,selectedBranchId:H,timeAccountBalances:M,employeeWeeklyQuotaHoursById:O,weekdayQuotaMinutesById:Q}=i,$=x===void 0?0:x,{i18n:E}=at(),I=bn();let P;e[0]!==I?(P=I.check("shifts","create"),e[0]=I,e[1]=P):P=e[1];const G=P,{isWeekPublished:k}=Ln(R,F,void 0);let T;e[2]===Symbol.for("react.memo_cache_sentinel")?(T=Ye(De.settings.getShiftSettings,{}),e[2]=T):T=e[2];const{data:W}=ut(T);let L;e[3]===Symbol.for("react.memo_cache_sentinel")?(L=Ye(De.addresses.listAll,{includeArchived:!0}),e[3]=L):L=e[3];const{data:q}=ut(L);let Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=Ye(De.tags.listAll,{}),e[4]=Z):Z=e[4];const{data:ne}=ut(Z),[Y,ae,le,U,te,se,oe]=s;let be;e[5]!==q?(be=Object.fromEntries((q??[]).map(Or)),e[5]=q,e[6]=be):be=e[6];const ie=be;let fe;e[7]!==ne?(fe=Object.fromEntries((ne??[]).map($r)),e[7]=ne,e[8]=fe):fe=e[8];const he=fe;let Ie;e[9]!==a?(Ie=Object.fromEntries(a.map(Br)),e[9]=a,e[10]=Ie):Ie=e[10];const de=Ie;let re;e[11]!==F?(re=Object.fromEntries(F.map(Ar)),e[11]=F,e[12]=re):re=e[12];const Se=re,X=!H&&F.length>1;let ge;e[13]!==O?(ge=K=>O?.[K]??kn,e[13]=O,e[14]=ge):ge=e[14];
53const ce=ge,Ce=W?.hideSaturday??!1,Ee=W?.hideSunday??!1;let ue,me,_e,pe,Me,Pe,ze,He,Ue,Ge,Le,Ke,Re;if(e[15]!==G||e[16]!==c||e[17]!==l||e[18]!==te||e[19]!==f||e[20]!==u||e[21]!==Ce||e[22]!==Ee||e[23]!==E||e[24]!==k||e[25]!==Y||e[26]!==_||e[27]!==se||e[28]!==n||e[29]!==d||e[30]!==oe||e[31]!==U||e[32]!==ae||e[33]!==le){Re=[{index:0,date:Y},{index:1,date:ae},{index:2,date:le},{index:3,date:U},{index:4,date:te},{index:5,date:se},{index:6,date:oe}].map(Ze=>({...Ze,label:We(Ze.date,{weekday:"short"},E.locale)})).filter(Ze=>!(Ze.index===5&&Ce||Ze.index===6&&Ee)),me=Re.length+1;let K;e[47]!==c?(K=c.flat(),e[47]=c,e[48]=K):K=e[48];const Te=K.length;pe=!G&&Te>0,Me=G,Pe=pe||Me;let $e;if(e[49]!==l||e[50]!==f||e[51]!==u){let Ze;e[53]!==f||e[54]!==u?(Ze=xt=>!(!xt.isVisibleInRoster||u&&!(f[xt._id]?.some(Rr)??!1)),e[53]=f,e[54]=u,e[55]=Ze):Ze=e[55],$e=l.filter(Ze),e[49]=l,e[50]=f,e[51]=u,e[52]=$e}else $e=e[52];_e=$e,ue=G||k,Ke="min-h-0 flex-1 overflow-auto",Le="grid min-w-[1190px]",ze="bg-background sticky top-0 z-5 grid min-h-[40px]";let ke;e[56]!==me?(ke=us(me),e[56]=me,e[57]=ke):ke=e[57],e[58]!==ke?(He={gridTemplateColumns:ke},e[58]=ke,e[59]=He):He=e[59];let Qe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Qe=t.jsx(vn,{align:"inline-start",children:t.jsx(xn,{})}),e[60]=Qe):Qe=e[60];let nt;e[61]!==E?(nt=E._({id:"roster.grid.searchPlaceholder"}),e[61]=E,e[62]=nt):nt=e[62];let gt;e[63]!==d?(gt=Ze=>d(Ze.target.value),e[63]=d,e[64]=gt):gt=e[64],e[65]!==n||e[66]!==nt||e[67]!==gt?(Ue=t.jsx("div",{className:"flex-center border-border border-r border-b p-1",children:t.jsxs(wn,{children:[Qe,t.jsx(_n,{type:"search",placeholder:nt,value:n,onChange:gt})]})}),e[65]=n,e[66]=nt,e[67]=gt,e[68]=Ue):Ue=e[68],Ge=Re.map(Ze=>{const xt=t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mr-2 font-bold",children:We(Ze.date,{weekday:"short"},E.locale)})," ",We(Ze.date,{day:"numeric",month:"short"},E.locale)]}),pt=Be("flex-center border-border border-y border-r",Tn(Ze.date)&&"underline");return _?t.jsx("button",{type:"button",onClick:()=>_(Ze.date),className:Be(pt,"hover:bg-muted/50 cursor-pointer transition-colors","focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"),"aria-label":E._({id:"roster.grid.viewDay",message:"View {date}",values:{date:We(Ze.date,{weekday:"long",day:"numeric",month:"long"},E.locale)}}),children:xt},Ze.index):t.jsx("div",{className:pt,children:xt},Ze.index)}),e[15]=G,e[16]=c,e[17]=l,e[18]=te,e[19]=f,e[20]=u,e[21]=Ce,e[22]=Ee,e[23]=E,e[24]=k,e[25]=Y,e[26]=_,e[27]=se,e[28]=n,e[29]=d,e[30]=oe,e[31]=U,e[32]=ae,e[33]=le,e[34]=ue,e[35]=me,e[36]=_e,e[37]=pe,e[38]=Me,e[39]=Pe,e[40]=ze,e[41]=He,e[42]=Ue,e[43]=Ge,e[44]=Le,e[45]=Ke,e[46]=Re}else ue=e[34],me=e[35],_e=e[36],pe=e[37],Me=e[38],Pe=e[39],ze=e[40],He=e[41],Ue=e[42],Ge=e[43],Le=e[44],Ke=e[45],Re=e[46];let qe;e[69]!==ze||e[70]!==He||e[71]!==Ue||e[72]!==Ge?(qe=t.jsxs("div",{className:ze,style:He,children:[Ue,Ge]}),e[69]=ze,e[70]=He,e[71]=Ue,e[72]=Ge,e[73]=qe):qe=e[73];let st;e[74]!==me||e[75]!==b||e[76]!==Re?(st=b&&t.jsx("div",{className:"space-y-0",children:Array.from({length:8}).map((K,Te)=>t.jsxs("div",{className:"border-border grid min-h-[60px] border-r border-b",style:{gridTemplateColumns:us(me)},children:[t.jsxs("div",{className:"border-border bg-slate-1 flex flex-col gap-1 border-x px-1 py-1.5",children:[t.jsx(rs,{className:"h-4 w-24"}),t.jsx(rs,{className:"h-3 w-16"})]}),Re.map($e=>t.jsx("div",{className:"border-border flex flex-col gap-0.5 p-0.5",children:(Te+$e.index)%3!==0&&t.jsx(rs,{className:"h-[52px] w-full"})},$e.index))]},Te))}),e[74]=me,e[75]=b,e[76]=Re,e[77]=st):st=e[77];let Ve;e[78]!==ue||e[79]!==b?(Ve=!ue&&!b&&t.jsx(Ps,{className:"flex-center mx-auto min-h-[50vh] max-w-md",children:t.jsxs(Ls,{children:[t.jsx($s,{children:t.jsx(Oi,{className:"size-10"})}),t.jsx(Os,{children:t.jsx(J,{id:"roster.grid.empty.notPublished.title"})}),t.jsx(Fs,{children:t.jsx(J,{id:"roster.grid.empty.notPublished.description"})})]})}),e[78]=ue,e[79]=b,e[80]=Ve):Ve=e[80];let we;e[81]!==ue||e[82]!==_e||e[83]!==u||e[84]!==b||e[85]!==v||e[86]!==Pe?(we=ue&&!b&&u&&_e.length===0&&!Pe&&t.jsxs(Ps,{className:"flex-center mx-auto min-h-[50vh] max-w-md",children:[t.jsxs(Ls,{children:[t.jsx($s,{children:t.jsx($a,{className:"size-10"})}),t.jsx(Os,{children:t.jsx(J,{id:"roster.grid.empty.noEmployees.title"})}),t.jsx(Fs,{children:t.jsx(J,{id:"roster.grid.empty.noEmployees.description"})})]}),t.jsx(Di,{children:t.jsxs(bt,{variant:"outline",onClick:v,children:[t.jsx(fs,{className:"size-4"}),t.jsx(J,{id:"roster.grid.showEmptyRows"})]})})]}),e[81]=ue,e[82]=_e,e[83]=u,e[84]=b,e[85]=v,e[86]=Pe,e[87]=we):we=e[87];let et;e[88]!==A||e[89]!==ie||e[90]!==ue||e[91]!==me||e[92]!==a||e[93]!==b||e[94]!==m||e[95]!==C||e[96]!==D||e[97]!==Me||e[98]!==he||e[99]!==Re?(et=ue&&!b&&Me&&t.jsx(pr,{visibleDays:Re,columnCount:me,openShiftsByDay:m,companyRoles:a,activeShift:A,onOpenShiftClick:D,onCreateOpenShiftClick:C,addressById:ie,tagById:he}),e[88]=A,e[89]=ie,e[90]=ue,e[91]=me,e[92]=a,e[93]=b,e[94]=m,e[95]=C,e[96]=D,e[97]=Me,e[98]=he,e[99]=Re,e[100]=et):et=e[100];let tt;e[101]!==ie||e[102]!==ue||e[103]!==me||e[104]!==de||e[105]!==c||e[106]!==b||e[107]!==S||e[108]!==pe||e[109]!==he||e[110]!==Re?(tt=ue&&!b&&pe&&t.jsx(yr,{visibleDays:Re,columnCount:me,openShiftsByDay:c,companyRoleNameById:de,onOpenShiftClick:S,addressById:ie,tagById:he}),e[101]=ie,e[102]=ue,e[103]=me,e[104]=de,e[105]=c,e[106]=b,e[107]=S,e[108]=pe,e[109]=he,e[110]=Re,e[111]=tt):tt=e[111];let Xe;e[112]!==A||e[113]!==ie||e[114]!==r||e[115]!==Se||e[116]!==G||e[117]!==ue||e[118]!==me||e[119]!==a||e[120]!==_e||e[121]!==ce||e[122]!==h||e[123]!==p||e[124]!==g||e[125]!==f||e[126]!==b||e[127]!==N||e[128]!==B||e[129]!==w||e[130]!==j||e[131]!==D||e[132]!==H||e[133]!==X||e[134]!==he||e[135]!==M||e[136]!==Re||e[137]!==o||e[138]!==Q?(Xe=ue&&!b&&_e.length>0&&!g&&t.jsx(Sr,{activeShift:A,addressById:ie,allLocationGroupShiftsByEmployeeAndDay:r,branchNameById:Se,canCreateShifts:G,columnCount:me,companyRoles:a,employees:_e,getEmployeeWeeklyQuotaHours:ce,groupAbsencesByEmployeeAndDay:h,groupAvailabilitiesByEmployeeAndDay:p,groupShiftsByEmployeeAndDay:f,onCreateShiftClick:w,onEmployeeClick:j,onShiftClick:D,onAbsenceClick:N,onAvailabilityClick:B,selectedBranchId:H,showShiftBranchName:X,tagById:he,timeAccountBalances:M,weekdayQuotaMinutesById:Q,visibleDays:Re,week:o.week}),e[112]=A,e[113]=ie,e[114]=r,e[115]=Se,e[116]=G,e[117]=ue,e[118]=me,e[119]=a,e[120]=_e,e[121]=ce,e[122]=h,e[123]=p,e[124]=g,e[125]=f,e[126]=b,e[127]=N,e[128]=B,e[129]=w,e[130]=j,e[131]=D,e[132]=H,e[133]=X,e[134]=he,e[135]=M,e[136]=Re,e[137]=o,e[138]=Q,e[139]=Xe):Xe=e[139];let ve;e[140]!==A||e[141]!==ie||e[142]!==r||e[143]!==Se||e[144]!==G||e[145
53]!==ue||e[146]!==me||e[147]!==a||e[148]!==l||e[149]!==ce||e[150]!==h||e[151]!==p||e[152]!==g||e[153]!==f||e[154]!==u||e[155]!==b||e[156]!==N||e[157]!==B||e[158]!==w||e[159]!==j||e[160]!==D||e[161]!==y||e[162]!==H||e[163]!==X||e[164]!==he||e[165]!==M||e[166]!==Re||e[167]!==o||e[168]!==Q?(ve=ue&&!b&&g&&t.jsx(_r,{activeShift:A,addressById:ie,allLocationGroupShiftsByEmployeeAndDay:r,branchNameById:Se,canCreateShifts:G,columnCount:me,companyRoles:a,employees:l,getEmployeeWeeklyQuotaHours:ce,groupAbsencesByEmployeeAndDay:h,groupAvailabilitiesByEmployeeAndDay:p,groupShiftsByEmployeeAndDay:f,hideEmptyRows:u,roleFilterIds:y,onCreateShiftClick:w,onEmployeeClick:j,onShiftClick:D,onAbsenceClick:N,onAvailabilityClick:B,selectedBranchId:H,showShiftBranchName:X,tagById:he,timeAccountBalances:M,weekdayQuotaMinutesById:Q,visibleDays:Re,week:o.week}),e[140]=A,e[141]=ie,e[142]=r,e[143]=Se,e[144]=G,e[145]=ue,e[146]=me,e[147]=a,e[148]=l,e[149]=ce,e[150]=h,e[151]=p,e[152]=g,e[153]=f,e[154]=u,e[155]=b,e[156]=N,e[157]=B,e[158]=w,e[159]=j,e[160]=D,e[161]=y,e[162]=H,e[163]=X,e[164]=he,e[165]=M,e[166]=Re,e[167]=o,e[168]=Q,e[169]=ve):ve=e[169];let Ne;e[170]!==Le||e[171]!==qe||e[172]!==st||e[173]!==Ve||e[174]!==we||e[175]!==et||e[176]!==tt||e[177]!==Xe||e[178]!==ve?(Ne=t.jsxs("div",{className:Le,children:[qe,st,Ve,we,et,tt,Xe,ve]}),e[170]=Le,e[171]=qe,e[172]=st,e[173]=Ve,e[174]=we,e[175]=et,e[176]=tt,e[177]=Xe,e[178]=ve,e[179]=Ne):Ne=e[179];let it;e[180]!==_e||e[181]!==$||e[182]!==u||e[183]!==v||e[184]!==Pe?(it=u&&$>0&&(_e.length>0||Pe)&&t.jsx(Rn,{count:$,onShowAll:v}),e[180]=_e,e[181]=$,e[182]=u,e[183]=v,e[184]=Pe,e[185]=it):it=e[185];let rt;return e[186]!==Ke||e[187]!==Ne||e[188]!==it?(rt=t.jsxs("div",{className:Ke,children:[Ne,it]}),e[186]=Ke,e[187]=Ne,e[188]=it,e[189]=rt):rt=e[189],rt}function Rr(i){return i.length>0}function Ar(i){return[i._id,i.name]}function Br(i){return[i._id,i.name]}function $r(i){return[i._id,i]}function Or(i){return[i._id,i]}function Pr(i){const e=je.c(191),{viewMode:s,branchSelect:o,selectedBranchId:n,branches:d,companyRoles:a,tags:l,addresses:f,selectedRoleFilterIds:r,selectedTagFilterIds:m,selectedAddressFilterIds:c,onToggleRoleFilter:h,onToggleTagFilter:p,onToggleAddressFilter:y,onClearFilters:g,onViewModeChange:u,groupByRole:x,onToggleGroupByRole:b,hideEmptyRows:v,onToggleHideEmptyRows:j,hiddenEmptyRowsCount:w,isWeekPublished:C,publishedCount:D,totalBranches:_,openPublishConfirm:S,onExportWeekPdf:N,isExportingWeekPdf:B,onExportMonthPdf:A,isExportingMonthPdf:R,onClearWeek:F,onClearDay:H,clearIsPending:M}=i,{i18n:O}=at(),Q=To();let $;e[0]!==r?($=new Set(r),e[0]=r,e[1]=$):$=e[1];const E=$;let I;e[2]!==m?(I=new Set(m),e[2]=m,e[3]=I):I=e[3];const P=I;let G;e[4]!==c?(G=new Set(c),e[4]=c,e[5]=G):G=e[5];const k=G,T=r.length+m.length+c.length,W=T>0;let L;e[6]!==H||e[7]!==F||e[8]!==s?(L=s==="day"&&H?{handler:H,label:"day"}:s==="week"?{handler:F,label:"week"}:null,e[6]=H,e[7]=F,e[8]=s,e[9]=L):L=e[9];const q=L;let Z;e[10]!==o?(Z=o?t.jsx("div",{className:"contents sm:hidden",children:o}):null,e[10]=o,e[11]=Z):Z=e[11];let ne;e[12]!==d||e[13]!==O||e[14]!==C||e[15]!==S||e[16]!==D||e[17]!==n||e[18]!==_||e[19]!==s?(ne=s!=="month"&&t.jsx(ws,{entity:"publishedRanges",action:["publish","unpublish"],children:t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsxs(bt,{variant:"outline",size:"icon",onClick:S,"aria-label":O._(C?{id:"roster.header.unpublish"}:{id:"roster.header.publish"}),className:"sm:w-auto sm:px-3",children:[C?t.jsx(Qs,{className:"size-4"}):t.jsx(Vs,{className:"size-4"}),t.jsx("span",{className:"hidden sm:inline",children:C?t.jsx(J,{id:"roster.header.unpublish"}):t.jsx(J,{id:"roster.header.publish"})}),!n&&d.length>1&&t.jsxs("span",{className:"text-slate-11 ml-1 hidden text-xs sm:inline",children:["(",D,"/",_,")"]})]})}),t.jsx(ht,{children:t.jsx("p",{children:n?C?t.jsx(J,{id:"roster.publish.tooltip.branchPublic"}):t.jsx(J,{id:"roster.publish.tooltip.branchPrivate"}):O._({id:"roster.publish.tooltip.branchesProgress",message:"{publishedCount} of {totalBranches} branches published",values:{publishedCount:D,totalBranches:_}})})})]})}),e[12]=d,e[13]=O,e[14]=C,e[15]=S,e[16]=D,e[17]=n,e[18]=_,e[19]=s,e[20]=ne):ne
53=e[20];let Y;e[21]!==O?(Y=O._({id:"roster.header.aria.openFilters"}),e[21]=O,e[22]=Y):Y=e[22];let ae;e[23]===Symbol.for("react.memo_cache_sentinel")?(ae=t.jsx(Ma,{className:"size-4"}),e[23]=ae):ae=e[23];let le;e[24]===Symbol.for("react.memo_cache_sentinel")?(le=t.jsx("span",{className:"hidden sm:inline",children:t.jsx(J,{id:"roster.header.filters"})}),e[24]=le):le=e[24];let U;e[25]!==T||e[26]!==W?(U=W&&t.jsx("span",{className:"bg-slate-3 rounded px-1 py-0 text-xs font-medium",children:T}),e[25]=T,e[26]=W,e[27]=U):U=e[27];let te;e[28]!==U||e[29]!==Y?(te=t.jsx(Kn,{asChild:!0,children:t.jsxs(bt,{variant:"outline","aria-label":Y,children:[ae,le,U]})}),e[28]=U,e[29]=Y,e[30]=te):te=e[30];let se,oe;e[31]===Symbol.for("react.memo_cache_sentinel")?(se=t.jsx(Rs,{children:t.jsx(J,{id:"roster.header.filters"})}),oe=t.jsx(os,{}),e[31]=se,e[32]=oe):(se=e[31],oe=e[32]);let be;e[33]===Symbol.for("react.memo_cache_sentinel")?(be=t.jsx(Rs,{className:"text-xs font-medium",children:t.jsx(J,{id:"roster.header.roles"})}),e[33]=be):be=e[33];let ie;e[34]!==a||e[35]!==h||e[36]!==E?(ie=a.length===0?t.jsx(Zt,{disabled:!0,children:t.jsx(J,{id:"roster.header.noRolesFound"})}):a.map(ot=>t.jsxs(xs,{checked:E.has(ot._id),onSelect:Hr,onCheckedChange:()=>h(ot._id),children:[t.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:`var(--${ot.color}-9)`}}),t.jsx("span",{children:ot.name})]},ot._id)),e[34]=a,e[35]=h,e[36]=E,e[37]=ie):ie=e[37];let fe;e[38]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx(os,{}),e[38]=fe):fe=e[38];let he;e[39]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(Rs,{className:"text-xs font-medium",children:t.jsx(J,{id:"roster.header.tags"})}),e[39]=he):he=e[39];let Ie;e[40]!==p||e[41]!==P||e[42]!==l?(Ie=l.length===0?t.jsx(Zt,{disabled:!0,children:t.jsx(J,{id:"roster.header.noTagsFound"})}):l.map(ot=>t.jsxs(xs,{checked:P.has(ot._id),onSelect:zr,onCheckedChange:()=>p(ot._id),children:[t.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:`var(--${ot.color}-9)`}}),t.jsx("span",{children:ot.name})]},ot._id)),e[40]=p,e[41]=P,e[42]=l,e[43]=Ie):Ie=e[43];let de;e[44]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx(os,{}),e[44]=de):de=e[44];let re;e[45]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Rs,{className:"text-xs font-medium",children:t.jsx(J,{id:"roster.header.addresses"})}),e[45]=re):re=e[45];let Se;e[46]!==f||e[47]!==y||e[48]!==k?(Se=f.length===0?t.jsx(Zt,{disabled:!0,children:t.jsx(J,{id:"roster.header.noAddressesFound"})}):f.map(ot=>t.jsxs(xs,{checked:k.has(ot._id),onSelect:Wr,onCheckedChange:()=>y(ot._id),children:[t.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:`var(--${ot.color}-9)`}}),t.jsx("span",{className:"truncate",children:ot.name||ot.address})]},ot._id)),e[46]=f,e[47]=y,e[48]=k,e[49]=Se):Se=e[49];let X;e[50]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(os,{}),e[50]=X):X=e[50];const ge=!W;let ce;e[51]===Symbol.for("react.memo_cache_sentinel")?(ce=t.jsx(J,{id:"roster.header.clearFilters"}),e[51]=ce):ce=e[51];let Ce;e[52]!==g||e[53]!==ge?(Ce=t.jsx(Zt,{disabled:ge,onSelect:g,children:ce}),e[52]=g,e[53]=ge,e[54]=Ce):Ce=e[54];let Ee;e[55]!==ie||e[56]!==Ie||e[57]!==Se||e[58]!==Ce?(Ee=t.jsxs(Yn,{align:"end",className:"w-60",children:[se,oe,be,ie,fe,he,Ie,de,re,Se,X,Ce]}),e[55]=ie,e[56]=Ie,e[57]=Se,e[58]=Ce,e[59]=Ee):Ee=e[59];let ue;e[60]!==te||e[61]!==Ee?(ue=t.jsxs(qn,{children:[te,Ee]}),e[60]=te,e[61]=Ee,e[62]=ue):ue=e[62];let me;e[63]!==O?(me=O._({id:"roster.header.aria.toggleGroupByRole"}),e[63]=O,e[64]=me):me=e[64];let _e;e[65]===Symbol.for("react.memo_cache_sentinel")?(_e=t.jsx(Zn,{className:"size-4"}),e[65]=_e):_e=e[65];let pe;e[66]!==x||e[67]!==b||e[68]!==me?(pe=t.jsx(ft,{asChild:!0,children:t.jsx(bs,{variant:"outline",pressed:x,onPressedCh
53ange:b,"aria-label":me,children:_e})}),e[66]=x,e[67]=b,e[68]=me,e[69]=pe):pe=e[69];let Me;e[70]===Symbol.for("react.memo_cache_sentinel")?(Me=t.jsx(ht,{children:t.jsx("p",{children:t.jsx(J,{id:"roster.header.tooltip.groupByRole"})})}),e[70]=Me):Me=e[70];let Pe;e[71]!==pe?(Pe=t.jsxs(mt,{children:[pe,Me]}),e[71]=pe,e[72]=Pe):Pe=e[72];let ze;e[73]!==O?(ze=O._({id:"roster.header.aria.toggleHideEmptyRows"}),e[73]=O,e[74]=ze):ze=e[74];let He;e[75]===Symbol.for("react.memo_cache_sentinel")?(He=t.jsx(fs,{className:"size-4"}),e[75]=He):He=e[75];let Ue;e[76]!==w||e[77]!==v?(Ue=v&&w>0&&t.jsx("span",{className:"text-xs font-medium tabular-nums",children:w}),e[76]=w,e[77]=v,e[78]=Ue):Ue=e[78];let Ge;e[79]!==v||e[80]!==j||e[81]!==ze||e[82]!==Ue?(Ge=t.jsx(ft,{asChild:!0,children:t.jsxs(bs,{variant:"outline",pressed:v,onPressedChange:j,"aria-label":ze,children:[He,Ue]})}),e[79]=v,e[80]=j,e[81]=ze,e[82]=Ue,e[83]=Ge):Ge=e[83];let Le;e[84]!==w||e[85]!==v||e[86]!==O?(Le=v&&w>0?O._({id:"roster.header.tooltip.hideEmptyRows.active",message:"{count, plural, one {# row hidden} other {# rows hidden}} · click to show all",values:{count:w}}):t.jsx(J,{id:"roster.header.tooltip.hideEmptyRows"}),e[84]=w,e[85]=v,e[86]=O,e[87]=Le):Le=e[87];let Ke;e[88]!==Le?(Ke=t.jsx(ht,{children:t.jsx("p",{children:Le})}),e[88]=Le,e[89]=Ke):Ke=e[89];let Re;e[90]!==Ge||e[91]!==Ke?(Re=t.jsxs(mt,{children:[Ge,Ke]}),e[90]=Ge,e[91]=Ke,e[92]=Re):Re=e[92];let qe;e[93]!==Pe||e[94]!==Re?(qe=t.jsxs(Cs,{className:"hidden sm:flex",children:[Pe,Re]}),e[93]=Pe,e[94]=Re,e[95]=qe):qe=e[95];const st=s==="day";let Ve;e[96]!==u?(Ve=ot=>{ot&&u?.("day")},e[96]=u,e[97]=Ve):Ve=e[97];let we;e[98]!==O?(we=O._({id:"roster.header.aria.dayView"}),e[98]=O,e[99]=we):we=e[99];let et;e[100]===Symbol.for("react.memo_cache_sentinel")?(et=t.jsx(Ta,{className:"size-4"}),e[100]=et):et=e[100];let tt;e[101]===Symbol.for("react.memo_cache_sentinel")?(tt=t.jsx("span",{className:"sr-only",children:t.jsx(J,{id:"roster.header.day"})}),e[101]=tt):tt=e[101];let Xe;e[102]!==st||e[103]!==Ve||e[104]!==we?(Xe=t.jsx(ft,{asChild:!0,children:t.jsxs(bs,{variant:"outline",pressed:st,onPressedChange:Ve,"aria-label":we,children:[et,tt]})}),e[102]=st,e[103]=Ve,e[104]=we,e[105]=Xe):Xe=e[105];let ve;e[106]===Symbol.for("react.memo_cache_sentinel")?(ve=t.jsx(ht,{children:t.jsx("p",{children:t.jsx(J,{id:"roster.header.tooltip.dayView"})})}),e[106]=ve):ve=e[106];let Ne;e[107]!==Xe?(Ne=t.jsxs(mt,{children:[Xe,ve]}),e[107]=Xe,e[108]=Ne):Ne=e[108];const it=s==="week";let rt;e[109]!==u?(rt=ot=>{ot&&u?.("week")},e[109]=u,e[110]=rt):rt=e[110];let K;e[111]!==O?(K=O._({id:"roster.header.aria.weekView"}),e[111]=O,e[112]=K):K=e[112];let Te;e[113]===Symbol.for("react.memo_cache_sentinel")?(Te=t.jsx(ba,{className:"size-4"}),e[113]=Te):Te=e[113];let $e;e[114]===Symbol.for("react.memo_cache_sentinel")?($e=t.jsx("span",{className:"sr-only",children:t.jsx(J,{id:"roster.header.week"})}),e[114]=$e):$e=e[114];let ke;e[115]!==it||e[116]!==rt||e[117]!==K?(ke=t.jsx(ft,{asChild:!0,children:t.jsxs(bs,{variant:"outline",pressed:it,onPressedChange:rt,"aria-label":K,children:[Te,$e]})}),e[115]=it,e[116]=rt,e[117]=K,e[118]=ke):ke=e[118];let Qe;e[119]===Symbol.for("react.memo_cache_sentinel")?(Qe=t.jsx(ht,{children:t.jsx("p",{children:t.jsx(J,{id:"roster.header.tooltip.weekView"})})}),e[119]=Qe):Qe=e[119];let nt;e[120]!==ke?(nt=t.jsxs(mt,{children:[ke,Qe]}),e[120]=ke,e[121]=nt):nt=e[121];const gt=s==="month";let Ze;e[122]!==u?(Ze=ot=>{ot&&u?.("month")},e[122]=u,e[123]=Ze):Ze=e[123];let xt;e[124]!==O?(xt=O._({id:"roster.header.aria.monthView"}),e[124]=O,e[125]=xt):xt=e[125];let pt;e[126]===Symbol.for("react.memo_cache_sentinel")?(pt=t.jsx(Li,{className:"size-4"}),e[126]=pt):pt=e[126];let Ot;e[127]===Symbol.for("react.memo_cache_sentinel")?(Ot=t.jsx("span",{className:"sr-only",children:t.jsx(J,{id:"roster.header.month"})}),e[127]=Ot):Ot=e[127];let Mt;e[128]!==gt||e[129]!==Ze||e[130]!==xt?(Mt=t.jsx(ft,{asChild:!0,children:t.jsxs(bs,{variant:"outline",pressed:gt,onPressedChange:Ze,"aria-label":xt,children:[pt,Ot]})}),e[128]=gt,e[129]=Ze,e[130]=xt,e[131]=Mt):Mt=e[131];let Pt;e[132]===Symbol.for("react.memo_cache_sentinel")?(Pt=t.jsx(ht,{children:t.jsx("p",{children:t.jsx(J,{id:"roster.header.tooltip.monthView"})})}),e[132]=Pt):Pt=e[132];let Tt;e[133]!==Mt?(Tt=t.jsxs(mt,{children:[Mt,Pt]}),e[133]=Mt,e[134]=Tt):Tt=e[134];let Lt;e[135]!==Ne||e[136]!==nt||e[137]!==Tt?(Lt=t.jsxs(Cs,{children:[Ne,nt,Tt]}),e[135]=Ne,e[136]=nt,e[137]=Tt,e[138]=Lt):Lt=e[138];let _t;e[139]!==O?(_t=O._({id:"roster.header.aria.openScheduleActions"}),e[139]=O,e[140]=_t):_t=e[140];let Et;e[141]===Symbol.for("react.memo_cache_sentinel")?(Et=t.jsx(Sa,{className:"size-4"}),e[141]=Et):Et=e[141];let kt;e[142]!==_t?(kt=t.jsx(Kn,{asChild:!0,children:t.jsx(bt,{variant:"outline",size:"icon","aria-label":_t,children:Et})}),e[142]=_t,e[143]=kt):kt=e[143];let Rt,At;e[144]===Symbol.for("react.memo_cache_sentinel")?(Rt=t.jsx(Zn,{className:"size-4"}),At=t.jsx(J,{id:"roster.header.tooltip.groupByRole"}),e[144]=Rt,e[145]=At):(Rt=e[144],At=e[145]);let Ct;e[146]!==x||e[147]!==b?(Ct=t.jsxs(xs,{className:"sm:hidden",checked:x,onSelect:Fr,onCheckedChange:b,children:[Rt,At]}),e[146]=x,e[147]=b,e[148]=Ct):Ct=e[148];let Bt,$t;e[149]===Symbol.for("react.memo_cache_sentinel")?(Bt=t.jsx(fs,{className:"size-4"}),$t=t.jsx(J,{id:"roster.header.tooltip.hideEmptyRows"}),e[149]=Bt,e[150]=$t):(Bt=e[149],$t=e[150]);let vt;e[151]!==v||e[152]!==j?(vt=t.jsxs(xs,{className:"sm:hidden",checked:v,onSelect:Lr,onCheckedChange:j,children:[Bt,$t]}),e[151]=v,e[152]=j,e[153]=vt):vt=e[153];let Nt;e[154]===Symbol.for("react.memo_cache_sentinel")?(Nt=t.jsx(os,{className:"sm:hidden"}),e[154]=Nt):Nt=e[154];let wt;e[155]!==B||e[156]!==N?(wt=N?t.jsxs(Zt,{disabled:B,onSelect:N,children:[B?t.jsx(Hn,{className:"size-4 animate-spin"}):t.jsx(Xn,{className:"size-4"}),t.jsx(J,{id:"roster.header.exportPdf"})]}):null,e[155]=B,e[156]=N,e[157]=wt):wt=e[157];let Dt;e[158]!==R||e[159]!==A?(Dt=A?t.jsxs(Zt,{disabled:R,onSelect:A,children:[R?t.jsx(Hn,{className:"size-4 animate-spin"}):t.jsx(Xn,{className:"size-4"}),t.jsx(J,{id:"roster.header.exportMonthPdf"})]}):null,e[158]=R,e[159]=A,e[160]=Dt):Dt=e[160];let z;e[161]!==Q?(z=()=>void Q({to:"/assistant",search:{intent:"import_rota"}}),e[161]=Q,e[162]=z):z=e[162];let xe,ye;e[163]===Symbol.for("react.memo_cache_sentinel")?(xe=t.jsx(ja,{className:"size-4"}),ye=t.jsx(J,{id:"roster.header.importSchedule"}),e[163]=xe,e[164]=ye):(xe=e[163],ye=e[164]);let Fe;e[165]!==z?(Fe=t.jsx(ws,{entity:"shifts",action:"create",children:t.jsxs(Zt,{onSelect:z,children:[xe,ye]})}),e[165]=z,e[166]=Fe):Fe=e[166];let lt;e[167]!==q||e[168]!==M||e[169]!==A||e[170]!==N?(lt=q?t.jsx(ws,{entity:"shifts",action:"delete",children:t.jsxs(t.Fragment,{children:[N||A?t.jsx(os,{}):null,t.jsxs(Zt,{disabled:M,onSelect:q.handler,className:"text-red-11 focus:text-red-11",children:[t.jsx(xa,{
53className:"text-red-11 size-4"}),M?t.jsx(J,{id:"roster.header.clearing"}):q.label==="day"?t.jsx(J,{id:"roster.header.clearDay"}):t.jsx(J,{id:"roster.header.clearWeek"})]})]})}):null,e[167]=q,e[168]=M,e[169]=A,e[170]=N,e[171]=lt):lt=e[171];let ct;e[172]!==Ct||e[173]!==vt||e[174]!==wt||e[175]!==Dt||e[176]!==Fe||e[177]!==lt?(ct=t.jsxs(Yn,{align:"end",className:"w-52",children:[Ct,vt,Nt,wt,Dt,Fe,lt]}),e[172]=Ct,e[173]=vt,e[174]=wt,e[175]=Dt,e[176]=Fe,e[177]=lt,e[178]=ct):ct=e[178];let It;e[179]!==kt||e[180]!==ct?(It=t.jsxs(qn,{children:[kt,ct]}),e[179]=kt,e[180]=ct,e[181]=It):It=e[181];let Ht;e[182]!==Lt||e[183]!==It?(Ht=t.jsxs("div",{className:"flex items-center gap-2 print:hidden",children:[Lt,It]}),e[182]=Lt,e[183]=It,e[184]=Ht):Ht=e[184];let Ut;return e[185]!==ue||e[186]!==qe||e[187]!==Z||e[188]!==ne||e[189]!==Ht?(Ut=t.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:justify-end",children:[Z,ne,ue,qe,Ht]}),e[185]=ue,e[186]=qe,e[187]=Z,e[188]=ne,e[189]=Ht,e[190]=Ut):Ut=e[190],Ut}function Lr(i){return i.preventDefault()}function Fr(i){return i.preventDefault()}function Wr(i){return i.preventDefault()}function zr(i){return i.preventDefault()}function Hr(i){return i.preventDefault()}function Vr(i){const e=je.c(74),{selectedMonth:s,onMonthChange:o,onMonthSelect:n,goToCurrentMonth:d}=i,{i18n:a}=at();let l;e[0]!==s?(l=s?.getFullYear()??new Date().getFullYear(),e[0]=s,e[1]=l):l=e[1];const f=l;let r;e[2]!==s?(r=s?.getMonth()??new Date().getMonth(),e[2]=s,e[3]=r):r=e[3];const m=r;let c;e[4]!==f?(c=Array.from({length:21},(Z,ne)=>f-10+ne),e[4]=f,e[5]=c):c=e[5];const h=c;let p;e[6]!==a.locale||e[7]!==f?(p=Array.from({length:12},(Z,ne)=>{const Y=new Date(f,ne,1);return{value:String(ne),label:We(Y,{month:"long"},a.locale)}}),e[6]=a.locale,e[7]=f,e[8]=p):p=e[8];const y=p,g=String(m);let u;e[9]!==n||e[10]!==f?(u=Z=>{const ne=Number(Z);n?.(new Date(f,ne,1))},e[9]=n,e[10]=f,e[11]=u):u=e[11];let x;e[12]!==a?(x=a._({id:"roster.header.aria.selectMonth"}),e[12]=a,e[13]=x):x=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(rn,{}),e[14]=b):b=e[14];let v;e[15]!==x?(v=t.jsx(cn,{"aria-label":x,className:"h-9 w-[7rem] cursor-pointer gap-2 text-base font-semibold whitespace-nowrap",children:b}),e[15]=x,e[16]=v):v=e[16];let j;e[17]!==y?(j=t.jsx(ln,{children:y.map(Ur)}),e[17]=y,e[18]=j):j=e[18];let w;e[19]!==j||e[20]!==g||e[21]!==u||e[22]!==v?(w=t.jsxs(dn,{value:g,onValueChange:u,children:[v,j]}),e[19]=j,e[20]=g,e[21]=u,e[22]=v,e[23]=w):w=e[23];const C=String(f);let D;e[24]!==n||e[25]!==s?(D=Z=>{const ne=Number(Z),Y=s??new Date;n?.(new Date(ne,Y.getMonth(),1))},e[24]=n,e[25]=s,e[26]=D):D=e[26];let _;e[27]!==a?(_=a._({id:"roster.header.aria.selectYear"}),e[27]=a,e[28]=_):_=e[28];let S;e[29]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(rn,{}),e[29]=S):S=e[29];let N;e[30]!==_?(N=t.jsx(cn,{"aria-label":_,className:"h-9 w-[5.75rem] cursor-pointer gap-2 whitespace-nowrap",children:S}),e[30]=_,e[31]=N):N=e[31];let B;e[32]!==h?(B=t.jsx(ln,{children:h.map(Qr)}),e[32]=h,e[33]=B):B=e[33];let A;e[34]!==C||e[35]!==D||e[36]!==N||e[37]!==B?(A=t.jsxs(dn,{value:C,onValueChange:D,children:[N,B]}),e[34]=C,e[35]=D,e[36]=N,e[37]=B,e[38]=A):A=e[38];let R;e[39]!==o?(R=()=>o?.("prev"),e[39]=o,e[40]=R):R=e[40];let F;e[41]!==a?(F=a._({id:"roster.header.aria.goToPreviousMonth"}),e[41]=a,e[42]=F):F=e[42];let H;e[43]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(mn,{}),e[43]=H):H=e[43];let M;e[44]!==R||e[45]!==F?(M=t.jsx(bt,{variant:"outline",size:"icon",onClick:R,"aria-label":F,children:H}),e[44]=R,e[45]=F,e[46]=M):M=e[46];let O;e[47]!==d?(O=()=>d?.(),e[47]=d,e[48]=O):O=e[48];let Q;e[49]!==a?(Q=a._({id:"roster.header.aria.goToCurrentMonth"}),e[49]=a,e[50]=Q):Q=e[50];let $;e[51]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(fn,{className:"size-4"}),e[51]=$):$=e[51];let E;e[52]!==O||e[53]!==Q?(E=t.jsx(ft,{asChild:!0,children:t.jsx(bt,{variant:"outline",size:"icon",onClick:O,"aria-label":Q,children:$})}),e[52]=O,e[53]=Q,e[54]=E):E=e[54];let I;e[55]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ht,{children:t.jsx("p",{children:t.jsx(J,{id:"roster.header.tooltip.goToCurrentMonth"})})}),e[55]=I):I=e[55];let P;e[56]!==E?(P=t.jsxs(mt,{children:[E,I]}),e[56]=E,e[57]=P):P=e[57];let G;e[58]!==o?(G=()=>o?.("next"),e[58]=o,e[59]=G):G=e[59];let k;e[60]!==a?(k=a._({id:"roster.header.aria.goToNextMonth"}),e[60]=a,e[61]=k):k=e[61];let T;e[62]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(zs,{}),e[62]=T):T=e[62];let W;e[63]!==G||e[64]!==k?(W=t.jsx(bt,{variant:"outline",size:"icon",onClick:G,"aria-label":k,children:T}),e[63]=G,e[64]=k,e[65]=W):W=e[65];let L;e[66]!==M||e[67]!==P||e[68]!==W?(L=t.jsxs(Cs,{children:[M,P,W]}),e[66]=M,e[67]=P,e[68]=W,e[69]=L):L=e[69];let q;return e[70]!==w||e[71]!==A||e[72]!==L?(q=t.jsxs(t.Fragment,{children:[w,A,L]}),e[70]=w,e[71]=A,e[72]=L,e[73]=q):q=e[73],q}function Qr(i){return t.jsx(Ws,{value:String(i),children:i},i)}function Ur(i){return t.jsx(Ws,{value:i.value,children:i.label},i.value)}const Gr={id:"weekPicker.weekLabel"};function Kr(i){const e=je.c(40),{week:s,onSelect:o,placeholder:n,className:d,container:a,clearable:l,children:f}=i,r=l===void 0?!1:l,[m,c]=ee.useState(!1),h=Ns();let p;e[0]!==o||e[1]!==s?(p=F=>{F.stopPropagation(),F.preventDefault(),o(void 0,s?Qt(en(tn(new Date,s.year),s.week)):new Date,{},F),c(!1)},e[0]=o,e[1]=s,e[2]=p):p=e[2];const y=p;let g;e[3]!==o?(g=(F,H,M)=>{o({week:gi(F),year:No(F)},F,H,M),c(!1)},e[3]=o,e[4]=g):g=e[4];const u=g;let x;e[5]!==f||e[6]!==d||e[7]!==r||e[8]!==y||e[9]!==h||e[10]!==n||e[11]!==s?(x=f||t.jsxs("button",{className:Be(va,"w-[220px] cursor-pointer items-center justify-start bg-white text-left leading-none font-normal",!s&&"text-muted-foreground",d),children:[t.jsx(Li,{className:"mr-2 h-4 w-4"}),s?h(Gr,{weekNumber:s.week,year:s.year}):t.jsx("span",{children:n}),r&&s&&t.jsx("button",{className:"hover:bg-slate-3 hover:text-slate-11 ml-auto flex cursor-pointer items-center rounded-full p-1 transition-colors",onClick:y,children:t.jsx(vs,{className:"h-3 w-3"})})]}),e[5]=f,e[6]=d,e[7]=r,e[8]=y,e[9]=h,e[10]=n,e[11]=s,e[12]=x):x=e[12];const b=x;let v;e[13]!==s?(v=s?{from:Qt(en(tn(new Date,s.year),s.week)),to:aa(en(tn(new Date,s.year),s.week))}:void 0,e[13]=s,e[14]=v):v=e[14];const j=v;let w;e[15]!==b?(w=t.jsx(Ri,{asChild:!0,children:b}),e[15]=b,e[16]=w):w=e[16];const C=j?.from,D=j?.to;let _;e[17]!==j?(_=F=>j?la(j,F,!0):!1,e[17]=j,e[18]=_):_=e[18];let S;e[19]!==j||e[20]!==C||e[21]!==D||e[22]!==_?(S={selected:j,range_start:C,range_end:D,range_middle:_},e[19]=j,e[20]=C,e[21]=D,e[22]=_,e[23]=S):S=e[23];let N;e[24]!==u||e[25]!==j||e[26]!==S?(N=t.jsx(Ti,{weekPicker:!0,mode:"range",selected:j,onDayCl
53ick:u,autoFocus:!0,modifiers:S}),e[24]=u,e[25]=j,e[26]=S,e[27]=N):N=e[27];let B;e[28]!==r||e[29]!==y||e[30]!==s?(B=r&&s&&t.jsx("div",{className:"border-t p-3",children:t.jsx(bt,{variant:"outline",size:"sm",className:"w-full",onClick:y,children:t.jsx(J,{id:"ui.weekPicker.clear"})})}),e[28]=r,e[29]=y,e[30]=s,e[31]=B):B=e[31];let A;e[32]!==a||e[33]!==N||e[34]!==B?(A=t.jsxs(Ai,{className:"w-auto p-0",container:a,side:"top",children:[N,B]}),e[32]=a,e[33]=N,e[34]=B,e[35]=A):A=e[35];let R;return e[36]!==m||e[37]!==A||e[38]!==w?(R=t.jsxs(Bi,{open:m,onOpenChange:c,children:[w,A]}),e[36]=m,e[37]=A,e[38]=w,e[39]=R):R=e[39],R}function Ss(i){const[e,s]=i.split(":"),o=Number(e),n=Number(s);return o*60+(n||0)}function ri(i){const e=Math.max(0,Math.min(i,1440)),s=Math.floor(e/60),o=e%60;return`${String(s).padStart(2,"0")}:${String(o).padStart(2,"0")}`}function Yr(i){const{viewMode:e="week",onViewModeChange:s,selectedDay:o=new Date,onDayChange:n,selectedMonth:d,onMonthChange:a,onMonthSelect:l,goToCurrentMonth:f,dayViewStartTime:r="06:00",dayViewEndTime:m="22:00",onTimeRangeChange:c,weekYear:h,publishConflictShiftCount:p,branches:y,companyRoles:g,tags:u,addresses:x,selectedRoleFilterIds:b,selectedTagFilterIds:v,selectedAddressFilterIds:j,onToggleRoleFilter:w,onToggleTagFilter:C,onToggleAddressFilter:D,onClearFilters:_,selectedBranchId:S,onBranchChange:N,onSelectWeek:B,handleWeekChange:A,goToCurrentWeek:R,onClearWeek:F,onClearDay:H,clearIsPending:M,startOfWeekDate:O,groupByRole:Q,onToggleGroupByRole:$,hideEmptyRows:E,onToggleHideEmptyRows:I,hiddenEmptyRowsCount:P=0,onExportWeekPdf:G,isExportingWeekPdf:k=!1,onExportMonthPdf:T,isExportingMonthPdf:W=!1}=i,{i18n:L}=at(),{formatTime:q,timeFormat:Z}=Wt(),ne=X=>q(X==="24:00"&&Z==="12h"?"0:00":X),{weekStartStr:Y,weekEndStr:ae,isWeekPublished:le,publishedCount:U,totalBranches:te,setWeekPublishedMutation:se}=Ln(O,y,S),{openPublishWeekDialog:oe,PublishWeekConfirmationDialog:be}=oo({branches:y,selectedBranchId:S}),ie=ee.useMemo(()=>Array.from({length:24},(X,ge)=>`${String(ge).padStart(2,"0")}:00`),[]),fe=ee.useMemo(()=>Math.min(1440,Ss(r)+60),[r]),he=ee.useMemo(()=>ri(fe),[fe]),Ie=ee.useMemo(()=>Ss(m)<fe?he:m,[m,fe,he]),de=ee.useMemo(()=>Array.from({length:24},(X,ge)=>{const ce=ge+1;return`${String(ce).padStart(2,"0")}:00`}).filter(X=>Ss(X)>=fe),[fe]),re=y.length>1?t.jsxs(dn,{value:S||"all",onValueChange:X=>{N(X==="all"?void 0:X)},children:[t.jsxs(cn,{className:"w-auto gap-2 whitespace-nowrap sm:min-w-[200px]",children:[t.jsx(_a,{className:"text-slate-11 size-4 shrink-0"}),t.jsx(rn,{placeholder:L._({id:"roster.header.locations"}),children:S?y.find(X=>X._id===S)?.name:L._({id:"roster.header.locations"})})]}),t.jsxs(ln,{children:[t.jsx(Ws,{value:"all",children:t.jsx(J,{id:"roster.header.allLocations"})}),y.map(X=>t.jsx(Ws,{value:X._id,children:X.name},X._id))]})]}):null,Se=()=>{oe({startOfWeekDate:O,weekStartStr:Y,weekEndStr:ae,isWeekPublished:le,conflictShiftCount:p,onConfirm:({published:X,branchIds:ge})=>se.mutateAsync({startDate:Y,endDate:ae,published:X,branchIds:ge})})};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-2 pb-8 sm:flex-row sm:items-center sm:justify-between sm:gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e==="day"?t.jsxs(t.Fragment,{children:[t.jsxs(Bi,{children:[t.jsx(Ri,{asChild:!0,children:t.jsx(bt,{variant:"link",className:"h-auto w-[9.5rem] cursor-pointer justify-start px-1 py-0 text-2xl font-bold whitespace-nowrap",children:We(o,{weekday:"short",day:"numeric",month:"short"},L.locale)})}),t.jsx(Ai,{className:"w-auto p-0",align:"start",children:t.jsx(Ti,{mode:"single",selected:o,onSelect:X=>{X&&n&&n(X)}})})]}),t.jsxs(Cs,{children:[t.jsx(bt,{variant:"outline",size:"icon",onClick:()=>n?.(Oa(o)),"aria-label":L._({id:"roster.header.aria.goToPreviousDay"}),children:t.jsx(mn,{})}),t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(bt,{variant:"outline",size:"icon",onClick:()=>n?.(new Date),"aria-label":L._({id:"roster.header.aria.goToToday"}),children:t.jsx(fn,{className:"size-4"})})}),t.jsx(ht,{children:t.jsx("p",{children:t.jsx(J,{id:"roster.header.tooltip.goToToday"})})})]}),t.jsx(bt,{variant:"outline",size:"icon",onClick:()=>
53n?.(jt(o,1)),"aria-label":L._({id:"roster.header.aria.goToNextDay"}),children:t.jsx(zs,{})})]}),c&&t.jsxs("div",{className:"flex items-center gap-1 text-sm print:hidden",children:[t.jsxs("select",{value:r,onChange:X=>{const ge=X.target.value,ce=Math.min(1440,Ss(ge)+60),Ce=Ss(Ie)<ce?ri(ce):Ie;c(ge,Ce)},"aria-label":L._({id:"roster.header.aria.startTime"}),className:"border-border rounded border bg-transparent px-1.5 py-1 text-xs",children:[!ie.includes(r)&&t.jsx("option",{value:r,children:q(r)}),ie.map(X=>t.jsx("option",{value:X,children:q(X)},X))]}),t.jsx("span",{className:"text-zinc-400",children:t.jsx(J,{id:"roster.header.dayViewTimeTo"})}),t.jsxs("select",{value:Ie,onChange:X=>c(r,X.target.value),"aria-label":L._({id:"roster.header.aria.endTime"}),className:"border-border rounded border bg-transparent px-1.5 py-1 text-xs",children:[!de.includes(Ie)&&t.jsx("option",{value:Ie,children:ne(Ie)}),de.map(X=>t.jsx("option",{value:X,children:ne(X)},X))]})]})]}):e==="month"?t.jsx(Vr,{selectedMonth:d,onMonthChange:a,onMonthSelect:l,goToCurrentMonth:f}):t.jsxs(t.Fragment,{children:[t.jsx(Kr,{week:h,onSelect:X=>{X&&B(X)},placeholder:L._({id:"roster.header.selectWeekPlaceholder"}),children:t.jsxs(bt,{variant:"link",className:"h-auto px-1 py-0 text-2xl font-bold whitespace-nowrap",children:[t.jsx(J,{id:"roster.header.weekWord"})," ",h.week]})}),t.jsxs(Cs,{children:[t.jsx(bt,{variant:"outline",size:"icon",onClick:()=>A("prev"),"aria-label":L._({id:"roster.header.aria.goToPreviousWeek"}),children:t.jsx(mn,{})}),t.jsxs(mt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(bt,{variant:"outline",size:"icon",onClick:R,"aria-label":L._({id:"roster.header.aria.goToCurrentWeek"}),children:t.jsx(fn,{className:"size-4"})})}),t.jsx(ht,{children:t.jsx("p",{children:t.jsx(J,{id:"roster.header.tooltip.goToCurrentWeek"})})})]}),t.jsx(bt,{variant:"outline",size:"icon",onClick:()=>A("next"),"aria-label":L._({id:"roster.header.aria.goToNextWeek"}),children:t.jsx(zs,{})})]})]}),re?t.jsx("div",{className:"hidden sm:contents",children:re}):null]}),t.jsx(Pr,{viewMode:e,branchSelect:re,selectedBranchId:S,branches:y,companyRoles:g,tags:u,addresses:x,selectedRoleFilterIds:b,selectedTagFilterIds:v,selectedAddressFilterIds:j,onToggleRoleFilter:w,onToggleTagFilter:C,onToggleAddressFilter:D,onClearFilters:_,onViewModeChange:s,groupByRole:Q,onToggleGroupByRole:$,hideEmptyRows:E,onToggleHideEmptyRows:I,hiddenEmptyRowsCount:P,isWeekPublished:le,publishedCount:U,totalBranches:te,openPublishConfirm:Se,onExportWeekPdf:G,isExportingWeekPdf:k,onExportMonthPdf:T,isExportingMonthPdf:W,onClearWeek:F,onClearDay:H,clearIsPending:M})]}),t.jsx(be,{})]})}function qr(){if(typeof navigator>"u")return"Alt";const i=navigator.userAgentData?.platform||navigator.platform||navigator.userAgent;return/mac|iphone|ipad|ipod/i.test(i)?"â¥":"Alt"}function Xr(i){const e=je.c(13),{activeShift:s,companyRoles:o,viewMode:n,isMoveModifierActive:d}=i,a=d===void 0?!1:d;if(!s)return null;let l;if(e[0]!==s||e[1]!==o){let y;e[3]!==s?(y=g=>g._id===s.companyRoleId,e[3]=s,e[4]=y):y=e[4],l=o.find(y),e[0]=s,e[1]=o,e[2]=l}else l=e[2];const f=l,r=f?.name||"",m=f?.color||"slate",c=s!=null&&!s.assignedEmployeeId;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h={duration:125,easing:"ease"},e[5]=h):h=e[5];let p;return e[6]!==s||e[7]!==a||e[8]!==c||e[9]!==m||e[10]!==r||e[11]!==n?(p=t.jsx(Fo,{dropAnimation:h,children:n==="month"?t.jsx(Zr,{shift:s,color:m,isMove:a,isOpenShift:c}):n==="day"?t.jsx(ec,{shift:s,roleName:r,color:m}):t.jsx(Wo,{shift:s,companyRoleName:r,color:m})}),e[6]=s,e[7]=a,e[8]=c,e[9]=m,e[10]=r,e[11]=n,e[12]=p):p=e[12],p}function Zr(i){const e=je.c(24),{shift:s,color:o,isMove:n,isOpenShift:d}=i,{timeFormat:a}=Wt(),l=`var(--${o}-9)`,f=`var(--${o}-3)`,r=`var(--${o}-6)`;let m;e[0]!==l||e[1]!==f||e[2]!==r?(m={"--chip-edge":l,"--chip-bg":f,"--chip-border":r},e[0]=l,e[1]=f,e[2]=r,e[3]=m):m=e[3];const c=m;let h;e[4]!==s.startTime||e[5]!==a?(h=Gn(s.startTime,a),e[4]=s.startTime,e[5]=a,e[6]=h):h=e[6];let p;e[7]!==h?(p=t.jsx("span",{className:"text-slate-12 text-[10px]",children:h}),e[7]=h,e[8]=p):p=e[8];let y;e[9]!==s.endTime||e[10]!==a?(y=Gn(s.endTime,a),e[9]=s.endTime,e[10]=a,e[11]=y):y=e[11];let g;e[12]!==y?(g=t.jsx("span",{className:"text-slate-11 text-[10px]",children:y}),e[12]=y,e[13]=g):g=e[13];let u;e[14]!==c||e[15]!==p||e[16]!==g?(u=t.jsxs("div",{className:"flex w-12 flex-col items-start justify-center overflow-hidden rounded-xs border border-t-2 border-(--chip-border) border-t-(--chip-edge) bg-(--chip-bg) px-1 py-0.5 text-left leading-tight font-medium tabular-nums shadow-lg",style:c,children:[p,g]}),e[14]=c,e[15]=p,e[16]=g,e[17]=u):u=e[17];let x;e[18]!==n||e[19]!==d?(x=t.jsx(Jr,{isMove:n,isOpenShift:d}),e[18]=n,e[19]=d,e[20]=x):x=e[20];let b;return e[21]!==u||e[22]!==x?(b=t.jsxs("div",{className:"flex flex-col items-start gap-1",children:[u,x]}),e[21]=u,e[22]=x,e[23]=b):b=e[23],b}function Jr(i){const e=je.c(12),{isMove:s,isOpenShift:o}=i;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=qr(),e[0]=n):n=e[0];const d=n,a=s||o,l=a?"bg-blue-9":"bg-green-9";let f;e[1]!==l?(f=Be("flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium whitespace-nowrap text-white shadow-md",l),e[1]=l,e[2]=f):f=e[2];let r;e[3]!==a?(r=a?t.jsx(Dn,{className:"size-3"}):t.jsx(Cn,{className:"size-3"}),e[3]=a,e[4]=r):r=e[4];let m;e[5]!==s||e[6]!==o?(m=o?t.jsx(J,{id:"roster.month.drag.move"}):s?t.jsx(J,{id:"roster.month.drag.moveHint",values:{altKey:d}}):t.jsx(J,{id:"roster.month.drag.copyHint",values:{altKey:d}}),e[5]=s,e[6]=o,e[7]=m):m=e[7];let c;return e[8]!==f||e[9]!==r||e[10]!==m?(c=t.jsxs("span",{className:f,children:[r,m]}),e[8]=f,e[9]=r,e[10]=m,e[11]=c):c=e[11],c}function ec(i){const e=je.c(20),{shift:s,roleName:o,color:n}=i,{formatRange:d}=Wt(),a=s.workedMinutes===void 0?null:s.workedMinutes/60;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Be("flex h-8 w-56 items-center gap-1 overflow-hidden rounded-lg px-2 text-xs font-medium tabular-nums shadow-lg","bg-(--bar-bg) text-(--bar-text)"),e[0]=l):l=e[0];const f=`var(--${n}-3)`,r=`var(--${n}-12)`,m=`3px solid var(--${n}-9)`;let c;e[1]!==f||e[2]!==r||e[3]!==m?(c={"--bar-bg":f,"--bar-text":r,borderLeft:m},e[1]=f,e[2]=r,e[3]=m,e[4]=c):c=e[4];const h=c,p=o?`${o} · `:"";let y;e[5]!==d||e[6]!==s.endTime||e[7]!==s.startTime?(y=d(s.startTime,s.endTime),e[5]=d,e[6]=s.endTime,e[7]=s.startTime,e[8]=y):y=e[8];let g;e[9]!==p||e[10]!==y?(g=t.jsxs("span",{className:"min-w-0 truncate",children:[p,y]}),e[9]=p,e[10]=y,e[11]=g):g=e[11];let u;e[12]!==a?(u=a===null?"â¦":Kt(a),e[12]=a,e[13]=u):u=e[13];let x;e[14]!==u?(x=t.jsx("span",{className:"text-slate-11 shrink-0",children:u}),e[14]=u,e[15]=x):x=e[15];let b;return e[16]!==x||e[17]!==h||e[18]!==g?(b=t.jsxs("div",{className:l,style:h,children:[g,x]}),e[16]=x,e[17]=h,e[18]=g,e[19]=b):b=e[19],b}function tc(i,e,s,o,n=!0){const d=Oe(i,Je),a=Oe(e,Je),{data:l}=ut({...Ye(De.publication.getPublishedRangesForDateRange,{startDate:d,endDate:a}),enabled:n}),f=ee.useMemo(()=>{const m={};for(const c of l??[])c.kind==="week"&&c.branchId&&(m[c.startDate]??=new Set).add(c.branchId);return m},[l]);return{isWeekPublished:ee.useMemo(()=>m=>{const c=f[m];return!c||c.size===0?!1:o?c.has(o):c.size===s.length},[f,o,s.length])}}function sc(i){const e="seriesId"in i?i.seriesId:void 0;return e?`${e}:${i.date}`:`${i._id}:${i.date}`}function nc(i,e,s,o,n=!0,d){const a=d?.employeeOpenShiftsEnabled??!1,l=d?.shiftFilters??Nn,{data:f}=Vt(Ye(De.employees.listAll,{visibleInRoster:!0})),{data:r}=Vt(Ye(De.companyRoles.listAll,{})),{data:m}=Vt(Ye(De.addresses.listAll,{includeArchived:!0})),{data:c}=Vt(Ye(De.tags.listAll,{})),h=Oe(i,Je),p=Oe(e,Je),y=ee.useMemo(()=>f.map(E=>E._id),[f]),g=ut({...Ye(De.shifts.listByDateRangeAndEmployeeIdsFlat,{employeeIds:y,startDate:h,endDate:p,branchId:o}),enabled:n}),u=ut({...Ye(De.shifts.listByDateRangeAndEmployeeIdsFlat,{employeeIds:y,startDate:h,endDate:p}),enabled:n&&!!o}
53),x=ut({...Ye(De.absences.listAbsencesForPlan,{startDate:h,endDate:p,employeeIds:y}),enabled:n}),b=ut({...Ye(De.availabilities.listAvailabilities,{startDate:h,endDate:p,employeeIds:y}),enabled:n}),v=ut({...Ye(De.openShifts.listVisibleOpenShifts,{startDate:h,endDate:p,branchId:o}),enabled:n&&a}),j=g.data??[],w=o?u.data??[]:j,C=ee.useMemo(()=>Us(j,l),[j,l]),D=ee.useMemo(()=>Us(w,l),[w,l]),_=x.data??[],S=b.data??[],N=g.isPending||(o?u.isPending:!1),B=ee.useMemo(()=>fa({start:i,end:e}),[i,e]),A=ee.useMemo(()=>B.map(E=>Oe(E,Je)),[B]),R=ee.useMemo(()=>{let E=f;return o&&(E=E.filter(I=>I.branches.some(P=>P._id===o))),s&&(E=E.filter(I=>Ii(I.name,s))),E},[f,s,o]),F=ee.useMemo(()=>{const E={};for(const I of R)E[I._id]={};for(const I of C){if(!I.assignedEmployeeId)continue;const P=E[I.assignedEmployeeId];P&&(P[I.date]??=[]).push(I)}return E},[C,R]),H=ee.useMemo(()=>{const E={};for(const I of R)E[I._id]=[];for(const I of D)I.assignedEmployeeId&&E[I.assignedEmployeeId]?.push(I);return E},[D,R]),M=ee.useMemo(()=>{const E={};for(const I of R)E[I._id]={};for(const I of _){const P=E[I.employeeId];if(!P)continue;const G=new Date(I.startAt),k=new Date(I.endAt),T={start:new Date(G.getFullYear(),G.getMonth(),G.getDate()),end:new Date(k.getFullYear(),k.getMonth(),k.getDate())};B.forEach((W,L)=>{zi(W,T)&&(P[A[L]]??=[]).push(I)})}return E},[_,R,B,A]),O=ee.useMemo(()=>{const E={},I={};for(const P of R)E[P._id]={},I[P._id]={};for(const P of S){const G=E[P.employeeId];if(!G)continue;const k=I[P.employeeId];B.forEach((T,W)=>{if(!pi(P,T))return;const L=A[W],q=sc(P),Z=k[L]??=new Set;Z.has(q)||(Z.add(q),(G[L]??=[]).push(P))})}return E},[S,R,B,A]),Q=ee.useMemo(()=>{const E={};for(const I of C)I.assignedEmployeeId||(E[I.date]??=[]).push(I);return E},[C]),$=ee.useMemo(()=>{const E={},I=new Date;for(const P of v.data??[])ki(P,I)&&hs(P,l)&&(E[P.shiftDate]??=[]).push(P);return E},[l,v.data]);return{employees:f,companyRoles:r,addresses:m,tags:c,filteredEmployees:R,flatShifts:j,allLocationFlatShifts:w,monthDates:B,monthDateStrings:A,shiftsByEmployeeByDate:F,allLocationShiftsByEmployee:H,absencesByEmployeeByDate:M,availabilitiesByEmployeeByDate:O,managerOpenShiftsByDate:Q,employeeOpenShiftsByDate:$,isLoading:N}}function ic(i){const e=je.c(59),{viewMode:s,deferredSearchTerm:o,selectedBranchId:n,branches:d,employees:a,currentContractDate:l,hideEmptyRows:f,shiftFilters:r,canManageShifts:m,analytics:c,setWeekYear:h,showWeekView:p,openPublishWeekDialog:y}=i,g=s==="month",{startOfMonthDate:u,endOfMonthDate:x,selectMonth:b,handleMonthChange:v,goToCurrentMonth:j}=ga(),w=g&&!m;let C;e[0]!==r||e[1]!==w?(C={employeeOpenShiftsEnabled:w,shiftFilters:r},e[0]=r,e[1]=w,e[2]=C):C=e[2];const D=nc(u,x,o,n,g,C),{isWeekPublished:_}=tc(u,x,d,n,g);let S;e[3]!==l||e[4]!==a?(S=Ye(De.employeeContracts.listMonthlyQuotaMinutes,{employeeIds:a.map(cc),atDate:l}),e[3]=l,e[4]=a,e[5]=S):S=e[5];const N=g&&a.length>0;let B;e[6]===Symbol.for("react.memo_cache_sentinel")?(B={},e[6]=B):B=e[6];let A;e[7]!==S||e[8]!==N?(A={...S,enabled:N,placeholderData:B},e[7]=S,e[8]=N,e[9]=A):A=e[9];const R=ut(A);let F;e[10]!==R.data?(F=Object.fromEntries(Object.entries(R.data??{}).map(rc)),e[10]=R.data,e[11]=F):F=e[11];const H=F;let M;e[12]!==a||e[13]!==u?(M=Ye(De.timesheets.index.getTimeAccountBalancesAtDate,{employeeIds:a.map(lc),atDate:Oe(u,Je)}),e[12]=a,e[13]=u,e[14]=M):M=e[14];const O=g&&a.length>0;let Q;e[15]!==M||e[16]!==O?(Q={...M,enabled:O},e[15]=M,e[16]=O,e[17]=Q):Q=e[17];const{data:$}=ut(Q);let E;e[18]!==l||e[19]!==a?(E=Ye(De.employeeContracts.listWeekdayQuotaMinutes,{employeeIds:a.map(ac),atDate:l}),e[18]=l,e[19]=a,e[20]=E):E=e[20];const I=(s==="week"||s==="month")&&a.length>0;let P;e[21]===Symbol.for("react.memo_cache_sentinel")?(P={},e[21]=P):P=e[21];let G;e[22]!==E||e[23]!==I?(G={...E,enabled:I,placeholderData:P},e[22]=E,e[23]=I,e[24]=G):G=e[24];const k=ut(G);let T;e[25]!==k.data?(T=k.data??{},e[25]=k.data,e[26]=T):T=e[26];const W=T;let L;e:{if(!f){L=0;break e}let de=0;for(const re of D.filteredEmployees){if(!re.isVisibleInRoster)continue;const Se=D.shiftsByEmployeeByDate[re._id];Se&&Object.values(Se).some(oc)||(de=de+1)}L=de}const q=L,Z=ao();let ne;e[27]!==h||e[28]!==p?(ne=de=>{h(as(de)),p()},e[27]=h,e[28]=p,e[29]=ne):ne=e[29];const Y=ne;let ae;e[30]!==c||e[31]!==y||e[32]!==Z?(ae=de=>{const{weekStartDate:re,weekStartStr:Se,weekEndStr:X,isPublished:ge}=de;c.capture("month_week_publish_dialog_opened",{startDate:Se,endDate:X}),y({startOfWeekDate:re,weekStartStr:Se,weekEndStr:X,isWeekPublished:ge,onConfirm:ce=>{const{published:Ce,branchIds:Ee}=ce;return Z.mutateAsync({startDate:Se,endDate:X,published:Ce,branchIds:Ee})}})},e[30]=c,e[31]=y,e[32]=Z,e[33]=ae):ae=e[33];const le=ae;let U;e[34]!==c||e[35]!==b?(U=de=>{c.capture("month_selected",{month:Oe(de,Je)}),b(de)},e[34]=c,e[35]=b,e[36]=U):U=e[36];const te=U;let se;e[37]!==b?(se=de=>{b(de)},e[37]=b,e[38]=se):se=e[38];const oe=se;let be;e[39]!==c||e[40]!==v?(be=de=>{c.capture("month_navigate",{direction:de}),v(de)},e[39]=c,e[40]=v,e[41]=be):be=e[41];const ie=be;let fe;e[42]!==c||e[43]!==j?(fe=()=>{c.capture("month_go_to_current"),j()},e[42]=c,e[43]=j,e[44]=fe):fe=e[44];const he=fe;let Ie;return e[45]!==ie||e[46]!==H||e[47]!==W||e[48]!==he||e[49]!==le||e[50]!==Y||e[51]!==_||e[52]!==D||e[53]!==q||e[54]!==$||e[55]!==te||e[56]!==u||e[57]!==oe?(Ie={startOfMonthDate:u,monthData:D,isMonthWeekPublished:_,monthFilteredEmployees:D.filteredEmployees,monthHiddenEmptyRowsCount:q,employeeMonthlyQuotaHoursById:H,monthTimeAccountBalances:$,employeeWeekdayQuotaMinutesById:W,selectRosterMonth:te,syncRosterMonthToDate:oe,changeRosterMonth:ie,goToCurrentRosterMonth:he,handleNavigateToWeekView:Y,handleMonthWeekPublishClick:le},e[45]=ie,e[46]=H,e[47]=W,e[48]=he,e[49]=le,e[50]=Y,e[51]=_,e[52]=D,e[53]=q,e[54]=$,e[55]=te,e[56]=u,e[57]=oe,e[58]=Ie):Ie=e[58],Ie}function oc(i){return i.length>0}function ac(i){return i._id}function lc(i){return i._id}function rc(i){const[e,s]=i;return[e,s/60]}function cc(i){return i._id}function nn(i){return(i??"").split(",").map(e=>e.trim()).filter(e=>!!e)}function on(i){return i.length>0?i.join(","):void 0}function an(i,e){const s=new Set(i);return s.has(e)?s.delete(e):s.add(e),Array.from(s.values())}function dc(i){const e=je.c(37),{roleIdsSearch:s,tagIdsSearch:o,addressIdsSearch:n,onSearchChange:d}=i;let a;e[0]!==s?(a=nn(s),e[0]=s,e[1]=a):a=e[1];const l=a;let f;e[2]!==l?(f=new Set(l),e[2]=l,e[3]=f):f=e[3];const r=f;let m;e[4]!==o?(m=nn(o),e[4]=o,e[5]=m):m=e[5];const c=m;let h;e[6]!==c?(h=new Set(c),e[6]=c,e[7]=h):h=e[7];const p=h;let y;e[8]!==n?(y=nn(n),e[8]=n,e[9]=y):y=e[9];const g=y;let u;
53e[10]!==g?(u=new Set(g),e[10]=g,e[11]=u):u=e[11];const x=u;let b;e[12]!==x||e[13]!==r||e[14]!==p?(b={roleIds:r,tagIds:p,addressIds:x},e[12]=x,e[13]=r,e[14]=p,e[15]=b):b=e[15];const v=b;let j;e[16]!==d||e[17]!==l?(j=R=>{d({roleIds:on(an(l,R))})},e[16]=d,e[17]=l,e[18]=j):j=e[18];const w=j;let C;e[19]!==d||e[20]!==c?(C=R=>{d({tagIds:on(an(c,R))})},e[19]=d,e[20]=c,e[21]=C):C=e[21];const D=C;let _;e[22]!==d||e[23]!==g?(_=R=>{d({addressIds:on(an(g,R))})},e[22]=d,e[23]=g,e[24]=_):_=e[24];const S=_;let N;e[25]!==d?(N=()=>{d({roleIds:void 0,tagIds:void 0,addressIds:void 0})},e[25]=d,e[26]=N):N=e[26];const B=N;let A;return e[27]!==B||e[28]!==g||e[29]!==r||e[30]!==l||e[31]!==c||e[32]!==v||e[33]!==S||e[34]!==w||e[35]!==D?(A={selectedRoleFilterIds:l,selectedRoleFilterIdSet:r,selectedTagFilterIds:c,selectedAddressFilterIds:g,shiftFilters:v,toggleRoleFilter:w,toggleTagFilter:D,toggleAddressFilter:S,clearFilters:B},e[27]=B,e[28]=g,e[29]=r,e[30]=l,e[31]=c,e[32]=v,e[33]=S,e[34]=w,e[35]=D,e[36]=A):A=e[36],A}const{saveAs:po}=ka;function yo(i){return Array.from({length:7},(e,s)=>{const o=jt(i,s);return{date:o,dateKey:Oe(o,Je)}})}function mc(i){return Sn(jt(i,3))}function fc(i){const e=Sn(i),s=bi(e),o=[];for(let n=Qt(e);n<=s;n=jt(n,7))o.push({days:yo(n).map(d=>({...d,isOutsideMonth:!_s(d.date,e)})),startDate:n});return o}function go({branches:i,companyRoles:e,employees:s,exportDays:o,flatShifts:n,labels:d,locale:a,shiftFilters:l,visibleEmployees:f}){const r=new Map(s.map(u=>[u._id,u.name])),m=new Set(f.map(u=>u._id)),c=new Map(e.map(u=>[u._id,u.name])),h=new Map(e.map((u,x)=>[u._id,x])),p=new Map(o.map((u,x)=>[u.dateKey,x])),y=n.filter(u=>!p.has(u.date)||!hs(u,l)?!1:u.assignedEmployeeId?m.has(u.assignedEmployeeId):!0);return{locations:i.filter(u=>y.some(x=>x.branchId===u._id)).map(u=>{const x=new Map;y.filter(v=>v.branchId===u._id).forEach(v=>{const j=v.companyRoleId?c.get(v.companyRoleId)??d.unassignedRole:d.unassignedRole,w=v.companyRoleId?h.get(v.companyRoleId)??Number.MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER;x.has(j)||x.set(j,{order:w,rows:new Map});const C=x.get(j),D=v.assignedEmployeeId?v.assignedEmployeeId:`open-${yt(v)}`,_=v.assignedEmployeeId?r.get(v.assignedEmployeeId)??d.openShift:d.openShift;C.rows.has(D)||C.rows.set(D,{dayLabels:Array.from({length:7},()=>d.off),employeeName:_,sortName:_,totalHours:0});const S=C.rows.get(D),N=p.get(v.date);if(N===void 0)return;const B=`${v.startTime}-${v.endTime}`;S.dayLabels[N]=S.dayLabels[N]===d.off?B:`${S.dayLabels[N]} 54${B}`,S.totalHours+=uc(v.workedMinutes)});const b=Array.from(x.entries()).sort((v,j)=>v[1].order!==j[1].order?v[1].order-j[1].order:v[0].localeCompare(j[0],a)).map(([v,j])=>({roleName:v,rows:Array.from(j.rows.values()).sort((w,C)=>w.sortName.localeCompare(C.sortName,a)).map((w,C)=>({dayLabels:w.dayLabels,employeeName:w.employeeName,rowKey:`${v}-${w.employeeName}-${C}`,totalHoursLabel:`${pc(w.totalHours,a)}${d.hourSuffix}`}))}));return{locationAddress:u.address??void 0,locationName:u.name,roleGroups:b}}).filter(u=>u.roleGroups.length>0),shiftCount:y.length}}function hc({branches:i,employees:e,flatShifts:s,locale:o,shiftFilters:n,visibleEmployees:d}){const a=new Map(e.map(r=>[r._id,r.name])),l=new Set(d.map(r=>r._id)),f=s.filter(r=>r.assignedEmployeeId!==void 0&&l.has(r.assignedEmployeeId)&&hs(r,n));return i.map(r=>{const m=new Set(f.filter(h=>h.branchId===r._id).map(h=>h.assignedEmployeeId));return{employeeNames:Array.from(m).map(h=>a.get(h)).filter(h=>h!==void 0).sort((h,p)=>h.localeCompare(p,o)),locationAddress:r.address??void 0,locationName:r.name}}).filter(r=>r.employeeNames.length>0)}function uc(i){if(i===void 0)throw new Error("Roster shift is missing server-computed worked minutes");return i/60}function pc(i,e){return new Intl.NumberFormat(e,{minimumFractionDigits:0,maximumFractionDigits:1}).format(i)}function xo(i){return i.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function bo(i){const e=window.atob(i),s=new Uint8Array(e.length);for(let o=0;o<e.length;o+=1)s[o]=e.charCodeAt(o);return s}function yc(i){const e=bo(i.base64),s=xo(i.fileStem)||"roster-week";po(new Blob([e],{type:"application/pdf"}),`${s}.pdf`)}function gc(i){const e=bo(i.base64),s=xo(i.fileStem)||"roster-month";po(new Blob([e],{type:"application/pdf"}),`${s}.pdf`)}const xc={id:"roster.export.openShift"},bc={id:"roster.export.off"},Sc={id:"roster.export.unassignedRole"},jc={id:"roster.export.hourSuffix"},vc={id:"roster.export.month.title"},wc={id:"roster.export.month.weekPeriod"},_c={id:"roster.export.noShifts"},ci={id:"roster.export.col.employee"},kc={id:"roster.export.col.hours"},Cc={id:"roster.export.signature.title"},Dc={id:"roster.export.col.signature"},Ic={id:"roster.export.col.date"},Tc={id:"roster.export.generatingPdf"},Nc={id:"roster.export.downloadingPdf"},Mc={id:"roster.export.pdfFailed"};function Ec(i){const e=je.c(26),{branches:s,companyRoles:o,employees:n,visibleEmployees:d,selectedBranchId:a,shiftFilters:l,startOfWeekDate:f,explicitMonthDate:r}=i,{i18n:m}
54=at(),c=Ns(),h=ps(),p=Mo(),y=Si(De.pdf.rosterMonth.generate),g=Fi();let u;e[0]!==r||e[1]!==f?(u=r??mc(f),e[0]=r,e[1]=f,e[2]=u):u=e[2];const x=u;let b;e[3]!==x?(b=fc(x),e[3]=x,e[4]=b):b=e[4];const v=b;let j;e[5]!==h||e[6]!==s||e[7]!==o||e[8]!==p||e[9]!==n||e[10]!==v||e[11]!==y||e[12]!==m||e[13]!==c||e[14]!==g||e[15]!==a||e[16]!==l||e[17]!==x||e[18]!==d?(j={mutationFn:async()=>{const S=await p.query(De.shifts.listByDateRangeAndEmployeeIdsFlat,{branchId:a,employeeIds:n.map($c),startDate:Oe(x,Je),endDate:Oe(bi(x),Je)}),N=ji(m.locale),B=c(xc),A=c(bc),R=We(x,{month:"long",year:"numeric"},m.locale),F=c(vc,{month:R}),H=hc({branches:s,employees:n,flatShifts:S,locale:m.locale,shiftFilters:l,visibleEmployees:d});let M=0;const O=v.map($=>{const E=go({branches:s,companyRoles:o,employees:n,exportDays:$.days,flatShifts:S,labels:{hourSuffix:c(jc),off:A,openShift:B,unassignedRole:c(Sc)},locale:m.locale,shiftFilters:l,visibleEmployees:d});return M=M+E.shiftCount,{days:$.days.map(I=>({dateLabel:We(I.date,{day:"numeric",month:"short"},m.locale),isOutsideMonth:I.isOutsideMonth,weekdayLabel:We(I.date,{weekday:"short"},m.locale)})),locations:E.locations,periodLabel:c(wc,{start:We($.startDate,{day:"numeric",month:"long"},m.locale),end:We($.days[6].date,{day:"numeric",month:"long",year:"numeric"},m.locale)})}});h.capture("roster_export_month_pdf",{branchId:a,locationCount:new Set(O.flatMap(Ac)).size,month:x.getMonth()+1,shiftCount:M,signatureEmployeeCount:H.reduce(Rc,0),weekCount:O.length,year:x.getFullYear()});const Q={companyName:g.name,copy:{colEmployeeLabel:c(ci),colHoursLabel:c(kc),generatedLabel:c({id:"roster.export.generatedLine"},{date:We(new Date,{day:"numeric",month:"short",year:"numeric"},m.locale)}),noShiftsLabel:c(_c),title:F},fileStem:`roster-month-${Oe(x,"yyyy-MM")}`,locale:N,offLabel:A,signatureSheet:{copy:{colDateLabel:c(Ic),colEmployeeLabel:c(ci),colSignatureLabel:c(Dc),title:c(Cc,{month:R})},locations:H},weeks:O};return y(Q)}},e[5]=h,e[6]=s,e[7]=o,e[8]=p,e[9]=n,e[10]=v,e[11]=y,e[12]=m,e[13]=c,e[14]=g,e[15]=a,e[16]=l,e[17]=x,e[18]=d,e[19]=j):j=e[19];const w=es(j);let C;e[20]!==w||e[21]!==c?(C=async()=>{const S=St.loading(c(Tc));try{const N=await w.mutateAsync();St.success(c(Nc),{id:S}),gc({base64:N.base64,fileStem:N.fileStem})}catch{St.error(c(Mc),{id:S})}},e[20]=w,e[21]=c,e[22]=C):C=e[22];const D=C;let _;return e[23]!==D||e[24]!==w.isPending?(_={exportMonthPdf:D,isExportingMonthPdf:w.isPending},e[23]=D,e[24]=w.isPending,e[25]=_):_=e[25],_}function Rc(i,e){return i+e.employeeNames.length}function Ac(i){return i.locations.map(Bc)}function Bc(i){return i.locationName}function $c(i){return i._id}function Oc(){return Array.from({length:7},()=>[])}function di(i,e){const s=Oc();return i.forEach(o=>{const n=ts(e(o));if(!n)return;const d=Ts(n)-1;d>=0&&d<7&&s[d]?.push(o)}),s}function Pc(i){const e=je.c(25),{startOfWeekDate:s,selectedBranchId:o,shiftFilters:n,flatShifts:d,canManageShifts:a}=i;let l;e[0]!==o||e[1]!==s?(l=Ye(De.openShifts.listVisibleOpenShifts,{startDate:Oe(s,Je),endDate:Oe(jt(s,6),Je),branchId:o}),e[0]=o,e[1]=s,e[2]=l):l=e[2];const f=!a;let r;e[3]!==l||e[4]!==f?(r={...l,enabled:f},e[3]=l,e[4]=f,e[5]=r):r=e[5];const{data:m}=ut(r);let c;e[6]!==m?(c=m===void 0?[]:m,e[6]=m,e[7]=c):c=e[7];const h=c;let p;if(e[8]!==d||e[9]!==n){let C;e[11]!==n?(C=D=>D.assignedEmployeeId?!1:hs(D,n),e[11]=n,e[12]=C):C=e[12],p=d.filter(C),e[8]=d,e[9]=n,e[10]=p}else p=e[10];const y=p;let g;if(e[13]!==n||e[14]!==h){const C=new Date,D=h.filter(S=>ki(S,C));let _;e[16]!==n?(_=S=>hs(S,n),e[16]=n,e[17]=_):_=e[17],g=D.filter(_),e[13]=n,e[14]=h,e[15]=g}else g=e[15];const u=g;let x;e[18]!==y?(x=di(y,Fc),e[18]=y,e[19]=x):x=e[19];const b=x;let v;e[20]!==u?(v=di(u,Lc),e[20]=u,e[21]=v):v=e[21];const j=v;let w;return e[22]!==j||e[23]!==b?(w={managerOpenShiftsByDay:b,employeeOpenShiftsByDay:j},e[22]=j,e[23]=b,e[24]=w):w=e[24],w}function Lc(i){return i.shiftDate}function Fc(i){return i.date}const Wc={id:"roster.export.openShift"},zc={id:"roster.export.off"},Hc={id:"roster.export.unassignedRole"},Vc={id:"roster.export.hourSuffix"},Qc={id:"roster.export.title"},Uc={id:"roster.export.noShifts"},Gc={id:"roster.export.col.employee"},Kc={id:"roster.export.col.hours"},Yc={id:"roster.export.generatingPdf"},qc={id:"roster.export.downloadingPdf"},Xc={id:"roster.export.pdfFailed"};function Zc(i){const e=je.c(24),{branches:s,companyRoles:o,employees:n,flatShifts:d,visibleEmployees:a,selectedBranchId:l,shiftFilters:f,startOfWeekDate:r,weekYear:m}=i,{i18n:c}=at(),h=Ns(),p=ps(),y=Si(De.pdf.rosterWeek.generate);let g;e[0]!==y?(g={mutationFn:y},e[0]=y,e[1]=g):g=e[1];const u=es(g),x=Fi();let b;e[2]!==r?(b=yo(r),e[2]=r,e[3]=b):b=e[3];const v=b;let j;e[4]!==p||e[5]!==s||e[6]!==o||e[7]!==n||e[8]!==v||e[9]!==u||e[10]!==d||e[11]!==c||e[12]!==h||e[13]!==x.name||e[14]!==l||e[15]!==f||e[16]!==r||e[17]!==a||e[18]!==m.week||e[19]!==m.year?(j=async()=>{const D=h(Wc),_=h(zc),S=h(Vc),N=ji(c.locale),{locations:B,shiftCount:A}=go({branches:s,companyRoles:o,employees:n,exportDays:v,flatShifts:d,labels:{hourSuffix:S,off:_,openShift:D,unassignedRole:h(Hc)},locale:c.locale,shiftFilters:f,visibleEmployees:a});p.capture("roster_export_pdf",{branchId:l,locationCount:B.length,shiftCount:A,week:m.week,year:m.year});const R={companyName:x.name,copy:{colEmployeeLabel:h(Gc),colHoursLabel:h(Kc),generatedLabel:h({id:"roster.export.generatedLine"},{date:We(new Date,{day:"numeric",month:"short",year:"numeric"},c.locale)}),noShiftsLabel:h(Uc),title:h(Qc)},days:v.map(H=>({dateLabel:We(H.date,{day:"numeric",month:"short"},c.locale),weekdayLabel:We(H.date,{weekday:"short"},c.locale)})),fileStem:`roster-week-${m.year}-${String(m.week).padStart(2,"0")}`,locale:N,locations:B,offLabel:_,periodLabel:c._({id:"roster.export.periodLabel",message:"{start} - {end}",values:{start:We(r,{day:"numeric",month:"short"},c.locale),end:We(jt(r,6),{day:"numeric",month:"short",year:"numeric"},c.locale)}})},F=St.loading(h(Yc));try{const H=await u.mutateAsync(R);St.success(h(qc),{id:F}),yc({base64:H.base64,fileStem:H.fileStem})}catch{St.error(h(Xc),{id:F})}},e[4]=p,e[5]=s,e[6]=o,e[7]=n,e[8]=v,e[9]=u,e[10]=d,e[11]=c,e[12]=h,e[13]=x.name,e[14]=l,e[15]=f,e[16]=r,e[17]=a,e[18]=m.week,e[19]=m.year,e[20]=j):j=e[20];const w=j;let C;return e[21]!==u.isPending||e[22]!==w?(C={exportWeekPdf:w,isExportingWeekPdf:u.isPending},e[21]=u.isPending,e[22]=w,e[23]=C):C=e[23],C}
54function Jc(i){const e=je.c(13),{startOfWeekDate:s,selectedDay:o,confirmDialog:n,clearShifts:d}=i,{i18n:a}=at();let l;e[0]!==d||e[1]!==n||e[2]!==a||e[3]!==s?(l=()=>{const h=Oe(s,Je),p=jt(s,6),y=Oe(p,Je);n({title:a._({id:"roster.dialog.clearWeek.title"}),message:t.jsx("div",{className:"text-sm leading-relaxed",children:t.jsx("p",{children:a._({id:"roster.dialog.clearWeek.body",message:"This will permanently remove all shifts from {start} to {end}. This action cannot be undone.",values:{start:We(s,{weekday:"short",month:"short",day:"numeric"},a.locale),end:We(p,{weekday:"short",month:"short",day:"numeric"},a.locale)}})})}),cancelText:a._({id:"roster.dialog.clearWeek.cancel"}),cancelIcon:t.jsx(vs,{className:"h-4 w-4"}),actions:[{label:a._({id:"roster.dialog.clearWeek.confirm"}),variant:"destructive",icon:t.jsx(vs,{className:"h-4 w-4"}),onClick:()=>d({startDate:h,endDate:y})}]})},e[0]=d,e[1]=n,e[2]=a,e[3]=s,e[4]=l):l=e[4];const f=l;let r;e[5]!==d||e[6]!==n||e[7]!==a||e[8]!==o?(r=()=>{const h=Oe(o,Je);n({title:a._({id:"roster.dialog.clearDay.title"}),message:t.jsx("div",{className:"text-sm leading-relaxed",children:t.jsx("p",{children:a._({id:"roster.dialog.clearDay.body",message:"This will permanently remove all shifts on {day}. This action cannot be undone.",values:{day:We(o,{weekday:"long",month:"short",day:"numeric"},a.locale)}})})}),cancelText:a._({id:"roster.dialog.clearDay.cancel"}),cancelIcon:t.jsx(vs,{className:"h-4 w-4"}),actions:[{label:a._({id:"roster.dialog.clearDay.confirm"}),variant:"destructive",icon:t.jsx(vs,{className:"h-4 w-4"}),onClick:()=>d({startDate:h,endDate:h})}]})},e[5]=d,e[6]=n,e[7]=a,e[8]=o,e[9]=r):r=e[9];const m=r;let c;return e[10]!==m||e[11]!==f?(c={handleClearWeek:f,handleClearDay:m},e[10]=m,e[11]=f,e[12]=c):c=e[12],c}const ed=Yt().transform(i=>i),td=Yt().transform(i=>i),sd=Yt().transform(i=>i),nd=Yt().transform(i=>i),id=Yt().transform(i=>i),od=Eo({assignedEmployeeId:ed.optional(),companyRoleId:td.optional(),addressId:sd.optional(),tagIds:Ao(nd).optional(),date:Yt().nonempty(),startTime:Yt().nonempty(),endTime:Yt().nonempty(),surchargeType:Ro(["percent","hours"]).optional(),surcharge:Vn().optional(),comment:Yt().optional(),breakMinutes:Vn().min(0),branchId:id});function ad(i){const e=je.c(17),[s,o]=ee.useState(null),[n,d]=ee.useState(!1),{i18n:a}=at();let l,f;e[0]!==s?(l=()=>{if(!s)return;const j=w=>d(w.altKey);return window.addEventListener("keydown",j),window.addEventListener("keyup",j),()=>{window.removeEventListener("keydown",j),window.removeEventListener("keyup",j),d(!1)}},f=[s],e[0]=s,e[1]=l,e[2]=f):(l=e[1],f=e[2]),ee.useEffect(l,f);const r=vi(),m=ps();let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c={activationConstraint:{distance:5}},e[3]=c):c=e[3];const h=zo(Ho(Vo,c));let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=j=>{const{active:w}=j;o(w.data.current);const C=j.activatorEvent;d(!!C?.altKey)},e[4]=p):p=e[4];const y=p;let g;e[5]!==r?(g=async j=>{try{return await j(),!0}catch(w){return r(w),!1}},e[5]=r,e[6]=g):g=e[6];const u=g;let x;e[7]!==m||e[8]!==a||e[9]!==i||e[10]!==u?(x=async j=>{const{active:w,over:C}=j;if(!C||!w.id){o(null);return}const D=w.data.current,_=C.data.current;if(!D){o(null);return}const S=D,N=_?.assignedEmployeeId,B=_!=null&&Object.prototype.hasOwnProperty.call(_,"assignedEmployeeId"),A=i.groupByRole?_?.companyRoleId??S.companyRoleId:S.companyRoleId;o(null);const R=D.dragContext==="month",F=B&&N===S.assignedEmployeeId&&_?.date===S.date&&A===S.companyRoleId;if(R&&F)return;const H=_?.operation||"move",M=B&&N!==S.assignedEmployeeId,O=D.dragContext==="day-view",Q=D.dayViewHourWidth??60,$=O?Gi(j.delta.x,Q):0,E=$!==0?qa({startTime:S.startTime,endTime:S.endTime,deltaMinutes:$}):null;if(!A){St.error(a._({id:"roster.shiftDnd.roleMissing"}));return}if(M&&N&&!(i.employeeRoleIdsByEmployeeId[N]??[]).includes(A)){St.error(a._({id:"roster.shiftDnd.employeeNoRole"}));return}if(H==="copy"){const P=od.safeParse({assignedEmployeeId:N,companyRoleId:A,addressId:S.addressId,branchId:S.branchId,tagIds:S.tagIds,date:_.date,startTime:E?.startTime??S.startTime,endTime:E?.endTime??S.endTime,surchargeType:S.surchargeType,surcharge:S.surcharge,comment:S.comment,breakMinutes:S.breakMinutes});if(!P.success){m.capture("shift_drag_copy_validation_failed",{reason:P.error.message});return}if(!await u(()=>i.createShiftMutateAsync({...P.data})))return;m.capture("shift_duplicated",{source:"roster_drag_copy",originalShiftId:qt(S)?S._id:void 0,fromDate:S.date,toDate:P.data.date,assignedEmployeeId:P.data.assignedEmployeeId,companyRoleId:P.data.companyRoleId,startTime:P.data.startTime,endTime:P.data.endTime});return}const I={};if(M&&(N?I.assignedEmployeeId=N:I.clearAssignedEmployee=!0),i.groupByRole&&_?.companyRoleId&&_.companyRoleId!==S.companyRoleId&&(I.companyRoleId=_.companyRoleId),_?.date&&_.date!==S.date&&(I.date=_.date),E&&(I.startTime=E.startTime,I.endTime=E.endTime),Object.keys(I).length>0){if(cs(S)){if("clearAssignedEmployee"in I)return await u(()=>i.convertVirtualShiftToOpenShift({seriesId:S.seriesId,exceptionDate:S.date,date:I.date??S.date,companyRoleId:I.companyRoleId??S.companyRoleId,addressId:S.addressId,branchId:S.branchId,tagIds:S.tagIds,startTime:I.startTime??S.startTime,endTime:I.endTime??S.endTime,surchargeType:S.surchargeType,surcharge:S.surcharge,comment:S.comment,breakMinutes:S.breakMinutes})),void 0;if(!await u(()=>i.moveVirtualShift({id:S.virtualId,args:{...I,seriesId:S.seriesId,exceptionDate:S.date,date:_.date}})))return;m.capture("shift_drag_move_virtual_completed",{seriesId:S.seriesId,exceptionDate:S.date,toDate:_.date,toEmployeeId:_.assignedEmployeeId,toCompanyRoleId:_.companyRoleId});return}if(!qt(S)){St.error(a._({id:"roster.shiftDnd.shiftIdMissing",message:"Couldn't move that shift. Refresh and try again."})),m.capture("shift_drag_move_validation_failed",{reason:"missing_shift_id",toDate:_.date,toEmployeeId:_.assignedEmployeeId,toCompanyRoleId:_.companyRoleId});return}if(!await u(()=>i.editShift({...I,_id:S._id})))return;m.capture("shift_drag_move_completed",{shiftId:S._id,toDate:_.date,toEmployeeId:_.assignedEmployeeId,toCompanyRoleId:_.companyRoleId,changedFields:Object.keys(I)})}},e[7]=m,e[8]=a,e[9]=i,e[10]=u,e[11]=x):x=e[11];const b=x;let v;return e[12]!==s||e[13]!==b||e[14]!==n||e[15]!==h?(v={sensors:h,activeShift:s,isMoveModifierActive:n,setActiveShift:o,handleDragStart:y,handleDragEnd:b},e[12]=s,e[13]=b,e[14]=n,e[15]=h,e[16]=v):v=e[16],v}function So(i){return i.assignedEmployeeId!==void 0||i.clearAssignedEmployee===!0||i.date!==void 0||i.startTime!==void 0||i.endTime!==void 0||i.breakMinutes!==void 0}function ld(i){return`${i.startDate}:${i.endDate}:${i.branchId??"all"}:${i.employeeIds.join(",")}`}function pn(i,e){return i.date===e.date?i.startTime.localeCompare(e.startTime):i.date.localeCompare(e.date)}function rd(i,e){return i.date<e.startDate||i.date>e.endDate||e.branchId&&i.branchId!==e.branchId?!1:i.assignedEmployeeId?e.employeeIds.includes(i.assignedEmployeeId):!0}
54function js(i,e,s){const o=i.filter(n=>yt(n)!==yt(e));return rd(e,s)?[...o,e].sort(pn):o.sort(pn)}function mi(i,e){return i.filter(s=>!(qt(s)&&s._id===e))}function cd(i,e){if(!qt(i))return i;const{clearAssignedEmployee:s,...o}=e,n=s?void 0:e.assignedEmployeeId??i.assignedEmployeeId;return{...i,...o,assignedEmployeeId:n,previousEmployeeId:s||e.assignedEmployeeId!==void 0?i.assignedEmployeeId??void 0:i.previousEmployeeId,workedMinutes:So(e)?void 0:i.workedMinutes}}function dd(i,e){if(!cs(i))return i;const{clearAssignedEmployee:s,exceptionDate:o,...n}=e,d=s?void 0:e.assignedEmployeeId??i.assignedEmployeeId;return{...i,...n,assignedEmployeeId:d,previousEmployeeId:s||e.assignedEmployeeId!==void 0?i.assignedEmployeeId??void 0:i.previousEmployeeId,workedMinutes:So(e)?void 0:i.workedMinutes}}function md(i){const e=new Set,s=new Set;for(const o of i)!qt(o)||!o.assignedEmployeeId||(e.add(o.assignedEmployeeId),s.add(o.date));return{assignedEmployeeCount:e.size,daysWithShifts:s.size,isMeaningful:e.size>=3&&s.size>=3}}function fd(i){return typeof window>"u"?!1:window.sessionStorage.getItem(i)==="true"}function hd(i){typeof window>"u"||window.sessionStorage.setItem(i,"true")}function ud({startOfWeekDate:i,employees:e,branches:s,selectedBranchId:o,openDrawer:n,additionalOptimisticRanges:d=[]}){const{i18n:a}=at(),l=xi(),f=vi(),r=ps(),m=Bo(),[c,h]=ee.useState(null),[p,y]=ee.useState({}),g=ee.useMemo(()=>e.map(k=>k._id),[e]),u=ee.useMemo(()=>({employeeIds:g,startDate:Oe(i,Je),endDate:Oe(jt(i,6),Je),branchId:o}),[g,o,i]),x=ee.useMemo(()=>{const k=[u,...d.map(W=>({employeeIds:g,startDate:W.startDate,endDate:W.endDate,branchId:o}))],T=new Set;return k.filter(W=>{const L=ld(W);return T.has(L)?!1:(T.add(L),!0)})},[d,g,u,o]),b=ee.useMemo(()=>x.map(k=>({args:k,queryKey:Ye(De.shifts.listByDateRangeAndEmployeeIdsFlat,k).queryKey})),[x]),v=ee.useMemo(()=>Ye(De.shifts.listByDateRangeAndEmployeeIdsFlat,u).queryKey,[u]),j=ee.useMemo(()=>`turnozo:meaningful-rota:${u.startDate}:${u.endDate}:${o??"all"}`,[u.endDate,u.startDate,o]),w=ee.useMemo(()=>({showBranchSelection:s.length>1&&!o}),[s.length,o]),C=ss(De.shifts.createNew),D=ss(De.shifts.convertVirtualShiftToOpenShift),_=ee.useCallback(k=>{for(const T of b)m.setQueryData(T.queryKey,W=>k(W??[],T.args).sort(pn))},[b,m]),S=ee.useCallback((k,T)=>{n({shiftId:k,showBranchSelection:T.showBranchSelection})},[n]),N=ee.useCallback(k=>{y(T=>{if(!(k in T))return T;const W={...T};return delete W[k],W})},[]),B=ee.useCallback((k,T,W)=>{y(L=>({...L,[k]:T})),c?.optimisticId===k&&(N(k),h(null),S(T,c.context??W))},[N,S,c]),A=ee.useCallback(k=>{if(fd(j))return;const T=m.getQueryData(v)??[],W=md(T);W.isMeaningful&&(hd(j),r.capture("rota_meaningful_created",{startDate:u.startDate,endDate:u.endDate,branchId:o,assignedEmployeeCount:W.assignedEmployeeCount,daysWithShifts:W.daysWithShifts,...k}))},[r,j,u.endDate,u.startDate,m,o,v]),R=ee.useCallback(k=>{N(k),h(T=>T?.optimisticId===k?null:T)},[N]),F=ee.useCallback((k,T=w)=>{if(!qt(k)||!Qn(k._id)){n({shift:k,showBranchSelection:T.showBranchSelection});return}const W=p[k._id];if(W){N(k._id),h(L=>L?.optimisticId===k._id?null:L),S(W,T);return}h({optimisticId:k._id,context:T}),St.info(a._({id:"roster.toast.creatingShift",message:"Creating shift..."}))},[N,w,a,n,S,p]),H=es({mutationFn:async({optimisticId:k,args:T})=>({shiftId:await C(T),optimisticId:k,args:T}),onMutate:({optimisticId:k,args:T})=>{const W=s.find(q=>q._id===T.branchId),L={_id:k,_creationTime:Date.now(),organizationId:W?.organizationId??"",date:T.date,seriesId:void 0,previousEmployeeId:void 0,assignedEmployeeId:T.assignedEmployeeId,companyRoleId:T.companyRoleId,addressId:T.addressId,branchId:T.branchId,tagIds:T.tagIds,startTime:T.startTime,endTime:T.endTime,surchargeType:T.surchargeType,surcharge:T.surcharge,comment:T.comment,breakMinutes:T.breakMinutes,type:"concrete",series:void 0,overlappingShifts:[],workedMinutes:void 0};return _((q,Z)=>js(q,L,Z)),{optimisticId:k}},onSuccess:({shiftId:k,optimisticId:T,args:W})=>{_(L=>L.map(q=>qt(q)&&q._id===T?{...q,_id:k}:q)),B(T,k,w),r.capture("shift_created_by_drag",{date:W.date,assignedEmployeeId:W.assignedEmployeeId,companyRoleId:W.companyRoleId,startTime:W.startTime,endTime:W.endTime}),A({source:"roster_drag_create"})},onError:(k,{optimisticId:T})=>{_(L=>mi(L,T)),R(T);const W=l(k);r.capture("shift_create_by_drag_failed",{reason:W})}}),M=ss(De.shifts.updateById).withOptimisticUpdate((k,T)=>
54{if(!T._id)return;const W=k;let L;for(const Z of x){const ne=W.getQuery(De.shifts.listByDateRangeAndEmployeeIdsFlat,Z)||[];L??=ne.find(Y=>qt(Y)&&Y._id===T._id)}if(!L)return;const q=cd(L,T);for(const Z of x){const ne=W.getQuery(De.shifts.listByDateRangeAndEmployeeIdsFlat,Z)||[];W.setQuery(De.shifts.listByDateRangeAndEmployeeIdsFlat,Z,js(ne,q,Z))}}),O=ee.useCallback(async k=>Qn(k._id)?(St.info(a._({id:"roster.toast.shiftStillCreating",message:"This shift is still being created."})),null):M(k),[M,a]),Q=ss(De.shifts.updateRecurringShiftSeriesOnlyThisShift),$=es({mutationFn:async({optimisticId:k,args:T})=>({shiftId:await D(T),optimisticId:k,args:T}),onMutate:({optimisticId:k,args:T})=>{const W=b.flatMap(q=>m.getQueryData(q.queryKey)??[]).find(q=>cs(q)&&q.seriesId===T.seriesId&&q.date===T.exceptionDate),L={_id:k,_creationTime:Date.now(),organizationId:W?.organizationId??"",date:T.date,seriesId:T.seriesId,previousEmployeeId:W?.assignedEmployeeId,assignedEmployeeId:void 0,companyRoleId:T.companyRoleId,addressId:T.addressId,branchId:T.branchId,tagIds:T.tagIds,startTime:T.startTime,endTime:T.endTime,surchargeType:T.surchargeType,surcharge:T.surcharge,comment:T.comment,breakMinutes:T.breakMinutes,type:"concrete",series:W?.series,overlappingShifts:[],workedMinutes:void 0};return _((q,Z)=>{const ne=q.filter(Y=>!(cs(Y)&&Y.seriesId===T.seriesId&&Y.date===T.exceptionDate));return js(ne,L,Z)}),{optimisticId:k,optimisticSourceShift:W}},onSuccess:({shiftId:k,optimisticId:T})=>{_(W=>W.map(L=>qt(L)&&L._id===T?{...L,_id:k}:L)),B(T,k,w)},onError:(k,T,W)=>{_((L,q)=>{const Z=mi(L,T.optimisticId);return W?.optimisticSourceShift?js(Z,W.optimisticSourceShift,q):Z}),R(T.optimisticId),f(k)}}),E=es({mutationFn:({id:k,args:T})=>Q.withOptimisticUpdate((W,L)=>{if(!k)return;const q=W;let Z;for(const Y of x){const ae=q.getQuery(De.shifts.listByDateRangeAndEmployeeIdsFlat,Y)||[];Z??=ae.find(le=>cs(le)&&le.virtualId===k)}if(!Z)return;const ne=dd(Z,L);for(const Y of x){const ae=q.getQuery(De.shifts.listByDateRangeAndEmployeeIdsFlat,Y)||[];q.setQuery(De.shifts.listByDateRangeAndEmployeeIdsFlat,Y,js(ae,ne,Y))}})(T),onError:k=>{f(k)}}),I=es({mutationFn:ss(De.shifts.removeShiftsFromDateRange),onSuccess:k=>{St.success(a._({id:"roster.toast.weekCleared"}),{description:a._({id:"roster.toast.weekClearedDescription",message:"Removed {count} shifts from {start} to {end}",values:{count:k.shiftsDeleted,start:We(ts(k.dateRangeAffected.startDate)??k.dateRangeAffected.startDate,{weekday:"short",month:"short",day:"numeric"},a.locale),end:We(ts(k.dateRangeAffected.endDate)??k.dateRangeAffected.endDate,{weekday:"short",month:"short",day:"numeric"},a.locale)}})}),r.capture("week_cleared",{startDate:k.dateRangeAffected.startDate,endDate:k.dateRangeAffected.endDate,shiftsDeleted:k.shiftsDeleted})},onError:k=>{const T=l(k);St.error(T),r.capture("week_clear_failed",{reason:T})}}),P=ee.useCallback(async k=>(await H.mutateAsync({optimisticId:Un(),args:k})).shiftId,[H]),G=ee.useCallback(async k=>(await $.mutateAsync({optimisticId:Un(),args:k})).shiftId,[$]);return{createShiftMutateAsync:P,editShift:O,moveVirtualShift:E,clearWeekShifts:I,handleShiftClick:F,convertVirtualShiftToOpenShift:G}}function jo(i){return jt(i,3)}function pd(i){const e=Qt(i);return _s(jo(e),i)?e:jt(e,7)}function yd({from:i,to:e,selectedDay:s,startOfWeekDate:o,startOfMonthDate:n,hasPinnedDay:d}){const a={month:null,week:null,day:null};if(i===e)return a;const l=i==="month",f=jo(o),r=l&&_s(f,n);return e==="month"&&(a.month=Sn(i==="day"?s:f)),e==="week"&&(l?a.week=r?o:_s(s,n)?Qt(s):pd(n):a.week=Qt(s)),e==="day"&&(l&&!_s(s,n)?a.day=n:d||(a.day=o)
54),a}const fi=$o("/(app)/_appLayout/roster");function Jt(i){const[e,s]=i.split(":").map(Number);return e*60+(s||0)}function ls(i){const e=Math.max(0,Math.min(i,1440)),s=Math.floor(e/60),o=e%60;return`${String(s).padStart(2,"0")}:${String(o).padStart(2,"0")}`}function hi(i){const e=Jt(i);return ls(Math.floor(e/60)*60)}function ui(i){const e=Jt(i);return ls(Math.ceil(e/60)*60)}function gd({rosterPreferences:i}){const e=ps(),s=fi.useNavigate(),{weekStart:o,view:n,date:d,timeStart:a,timeEnd:l,roleIds:f,tagIds:r,addressIds:m}=fi.useSearch(),c=n??"week",h=ee.useMemo(()=>d?ts(d):null,[d]),[p,y]=ee.useState(()=>{if(d){const V=ts(d);if(V)return V}return new Date}),g=h??p,{groupByRole:u,hideEmptyRows:x}=i,{openDrawer:b,drawerProps:v}=Yo(),{openDrawer:j,drawerProps:w}=ra(),{ConfirmationDialog:C,confirm:D}=Pi(),{openDialog:_,closeDialog:S,open:N,onOpenChange:B,dialogState:A}=ha(),[R,F]=ee.useState(""),H=ee.useDeferredValue(R),[M,O]=ee.useState(void 0),Q=bn(),{data:$}=Vt(Ye(De.branches.listAll,{})),E=ee.useCallback(V=>{s({search:Ae=>({...Ae,...V}),replace:!0})},[s]),{selectedRoleFilterIds:I,selectedRoleFilterIdSet:P,selectedTagFilterIds:G,selectedAddressFilterIds:k,shiftFilters:T,toggleRoleFilter:W,toggleTagFilter:L,toggleAddressFilter:q,clearFilters:Z}=dc({roleIdsSearch:f,tagIdsSearch:r,addressIdsSearch:m,onSearchChange:E}),ne=Q.check("shifts",["create","update","delete"]),Y=Q.check("shifts","create"),ae=Q.check("publishedRanges",["publish","unpublish"]),{openPublishWeekDialog:le,PublishWeekConfirmationDialog:U}=oo({branches:$,selectedBranchId:M}),{weekYear:te,setWeekYear:se,startOfWeekDate:oe,datesByIndex:be,handleWeekChange:ie,goToCurrentWeek:fe}=wa(),{isWeekPublished:he}=Ln(oe,$,void 0),Ie=ne||he;ee.useEffect(()=>{if(!o)return;const V=ts(o);V&&(se(as(V)),s({search:Ae=>({...Ae,weekStart:void 0}),replace:!0}))},[o,s,se]),ee.useEffect(()=>{h&&se(as(Qt(h)))},[h,se]);const{employees:de,companyRoles:re,addresses:Se,tags:X,filteredEmployees:ge,flatShifts:ce,filteredFlatShifts:Ce,filteredAllLocationFlatShifts:Ee,flatAbsences:ue,flatAvailabilities:me,flatAvailabilitySeries:_e,groupShiftsByEmployeeAndDay:pe,allLocationGroupShiftsByEmployeeAndDay:Me,groupAbsencesByEmployeeAndDay:Pe,groupAvailabilitiesByEmployeeAndDay:ze,isLoadingShifts:He}=Wa(oe,H,M,T),{openEdit:Ue,EditorDialog:Ge}=Jo({employees:de,availabilitySeries:_e}),Le=Oe(new Date,Je),Ke=ut({...Ye(De.employeeContracts.listWeeklyQuotaMinutes,{employeeIds:de.map(V=>V._id),atDate:Le}),enabled:de.length>0,placeholderData:{}}),Re=ee.useMemo(()=>{if(!x)return 0;let V=0;for(const Ae of ge){if(!Ae.isVisibleInRoster)continue;(pe[Ae._id]?.some(gs=>gs.length>0)??!1)||(V+=1)}return V},[x,ge,pe]),qe=ee.useMemo(()=>Object.fromEntries(Object.entries(Ke.data??{}).map(([V,Ae])=>[V,Ae/60])),[Ke.data]),st=ee.useMemo(()=>{const V=Oe(g,Je),Ae=Ce.filter(Es=>Es.date===V);if(Ae.length===0)return{start:"06:00",end:"22:00"};let dt=Number.POSITIVE_INFINITY,zt=Number.NEGATIVE_INFINITY;Ae.forEach(Es=>{const zn=Jt(Es.startTime);let Js=Jt(Es.endTime);Js<=zn&&(Js=1440),dt=Math.min(dt,zn),zt=Math.max(zt,Js)});const gs=Math.max(0,Math.floor((dt-60)/30)*30),Zs=Math.min(1440,Math.ceil((zt+60)/30)*30);return{start:ls(gs),end:ls(Zs)}},[Ce,g]),Ve=hi(a??st.start),we=Math.min(1440,Jt(Ve)+60),et=(()=>{const V=ui(l??st.end);return Jt(V)<we?ls(we):V})(),{data:tt}=ut({...Ye(De.timesheets.index.getTimeAccountBalancesAtDate,{employeeIds:de.map(V=>V._id),atDate:Oe(oe,Je)}),enabled:de.length>0}),Xe=ee.useCallback(()=>{s({search:V=>({...V,view:void 0}),replace:!0})},[s]),{startOfMonthDate:ve,monthData:Ne,isMonthWeekPublished:it,monthFilteredEmployees:rt,monthHiddenEmptyRowsCount:K,employeeMonthlyQuotaHoursById:Te,monthTimeAccountBalances:$e,employeeWeekdayQuotaMinutesById:ke,selectRosterMonth:Qe,syncRosterMonthToDate:nt,changeRosterMonth:gt,goToCurrentRosterMonth:Ze,handleNavigateToWeekView:xt,handleMonthWeekPublishClick:pt}=ic({viewMode:c,deferredSearchTerm:H,selectedBranchId:M,branches:$,employees:de,currentContractDate:Le,hideEmptyRows:x,shiftFilters:T,canManageShifts:ne,analytics:e,setWeekYear:se,showWeekView:Xe,openPublishWeekDialog:le}),Ot=c==="month"?K:Re,{managerOpenShiftsByDay:Mt,employeeOpenShiftsByDay:Pt}=Pc({startOfWeekDate:oe,selectedBranchId:M,shiftFilters:T,flatShifts:ce,canManageShifts:ne}),Tt=Math.max(0,g.getDay()===0?6:g.getDay()-1),Lt=Mt[Tt]??[],_t=Pt[Tt]??[],Et=ee.useMemo(()=>Object.fromEntries(de.map(V=>[V._id,V.companyRoles.map(Ae=>Ae._id)])),[de]),{exportWeekPdf:kt,isExportingWeekPdf:Rt}=Zc({branches:$,companyRoles:re,employees:de,flatShifts:ce,visibleEmployees:ge,selectedBranchId:M,shiftFilters:T,startOfWeekDate:oe,weekYear:te}),{exportMonthPdf:At,isExportingMonthPdf:Ct}=Ec({branches:$,companyRoles:re,employees:de,visibleEmployees:ge,selectedBranchId:M,shiftFilters:T,startOfWeekDate:oe,explicitMonthDate:c==="month"?ve:void 0}),Bt=ee.useMemo(()=>c!=="month"||Ne.monthDateStrings.length===0?[]:[{startDate:Ne.monthDateStrings[0],endDate:Ne.monthDateStrings.at(-1)??Ne.monthDateStrings[0]}
54],[Ne.monthDateStrings,c]),{createShiftMutateAsync:$t,editShift:vt,moveVirtualShift:Nt,clearWeekShifts:wt,handleShiftClick:Dt,convertVirtualShiftToOpenShift:z}=ud({startOfWeekDate:oe,employees:de,branches:$,selectedBranchId:M,openDrawer:b,additionalOptimisticRanges:Bt}),{handleClearWeek:xe,handleClearDay:ye}=Jc({startOfWeekDate:oe,selectedDay:g,confirmDialog:D,clearShifts:wt.mutate}),Fe=es({mutationFn:ss(De.settings.updateRosterPreferences).withOptimisticUpdate((V,Ae)=>{const dt=V.getQuery(De.settings.getRosterPreferences,{});dt&&V.setQuery(De.settings.getRosterPreferences,{},{...dt,...Ae})})}),lt=()=>{Fe.mutate({groupByRole:!u})},ct=()=>{Fe.mutate({hideEmptyRows:!x})},It=ee.useCallback(V=>{const Ae=yd({from:c,to:V,selectedDay:g,startOfWeekDate:oe,startOfMonthDate:ve,hasPinnedDay:!!d}),dt=Ae.day??g;Ae.month&&nt(Ae.month),Ae.day&&y(Ae.day),Ae.week&&se(as(Ae.week)),s({search:zt=>({...zt,view:V==="week"?void 0:V,date:V==="day"?Oe(dt,Je):zt.date}),replace:!0})},[s,g,d,oe,ve,nt,se,c]),Ht=ee.useCallback(V=>{y(V);const Ae=Qt(V);se(as(Ae)),s({search:dt=>({...dt,date:Oe(V,"yyyy-MM-dd")}),replace:!0})},[s,se]),Ut=ee.useCallback(V=>{y(V),se(as(Qt(V))),s({search:Ae=>({...Ae,view:"day",date:Oe(V,Je)}),replace:!0})},[s,se]),{sensors:ot,activeShift:Gt,isMoveModifierActive:Fn,handleDragStart:vo,handleDragEnd:wo}=ad({createShiftMutateAsync:$t,convertVirtualShiftToOpenShift:z,editShift:vt,moveVirtualShift:({id:V,args:Ae})=>Nt.mutateAsync({id:V,args:Ae}),groupByRole:u,employeeRoleIdsByEmployeeId:Et}),_o=qo(ce),Wn=t.jsx(Xo,{viewMode:c,monthDates:Ne.monthDates,startOfWeekDate:oe,branchId:M,children:t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[t.jsx(Yr,{viewMode:c,onViewModeChange:It,selectedDay:g,onDayChange:Ht,selectedMonth:ve,onMonthChange:gt,onMonthSelect:Qe,goToCurrentMonth:Ze,dayViewStartTime:Ve,dayViewEndTime:et,onTimeRangeChange:(V,Ae)=>{const dt=hi(V),zt=Math.min(1440,Jt(dt)+60),gs=Math.max(Jt(ui(Ae)),zt);s({search:Zs=>({...Zs,timeStart:dt,timeEnd:ls(gs)}),replace:!0})},weekYear:te,publishConflictShiftCount:_o,branches:$,companyRoles:re,tags:X,addresses:Se,selectedRoleFilterIds:I,selectedTagFilterIds:G,selectedAddressFilterIds:k,onToggleRoleFilter:W,onToggleTagFilter:L,onToggleAddressFilter:q,onClearFilters:Z,selectedBranchId:M,onBranchChange:V=>{O(V),e.capture("branch_selected",{branchId:V})},onSelectWeek:V=>{V&&(e.capture("week_selected",{week:V.week,year:V.year}),se(V))},handleWeekChange:V=>{e.capture("week_navigate",{direction:V}),ie(V)},goToCurrentWeek:()=>{e.capture("week_go_to_current"),fe()},onClearWeek:xe,onClearDay:ye,clearIsPending:wt.isPending,startOfWeekDate:oe,groupByRole:u,onToggleGroupByRole:lt,hideEmptyRows:x,onToggleHideEmptyRows:ct,hiddenEmptyRowsCount:Ot,onExportWeekPdf:kt,isExportingWeekPdf:Rt,onExportMonthPdf:At,isExportingMonthPdf:Ct}),c==="day"?t.jsx(Cl,{selectedDate:g,canSeePublishedRoster:Ie,companyRoles:re,filteredEmployees:ge,flatShifts:Ce,allLocationFlatShifts:Ee,managerOpenShifts:Lt,employeeOpenShifts:_t,flatAbsences:ue,flatAvailabilities:me,hideEmptyRows:x,isLoadingShifts:He,onToggleHideEmptyRows:ct,onEmployeeClick:V=>{e.capture("employee_drawer_opened",{employeeId:V}),j({employeeId:V})},onCreateShiftClick:({employeeId:V,companyRoleId:Ae,date:dt,startTime:zt})=>{e.capture("shift_create_drawer_opened",{employeeId:V,companyRoleId:Ae,date:Oe(dt,"yyyy-MM-dd")}),b({shift:void 0,assignedEmployeeId:V,assignedCompanyRoleId:Ae,assignedBranchId:M,startingDate:dt,startingTime:zt,showBranchSelection:$.length>1&&!M})},onCreateOpenShiftClick:({date:V,startTime:Ae})=>{e.capture("open_shift_create_drawer_opened",{date:Oe(V,"yyyy-MM-dd")}),b({shift:void 0,assignedBranchId:M,startingDate:V,startingTime:Ae,showBranchSelection:$.length>1&&!M})},onShiftClick:V=>{e.capture("shift_drawer_opened",{shiftId:yt(V)}),Dt(V,{showBranchSelection:$.length>1&&!M})},onEmployeeOpenShiftClick:V=>{e.capture("open_shift_drawer_opened",{shiftKey:V.shiftKey}),b({openShift:V})},onShiftTimeUpdate:({shift:V,startTime:Ae,endTime:dt})=>{if(cs(V)){Nt.mutate({id:V.virtualId,args:{seriesId:V.seriesId,exceptionDate:V.date,date:V.date,startTime:Ae,endTime:dt}});return}vt({_id:V._id,startTime:Ae,endTime:dt})},activeShift:Gt,searchTerm:R,setSearchTerm:F,viewStartTime:Ve,viewEndTime:et,autoScrollToCurrentTime:!a&&!l,branches:$,selectedBranchId:M,groupByRole:u,roleFilterIds:P}):c==="month"?t.jsx(Kl,{monthDates:Ne.monthDates,monthDateStrings:Ne.monthDateStrings,companyRoles:re,filteredEmployees:rt,shiftsByEmployeeByDate:Ne.shiftsByEmployeeByDate,allLocationShiftsByEmployee:Ne.allLocationShiftsByEmployee,absencesByEmployeeByDate:Ne.absencesByEmployeeByDate,availabilitiesByEmployeeByDate:Ne.availabilitiesByEmployeeByDate,managerOpenShiftsByDate:Ne.managerOpenShiftsByDate,employeeOpenShiftsByDate:Ne.employeeOpenShiftsByDate,searchTerm:R,setSearchTerm:F,hideEmptyRows:x,hiddenEmptyRowsCount:K,onToggleHideEmptyRows:ct,groupByRole:u,isLoading:Ne.isLoading,canManageShifts:ne,canCreateShifts:Y,isWeekPublished:it,activeShift:ne?Gt:null,isMoveModifierActive:Fn,roleFilterIds:P,canPublishWeeks:ae,onDayHeaderClick:Ut,onWeekHeaderClick:xt,onPublishWeekClick:pt,onShiftClick:V=>{e.capture("shift_drawer_opened",{shiftId:yt(V)}),Dt(V,{showBranchSelection:$.length>1&&!M})},onEmployeeClick:V=>{e.capture("employee_drawer_opened",{employeeId:V}),j({employeeId:V})},onEmployeeOpenShiftClick:V=>
54{e.capture("open_shift_drawer_opened",{shiftKey:V.shiftKey}),b({openShift:V})},onCreateShiftClick:({employeeId:V,companyRoleId:Ae,date:dt})=>{e.capture("shift_create_drawer_opened",{employeeId:V,companyRoleId:Ae,date:Oe(dt,"yyyy-MM-dd")}),b({shift:void 0,assignedEmployeeId:V,assignedCompanyRoleId:Ae,assignedBranchId:M,startingDate:dt,showBranchSelection:$.length>1&&!M})},onCreateOpenShiftClick:({date:V})=>{e.capture("open_shift_create_drawer_opened",{date:Oe(V,"yyyy-MM-dd")}),b({shift:void 0,assignedBranchId:M,startingDate:V,showBranchSelection:$.length>1&&!M})},branches:$,selectedBranchId:M,timeAccountBalances:$e,monthlyQuotaHoursById:Te,weekdayQuotaMinutesById:ke,addresses:Se,tags:X}):t.jsx(Er,{startOfWeekDate:oe,datesByIndex:be,weekYear:te,searchTerm:R,setSearchTerm:F,companyRoles:re,filteredEmployees:ge,groupShiftsByEmployeeAndDay:pe,allLocationGroupShiftsByEmployeeAndDay:Me,managerOpenShiftsByDay:Mt,employeeOpenShiftsByDay:Pt,groupAbsencesByEmployeeAndDay:Pe,groupAvailabilitiesByEmployeeAndDay:ze,roleFilterIds:P,groupByRole:u,hideEmptyRows:x,hiddenEmptyRowsCount:Re,isLoadingShifts:He,onToggleHideEmptyRows:ct,onEmployeeClick:V=>{e.capture("employee_drawer_opened",{employeeId:V}),j({employeeId:V})},onCreateShiftClick:({employeeId:V,companyRoleId:Ae,date:dt})=>{e.capture("shift_create_drawer_opened",{employeeId:V,companyRoleId:Ae,date:Oe(dt,"yyyy-MM-dd")}),b({shift:void 0,assignedEmployeeId:V,assignedCompanyRoleId:Ae,assignedBranchId:M,startingDate:dt,showBranchSelection:$.length>1&&!M})},onCreateOpenShiftClick:({date:V})=>{e.capture("open_shift_create_drawer_opened",{date:Oe(V,"yyyy-MM-dd")}),b({shift:void 0,assignedBranchId:M,startingDate:V,showBranchSelection:$.length>1&&!M})},onShiftClick:V=>{e.capture("shift_drawer_opened",{shiftId:yt(V)}),Dt(V,{showBranchSelection:$.length>1&&!M})},onNavigateToDay:Ut,onEmployeeOpenShiftClick:V=>{e.capture("open_shift_drawer_opened",{shiftKey:V.shiftKey}),b({openShift:V})},onAbsenceClick:V=>{e.capture("absence_dialog_opened_from_roster",{absenceId:V._id,status:V.status}),_({existingAbsence:V,employeeId:V.employeeId,employeeName:V.employee?.name??void 0})},onAvailabilityClick:V=>{e.capture("availability_dialog_opened_from_roster",{availabilityId:V._id,kind:V.kind}),Ue(V)},activeShift:ne?Gt:null,branches:$,selectedBranchId:M,timeAccountBalances:tt,employeeWeeklyQuotaHoursById:qe,weekdayQuotaMinutesById:ke}),t.jsx(ws,{entity:"shifts",action:["create","update","delete"],children:typeof document<"u"&&Oo.createPortal(t.jsx(Xr,{activeShift:Gt,companyRoles:re,viewMode:c,isMoveModifierActive:Fn}),document.body)}),t.jsx(Zo,{startOfWeek:oe,employees:de,companyRoles:re,branches:$,addresses:Se,tags:X,...v}),t.jsx(ca,{...w}),t.jsx(ua,{open:N,onOpenChange:B,onSuccess:S,employeeId:A?.employeeId,employeeName:A?.employeeName,existingAbsence:A?.existingAbsence}),t.jsx(Ge,{}),t.jsx(C,{}),t.jsx(U,{})]})});return t.jsx(ws,{entity:"shifts",action:["create","update","delete"],otherwise:Wn,children:t.jsx(Qo,{collisionDetection:Uo,modifiers:c==="week"?[Pa]:[],sensors:ot,onDragStart:vo,onDragEnd:wo,children:Wn})})}function $1(){const i=je.c(3);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ye(De.settings.getRosterPreferences,{}),i[0]=e):e=i[0];const{data:s}=Vt(e);if(!s)return null;let o;return i[1]!==s?(o=t.jsx(gd,{rosterPreferences:s}),i[1]=s,i[2]=o):o=i[2],o}export{$1 as component}; 55 56//# chunkId=01a0193d-a290-7532-9f10-04b7d1fc8266
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.