PageSourceSearch

https://www.chathampharmacy.co.uk/_next/static/chunks/pages/admin/capacity-50ef6270bce54b8b.js

js chathampharmacy.co.uk collected 2026-10-09 22:05:14 UTC 90,650 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7860],{1260:(e,t,a)=>{"use strict";a.d(t,{T:()=>_});var l=a(37876),n=a(14232),s=a(98477),i=a(15039),o=a.n(i),c=a(46980),r=a(2830),d=a.n(r);let _=e=>{let{isOpen:t,title:a,detail:i,confirmLabel:r,cancelLabel:_="Cancel",tone:u="default",busy:m=!1,busyLabel:h,onConfirm:p,onCancel:y}=e,[b,f]=n.useState(!1),[v,x]=n.useState(!1),k=n.useRef(null),S=n.useRef(null),j=n.useRef(null);return(n.useEffect(()=>f(!0),[]),n.useEffect(()=>{if(!t)return void x(!1);let e=requestAnimationFrame(()=>x(!0));return()=>cancelAnimationFrame(e)},[t]),n.useEffect(()=>{if(!t)return;S.current=document.activeElement;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{var t,a;document.body.style.overflow=e,null==(a=S.current)||null==(t=a.focus)||t.call(a)}},[t]),n.useEffect(()=>{var e;v&&(null==(e=j.current)||e.focus())},[v]),b&&(t||v))?(0,s.createPortal)((0,l.jsxs)("div",{className:o()(d().root,{[d().rootOpen]:v}),children:[(0,l.jsx)("div",{className:d().scrim,onClick:()=>{m||y()}}),(0,l.jsxs)("div",{ref:k,role:"alertdialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:d().panel,onKeyDown:e=>{var t,a;if("Escape"===e.key){e.stopPropagation(),m||y();return}if("Tab"!==e.key)return;let l=Array.from(null!=(a=null==(t=k.current)?void 0:t.querySelectorAll("button:not([disabled])"))?a:[]);if(0===l.length)return;let n=l[0],s=l[l.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),s.focus()):e.shiftKey||document.activeElement!==s||(e.preventDefault(),n.focus())},children:[(0,l.jsx)("h2",{id:"confirm-dialog-title",className:d().title,children:a}),i?(0,l.jsx)("div",{className:d().detail,children:i}):null,(0,l.jsxs)("div",{className:d().actions,children:[(0,l.jsx)("button",{ref:j,type:"button",className:d().cancel,onClick:y,disabled:m,children:_}),(0,l.jsx)("button",{type:"button",className:o()(d().confirm,{[d().confirmDanger]:"danger"===u}),onClick:p,disabled:m,"aria-busy":m||void 0,children:m?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.a,{size:16,loaderColor:"light"}),null!=h?h:r]}):r})]})]})]}),document.body):null}},2779:(e,t,a)=>{"use strict";a.d(t,{a:()=>n});var l=a(14232);let n=()=>{let[e,t]=l.useState(!1);return l.useEffect(()=>{let e=()=>{t(window.innerWidth<=760)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}},2830:e=>{e.exports={root:"ConfirmDialog_root__iX7yD",rootOpen:"ConfirmDialog_rootOpen__MyVKN",scrim:"ConfirmDialog_scrim__d4QbY",panel:"ConfirmDialog_panel__gKQ1E",title:"ConfirmDialog_title__gpy_I",detail:"ConfirmDialog_detail__ZEaSF",actions:"ConfirmDialog_actions__e_Hyb",cancel:"ConfirmDialog_cancel__W_I0y",confirm:"ConfirmDialog_confirm__Tzowu",confirmDanger:"ConfirmDialog_confirmDanger__eV2CX"}},3715:(e,t,a)=>{"use strict";a.r(t),a.d(t,{__N_SSP:()=>eg,default:()=>eN});var l=a(37876),n=a(14232),s=a(89099),i=a(15039),o=a.n(i),c=a(81635),r=a(93153),d=a(57945);function _(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),l=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(l)}var u=a(76261),m=a(2779),h=a(76426),p=a.n(h);let y=e=>{let{day:t,hiddenCategories:a,matchMinutes:s=0,expandResourceId:i=null,demand:r,onSelectFree:d,onSetHours:_,onReleaseClinic:u,onCancelClinic:h}=e,y=(0,m.a)(),[k,N]=n.useState(()=>new Set),F=n.useRef(!1);n.useEffect(()=>{var e;if(F.current)return;F.current=!0;let a=function(){try{let e=window.sessionStorage.getItem(M);if(null===e)return null;return new Set(JSON.parse(e))}catch(e){return null}}();if(a&&a.size>0)return void N(a);let l=null==(e=t.resources[0])?void 0:e.resource.id;void 0!==l&&N(new Set([l]))},[t.resources]);let[D,E]=n.useState(new Set);n.useEffect(()=>{null!==i&&N(e=>{if(e.has(i))return e;let t=new Set(e).add(i);return A(t),t})},[i]);let R=Math.max(1,t.dayEndMinutes-t.dayStartMinutes),P=e=>({left:"".concat((e.startMinutes-t.dayStartMinutes)/R*100,"%"),width:"".concat((e.endMinutes-e.startMinutes)/R*100,"%")});if(0===t.resources.length)return(0,l.jsx)("p",{className:p().timeline__empty,children:"No rooms or clinicians set up at this site yet."});if(y)return(0,l.jsx)(O,{day:t,hiddenCategories:a,matchMinutes:s,onSelectFree:d,onSetHours:_});let H=function(e,t,a){if(!e)return null;let l=Math.max(e.start,t),n=Math.min(e.end,t+a);return n<=l?null:{left:(l-t)/a*100,width:(n-l)/a*100}}(null==r?void 0:r.peak,t.dayStartMinutes,R);return(0,l.jsxs)("table",{className:p().timeline,children:[(0,l.jsxs)("caption",{className:p().timeline__caption,children:["Room and clinician availability for ",t.dateLabel]}),(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{scope:"col",className:p().timeline__corner,children:(0,l.jsx)("span",{className:p()["timeline__visually-hidden"],children:"Resource"})}),(0,l.jsx)("th",{scope:"col",className:p()["timeline__axis-cell"],children:(0,l.jsx)("span",{className:p().timeline__axis,"aria-hidden":"true",children:t.axisTicks.map(e=>(0,l.jsx)("span",{className:p().timeline__tick,style:{left:"".concat((e-t.dayStartMinutes)/R*100,"%")},children:C(e)},e))})})]})}),(null==r?void 0:r.hours.length)?(0,l.jsx)("tbody",{children:(0,l.jsxs)("tr",{children:[(0,l.jsxs)("th",{scope:"row",className:p()["timeline__demand-head"],children:[(0,l.jsx)("span",{className:p()["timeline__demand-title"],children:"Patient demand"}),(0,l.jsx)("span",{className:p()["timeline__demand-sub"],children:r.windowLabel})]}),(0,l.jsx)("td",{className:p()["timeline__demand-cell"],children:(0,l.jsxs)("div",{className:p()["timeline__demand-track"],children:[r.hours.filter(e=>60*e.hour>=t.dayStartMinutes-59&&60*e.hour<t.dayEndMinutes).map(e=>(0,l.jsx)("span",{className:o()(p()["timeline__demand-bar"],{[p()["timeline__demand-bar--peak"]]:e.isPeak}),style:{left:"".concat((60*e.hour+4-t.dayStartMinutes)/R*100,"%"),width:"".concat(52/R*100,"%"),height:"".concat(Math.max(3,Math.round(.33*e.intensity)),"px")},title:"".concat(C(60*e.hour),"–").concat(C((e.hour+1)*60)," \xb7 demand ").concat(e.intensity,"/100, ").concat(e.bookings," booking").concat(1===e.bookings?"":"s"," across ").concat(r.windowLabel)},e.hour)),H?(0,l.jsx)("span",{className:p()["timeline__peak-tag"],style:{left:"".concat(H.left,"%"),width:"".concat(H.width,"%")},"aria-hidden":"true",children:(0,l.jsx)("span",{className:p()["timeline__peak-tag-text"],children:"PEAK"})}):null]})})]})}):null,t.resources.map(e=>{let n=k.has(e.resource.id),i="resource-".concat(e.resource.id,"-services"),r=[...e.services].sort((e,t)=>
1e.isAdhoc!==t.isAdhoc?e.isAdhoc?-1:1:+(t.slotCount>0)!=+(e.slotCount>0)||e.slotCount!==t.slotCount?t.slotCount-e.slotCount:e.name.localeCompare(t.name)).slice(0,D.has(e.resource.id)?void 0:S(e.services)||3);return(0,l.jsxs)("tbody",{id:i,children:[(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{scope:"row",className:p().timeline__head,children:(0,l.jsxs)("button",{type:"button",className:p().timeline__toggle,"aria-expanded":n,"aria-controls":i,onClick:()=>(e=>{N(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),A(a),a})})(e.resource.id),children:[(0,l.jsxs)("span",{className:p().timeline__name,children:[(0,l.jsx)(c.fOo,{"aria-hidden":"true",className:o()(p().timeline__chevron,{[p()["timeline__chevron--open"]]:n})}),e.resource.name]}),(0,l.jsx)("span",{className:p().timeline__sub,children:g(e)})]})}),(0,l.jsxs)("td",{className:p()["timeline__track-cell"],children:[(0,l.jsxs)("div",{className:p().timeline__track,children:[H?(0,l.jsx)("span",{className:p()["timeline__peak-band"],style:{left:"".concat(H.left,"%"),width:"".concat(H.width,"%")},"aria-hidden":"true"}):null,(0,l.jsx)(f,{ticks:t.axisTicks,start:t.dayStartMinutes,span:R}),e.blocks.map((t,n)=>(0,l.jsx)(x,{block:t,style:P(t),dimmed:a.has(t.category),matches:s>0&&"free"===t.kind&&t.endMinutes-t.startMinutes>=s,onSelect:"free"===t.kind&&d?()=>d(e,t):void 0},"".concat(t.startMinutes,"-").concat(n)))]}),e.hoursUnset?(0,l.jsxs)("button",{type:"button",className:p().timeline__prompt,onClick:()=>null==_?void 0:_(e),children:[(0,l.jsx)(c.eHT,{"aria-hidden":"true"}),"Working hours not set. Set them to plan against this"," ","clinician"===e.resource.kind?"clinician":"room","."]}):null,e.warnings.map(e=>(0,l.jsxs)("p",{className:p().timeline__warning,children:[(0,l.jsx)(c.eHT,{"aria-hidden":"true"}),e.detail]},e.code))]})]}),n?r.map(n=>(0,l.jsxs)("tr",{children:[(0,l.jsxs)("th",{scope:"row",className:p()["timeline__service-head"],children:[(0,l.jsxs)("span",{className:p()["timeline__service-name"],children:[(0,l.jsx)("span",{className:o()(p().timeline__dot,p()["timeline__dot--".concat(n.category)]),"aria-hidden":"true"}),n.name,n.isAdhoc?(0,l.jsx)("span",{className:p().timeline__badge,children:"Ad-hoc"}):null]}),(0,l.jsx)("span",{className:p()["timeline__service-meta"],children:function(e){if(0===e.slotCount)return"Nothing booked today";let t="".concat(e.slotCount," ").concat(1===e.slotCount?"slot":"slots"),a=e.slotMinutes?" \xb7 ".concat(e.slotMinutes," min each"):"";if(e.isAdhoc){var l;let n=null!=(l=e.bookedSlotCount)?l:0;return"".concat(t," \xb7 ").concat(0===n?"none booked yet":"".concat(n," booked")).concat(a)}let n=e.slotMinutes?" \xb7 ".concat(T(e.slotCount*e.slotMinutes)," booked"):"";return"".concat(t).concat(n).concat(a)}(n)}),n.isAdhoc&&n.clinicId?(0,l.jsx)(b,{service:n,onRelease:u,onCancel:h}):null]}),(0,l.jsx)("td",{className:p()["timeline__lane-cell"],children:(0,l.jsxs)("div",{className:p().timeline__lane,children:[(0,l.jsx)(v,{ticks:t.axisTicks,start:t.dayStartMinutes,span:R}),n.blocks.filter(e=>"free"!==e.kind&&"closed"!==e.kind).map((e,t)=>(0,l.jsx)("button",{type:"button",className:o()(p()["timeline__lane-block"],p()["timeline__lane-block--".concat(e.category)],{[p()["timeline__block--dimmed"]]:a.has(e.category)}),style:P(e),title:"".concat(e.label," \xb7 ").concat(w(e.start),"–").concat(w(e.end)),"aria-label":"".concat(e.label,", ").concat(w(e.start)," to ").concat(w(e.end))},"".concat(e.startMinutes,"-").concat(t)))]})})]},"".concat(e.resource.id,"-").concat(n.serviceid,"-").concat(n.name))):null,n&&j(e.services)>0?(0,l.jsx)("tr",{children:(0,l.jsx)("th",{scope:"row",className:p()["timeline__more-cell"],colSpan:2,children:(0,l.jsx)("button",{type:"button",className:p().timeline__more,"aria-expanded":D.has(e.resource.id),onClick:()=>(e=>E(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a}))(e.resource.id),children:D.has(e.resource.id)?"Hide ".concat(j(e.services)," services with nothing booked today"):"Show ".concat(j(e.services)," services with nothing booked today")})})}):null]},e.resource.id)})]})},b=e=>{var t;let{service:a,onRelease:n,onCancel:s}=e,i=null!=(t=a.bookedSlotCount)?t:0,o=Math.max(0,a.slotCount-i);return n||s?(0,l.jsxs)("span",{className:p()["timeline__clinic-actions"],children:[n&&o>0?(0,l.jsxs)("button",{type:"button",className:p()["timeline__clinic-action"],onClick:()=>
1n(a),title:"Return ".concat(o," unbooked slot").concat(1===o?"":"s"," to free time"),children:["Release ",o]}):null,s?(0,l.jsx)("button",{type:"button",className:p()["timeline__clinic-action"],onClick:()=>s(a),title:i>0?"".concat(i," appointment").concat(1===i?" is":"s are"," booked; cancel those in the calendar first"):"Cancel this clinic",children:"Cancel clinic"}):null]}):null},f=e=>{let{ticks:t,start:a,span:n}=e;return(0,l.jsx)(l.Fragment,{children:t.slice(1).map(e=>(0,l.jsx)("span",{className:p().timeline__gridline,style:{left:"".concat((e-a)/n*100,"%")},"aria-hidden":"true"},e))})},v=e=>{let{ticks:t,start:a,span:n}=e;return(0,l.jsx)(l.Fragment,{children:t.slice(1).map(e=>(0,l.jsx)("span",{className:p()["timeline__lane-gridline"],style:{left:"".concat((e-a)/n*100,"%")},"aria-hidden":"true"},e))})},x=e=>{let{block:t,style:a,dimmed:n,matches:s,onSelect:i}=e,c=t.endMinutes-t.startMinutes,r="free"===t.kind,_="closed"===t.kind||"turnaround"===t.kind,u="".concat(T(c)," free"),m=d.C5[t.category],h=r&&c>30;return(0,l.jsxs)("button",{type:"button",className:o()([p().timeline__block,r?p()["timeline__block--free"]:null,_?p()["timeline__block--".concat(t.kind)]:null,r||_?null:p()["timeline__block--booked"],r||_?null:p()["timeline__block--cat-".concat(t.category)],n?p()["timeline__block--dimmed"]:null,s?p()["timeline__block--match"]:null]),style:a,onClick:i,"aria-disabled":!i||void 0,"data-match":s?"true":void 0,title:r?"Free ".concat(T(c)," \xb7 ").concat(w(t.start),"–").concat(w(t.end)," \xb7 click to add a service"):"".concat(t.label," \xb7 ").concat(w(t.start),"–").concat(w(t.end)),"aria-label":k(t,c,s,!!i),children:[h?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:p()["timeline__gap-label"],children:u}),(0,l.jsx)("span",{className:p()["timeline__gap-plus"],"aria-hidden":"true",children:"+"})]}):null,r||_?null:(0,l.jsx)("span",{className:p()["timeline__block-label"],children:m})]})};function k(e,t,a,l){let n="".concat(w(e.start)," to ").concat(w(e.end));return"free"===e.kind?"Free, ".concat(T(t),", ").concat(n).concat(a?", long enough for the slot you are looking for":"").concat(l?", add a service here":""):"closed"===e.kind?"Closed, ".concat(n):"turnaround"===e.kind?"Turnaround, ".concat(n):"".concat(e.label,", ").concat(d.Bi[e.category],", ").concat(n)}let S=e=>e.filter(e=>e.slotCount>0).length,j=e=>e.filter(e=>0===e.slotCount).length;function g(e){var t;let a="clinician"===e.resource.kind?"Clinician":"Room";if(e.hoursUnset)return"".concat(a," \xb7 No working hours set");if(e.isClosed)return"".concat(a," \xb7 ").concat(null!=(t=e.reason)?t:"Closed today");let l=1===e.serviceCount?"1 service":"".concat(e.serviceCount," services");return"".concat(a," \xb7 ").concat(T(e.freeMinutes)," free \xb7 ").concat(l)}function N(e){if(e.hoursUnset||e.isClosed||!e.freeGapCount)return null;let t=1===e.freeGapCount?"1 gap":"".concat(e.freeGapCount," gaps");return e.longestFreeMinutes>0?"".concat(t," \xb7 longest ").concat(T(e.longestFreeMinutes)):t}function w(e){let[t,a]=e.split(":").map(Number),l=t>=12?"pm":"am",n=t%12==0?12:t%12;return 0===a?"".concat(n).concat(l):"".concat(n,":").concat(String(a).padStart(2,"0")).concat(l)}let C=e=>w("".concat(String(Math.floor(e/60)).padStart(2,"0"),":00"));function T(e){if(e<=0)return"0m";let t=Math.floor(e/60),a=e%60;return t&&a?"".concat(t,"h ").concat(a,"m"):t?"".concat(t,"h"):"".concat(a,"m")}let M="chatham.capacity.expanded";function A(e){try{window.sessionStorage.setItem(M,JSON.stringify(Array.from(e)))}catch(e){}}let O=e=>{let{day:t,hiddenCategories:a,matchMinutes:n=0,onSelectFree:s,onSetHours:i}=e;return(0,l.jsx)("ul",{className:p().stack,children:t.resources.map(e=>(0,l.jsxs)("li",{className:p().stack__card,children:[(0,l.jsx)("p",{className:p().stack__name,children:e.resource.name}),(0,l.jsx)("p",{className:p().stack__meta,children:g(e)}),N(e)?(0,l.jsx)("p",{className:p().stack__meta,children:N(e)}):null,e.hoursUnset?(0,l.jsxs)("button",{type:"button",className:p().timeline__prompt,onClick:()=>null==i?void 0:i(e),children:[(0,l.jsx)(c.eHT,{"aria-hidden":"true"}),"Working hours not set."]}):null,(0,l.jsx)("ul",{className:p().stack__blocks,children:e.blocks.filter(e=>"closed"!==e.kind).map((t,i)=>{let c=t.endMinutes-t.startMinutes,r=n>0&&"free"===t.kind&&c>=n;return(0,l.jsx)("li",{children:(0,l.jsxs)("button",{type:"button",className:o()(p().stack__block,{[p()["timeline__block--dimmed"]]:a.has(t.category),[p()["timeline__block--match"]]:r}),onClick:"free"===t.kind&&s?()=>s(e,t):void 0,disabled:"free"!==t.kind||!s,"aria-label":k(t,c,r,"free"===t.kind&&!!s),children:[(0,l.jsxs)("span",{className:p().stack__time,children:[w(t.start),"–",w(t.end)]}),(0,l.jsx)("span",{children:t.label}),(0,l.jsx)("span",{className:p().stack__length,children:T(c)})]})},"".concat(t.startMinutes,"-").concat(i))})})]},e.resource.id))})};var F=a(91012),D=a(1260);function E(e,t,a){let l=Math.max(5,Math.round(a.step)||5),n=Math.min(a.axisStart,a.axisEnd),s=Math.max(a.axisStart,a.axisEnd),i=Number.isFinite(a.anchor)?a.anchor:n,o=Math.min(e,t),c=Math.max(e,t),r=(e,t)=>i+t((e-i)/l)*l,d=r(o,Math.floor),_=r(c,Math.ceil),u=+l;return _-d<u&&(_=d+u),_>s&&(d=Math.min(d,(_=r(s,Math.floor))-u)),d<n&&(_=Math.max(_,(d=r(n,Math.ceil))+u)),{start:d,end:_,slotCount:Math.max(1,Math.floor((_-d)/l))}}function R(e){return e&&Number.isFinite(e.start)&&Number.isFinite(e.end)?Math.max(0,e.end-e.start):0}function P(e){let t=/^(\d{1,2}):(\d{2})$/.exec(String(null!=e?e:"").trim());if(!t)return NaN;let a=Number(t[1]),l=Number(t[2]);if(a>24||l>59)return NaN;let n=60*a+l;return n>1440?NaN:n}function H(e){let t=Number.isFinite(e)?Math.max(0,Math.min(1440,Math.round(e))):0,a=Math.floor(t/60);return"".concat(String(a).padStart(2,"0"),":").concat(String(t%60).padStart(2,"0"))}let I=e=>"".concat(e.resourceId,":").concat(e.serviceid,":").concat(e.dayOfWeek,":").concat(e.time),L=["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
1ay","Saturday"],W=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"".concat(t,"s");return"".concat(e," ").concat(1===e?t:a)};var G=a(74424),z=a.n(G);let U=e=>{let{day:t,axis:a,selected:s,onToggleSlot:i,onAdd:o}=e,r=Math.max(1,a.endMinutes-a.startMinutes),d=(e,t)=>({left:"".concat((e-a.startMinutes)/r*100,"%"),width:"".concat(Math.max(1,t-e)/r*100,"%")}),[_,u]=n.useState(null),m=n.useRef(null);return n.useEffect(()=>{if(!_)return;let e=e=>{"Escape"===e.key&&(u(null),m.current=null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[_]),(0,l.jsx)("div",{className:z().day,children:t.resources.map(e=>(0,l.jsxs)("section",{className:z().resource,"aria-label":"".concat(e.resource.name,", scheduled slots"),children:[(0,l.jsxs)("header",{className:z().resourceHead,children:[(0,l.jsx)("h3",{className:z().resourceName,children:e.resource.name}),(0,l.jsx)("p",{className:z().resourceSummary,children:0===e.counts.total?"Nothing scheduled on this day":"".concat(B(e.times.total,"start time")," \xb7 ").concat(e.times.booked," taken \xb7 ").concat(B(e.counts.total,"slot offer")," across ").concat(B(e.services.length,"service"))}),(0,l.jsxs)("button",{type:"button",className:z().addService,onClick:()=>o(e.resource.id,null,t.dayOfWeek),children:[(0,l.jsx)(c.GGD,{"aria-hidden":"true"})," Add slots"]})]}),0===e.services.length?(0,l.jsxs)("p",{className:z().empty,children:["No service offers a bookable slot in ",e.resource.name," on this day.",e.silentServiceCount>0?" ".concat(B(e.silentServiceCount,"service is","services are")," set up here but ").concat(1===e.silentServiceCount?"offers":"offer"," nothing."):""]}):(0,l.jsxs)("table",{className:z().grid,children:[(0,l.jsxs)("caption",{className:z().srOnly,children:["Slots scheduled in ",e.resource.name," on ",t.label,", by service and time."]}),(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{scope:"col",className:z().gridCorner,children:"Service"}),(0,l.jsxs)("th",{scope:"col",className:z().gridAxis,children:[(0,l.jsx)("span",{className:z().axis,"aria-hidden":"true",children:a.ticks.map(e=>(0,l.jsx)("span",{className:z().axisTick,style:{left:"".concat((e-a.startMinutes)/r*100,"%")},children:J(e)},e))}),(0,l.jsx)("span",{className:z().srOnly,children:"Time of day"})]})]})}),(0,l.jsx)("tbody",{children:e.services.map(n=>(0,l.jsx)(q,{service:n,day:t,resourceId:e.resource.id,resourceName:e.resource.name,axis:a,position:d,selected:s,onToggleSlot:i,onAdd:o,drag:_,onDrag:(e,t)=>{m.current=t,u(e)},onDragEnd:()=>(e=>{var t;_&&(o(_.resourceId,_.serviceid,e,{from:H(_.start),to:H(_.end),roomSlotCount:null==(t=m.current)?void 0:t.roomSlotCount}),u(null))})(t.dayOfWeek)},n.serviceid))})]})]},e.resource.id))})},q=e=>{let{service:t,day:a,resourceId:s,resourceName:i,axis:r,position:d,selected:_,onToggleSlot:u,onAdd:m,drag:h,onDrag:p,onDragEnd:y}=e,b=Math.max(1,r.endMinutes-r.startMinutes),f=n.useRef(0),v=null!==h&&h.resourceId===s&&h.serviceid===t.serviceid,x={step:t.durationMinutes,anchor:t.slots.length?t.slots[0].startMinutes:null,axisStart:r.startMinutes,axisEnd:r.endMinutes},k=e=>(function(e,t,a,l){return t.width?a+Math.max(0,Math.min(1,(e-t.left)/t.width))*(l-a):a})(e.clientX,e.currentTarget.getBoundingClientRect(),r.startMinutes,r.endMinutes);return(0,l.jsxs)("tr",{className:z().row,children:[(0,l.jsxs)("th",{scope:"row",className:z().rowHead,children:[(0,l.jsx)("span",{className:o()(z().swatch,z()["swatch--".concat(t.category)]),"aria-hidden":"true"}),(0,l.jsx)("span",{className:z().rowName,children:t.name}),(0,l.jsx)("span",{className:z().rowMeta,children:0===t.counts.total?"No slots":"".concat(B(t.counts.total,"slot")," \xb7 ").concat(t.durationMinutes||"?"," min")}),(0,l.jsx)("button",{type:"button",className:z().rowAdd,onClick:()=>m(s,t.serviceid,a.dayOfWeek,{from:"",to:"",roomSlotCount:t.roomSlotCount}),"aria-label":"Add ".concat(t.name," slots to every ").concat(K(a.dayOfWeek)),children:(0,l.jsx)(c.GGD,{"aria-hidden":"true"})})]}),(0,l.jsxs)("td",{className:o()(z().track,{[z()["track--drawing"]]:v}),onPointerDown:e=>{0===e.button&&(e.target.closest("button")||(f.current=k(e),e.currentTarget.setPointerCapture(e.pointerId),p({resourceId:s,serviceid:t.serviceid,...E(f.current,f.current,x)},{roomSlotCount:t.roomSlotCount})))},onPointerMove:e=>{v&&p({resourceId:s,serviceid:t.serviceid,...E(f.current,k(e),x)},{roomSlotCount:t.roomSlotCount})},onPointerUp:e=>{v&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),y())},onPointerCancel:()=>p(null,{roomSlotCount:t.roomSlotCount}),title:"Drag across this row to add ".concat(t.name," slots to every ").concat(K(a.dayOfWeek)),children:[(0,l.jsx)("span",{className:z().gridlines,"aria-hidden":"true",children:r.ticks.map(e=>(0,l.jsx)("span",{className:z().gridline,style:{left:"".concat((e-r.startMinutes)/b*100,"%")}},e))}),t.slots.map(e=>{let n={resourceId:s,resourceName:i,serviceid:t.serviceid,serviceName:t.name,dayOfWeek:a.dayOfWeek,time:e.start,date:a.date},c=I(n),r="open"===e.status;return(0,l.jsx)("button",{type:"button",className:o()(z().slot,z()["slot--".concat(e.status)],z()["slot--".concat(t.category)],{[z()["slot--selected"]]:_.has(c),[z()["slot--outside"]]:e.outsideHours}),style:d(e.startMinutes,e.endMinutes),disabled:!r,"aria-pressed":r?_.has(c):void 0,onPointerDown:e=>e.stopPropagation(),onClick:()=>r&&u(n,e),title:function(e,t){var a,l;let n="".concat(t.name,", ").concat(e.start," to ").concat(e.end),s="booked"===e.status?"booked":"blocked"===e.status?"not bookable: ".concat(null!=(a=e.reason)?a:"blocked"):"closed"===e.status?"not bookable: ".concat(null!=(l=e.reason)?l:"the site is closed"):"on offer and free",i=e.outsideHours?". This is outside the room's working hours, so the planner counts the room shut while the booking page still sells it.":"";return"".concat(n,". ").concat(s).concat(i)}(e,t),children:(0,l.jsx)("span",{className:z().slotTime,children:e.start})},c)}),v&&h?(0,l.jsx)("span",{className:z().ghost,style:d(h.start,h.end),role:"status",children:(0,l.jsxs)("span",{className:z().ghostLabel,children:[H(h.start)," to ",H(h.end)," \xb7"," ",B(h.slotCount,"slot")]})}):null,0!==t.slots.length||v?null:(0,l.jsx)("span",{className:z().trackEmpty,children:"Nothing scheduled. Drag here to add slots."})]})]})},J=e=>{let t=Math.floor(e/60);return 0===t||24===t?"12am":12===t?"12pm":t<12?"".concat(t,"am"):"".concat(t-12,"pm")},K=e=>
1["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e],Y=e=>{let{data:t,selected:a,onToggleSlot:s,onAdd:i,onOpenDay:r}=e,d=n.useMemo(()=>{let e=new Map;for(let l of t.days)for(let t of l.resources){var a;let l=null!=(a=e.get(t.resource.id))?a:{name:t.resource.name,services:new Map};for(let e of t.services)l.services.set(e.serviceid,{name:e.name,category:e.category});e.set(t.resource.id,l)}return Array.from(e.entries()).map(e=>{let[t,a]=e;return{id:t,name:a.name,services:Array.from(a.services.entries()).map(e=>{let[t,a]=e;return{serviceid:t,...a}}).sort((e,t)=>e.name.localeCompare(t.name))}})},[t]),_=n.useCallback((e,a,l)=>{var n,s,i;return null!=(i=null==(s=t.days.find(t=>t.date===e))||null==(n=s.resources.find(e=>e.resource.id===a))?void 0:n.services.find(e=>e.serviceid===l))?i:null},[t]);return d.every(e=>0===e.services.length)?(0,l.jsx)("p",{className:z().empty,children:"Nothing is scheduled anywhere at this site this week."}):(0,l.jsx)("div",{className:z().weekScroll,children:(0,l.jsxs)("table",{className:z().week,children:[(0,l.jsx)("caption",{className:z().srOnly,children:"Slots scheduled each weekday, by room and service. Times are recurring: each column is the same every week."}),(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{scope:"col",className:z().weekCorner,children:"Service"}),t.days.map(e=>(0,l.jsx)("th",{scope:"col",className:o()(z().weekHead,{[z()["weekHead--today"]]:e.isToday}),children:(0,l.jsxs)("button",{type:"button",className:z().weekHeadButton,onClick:()=>r(e.date),title:"Open ".concat(e.label," in the day view"),children:[(0,l.jsx)("span",{className:z().weekHeadDay,children:e.label}),(0,l.jsx)("span",{className:z().weekHeadCount,children:e.closureReason?"Closed":0===e.times.total?"None":"".concat(e.times.total," times")})]})},e.date))]})}),(0,l.jsx)("tbody",{children:d.map(e=>(0,l.jsxs)(n.Fragment,{children:[(0,l.jsx)("tr",{className:z().weekGroup,children:(0,l.jsx)("th",{scope:"colgroup",colSpan:8,className:z().weekGroupHead,children:e.name})}),0===e.services.length?(0,l.jsx)("tr",{children:(0,l.jsxs)("td",{colSpan:8,className:z().empty,children:["Nothing is scheduled in ",e.name," this week."]})}):null,e.services.map(n=>(0,l.jsxs)("tr",{className:z().weekRow,children:[(0,l.jsxs)("th",{scope:"row",className:z().weekRowHead,children:[(0,l.jsx)("span",{className:o()(z().swatch,z()["swatch--".concat(n.category)]),"aria-hidden":"true"}),(0,l.jsx)("span",{className:z().rowName,children:n.name})]}),t.days.map(t=>{var r,d;let u=_(t.date,e.id,n.serviceid),m=null!=(r=null==u?void 0:u.slots)?r:[];return(0,l.jsx)("td",{className:o()(z().weekCell,{[z()["weekCell--empty"]]:0===m.length}),children:0===m.length?(0,l.jsx)("button",{type:"button",className:z().weekCellAdd,onClick:()=>i(e.id,n.serviceid,t.dayOfWeek),"aria-label":"No ".concat(n.name," slots on ").concat(t.label," in ").concat(e.name,". Add some to every ").concat(t.label.slice(0,3),"."),children:(0,l.jsx)(c.GGD,{"aria-hidden":"true"})}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:z().weekChips,children:m.map(i=>{var c;let r={resourceId:e.id,resourceName:e.name,serviceid:n.serviceid,serviceName:n.name,dayOfWeek:t.dayOfWeek,time:i.start,date:t.date},d=I(r),_="open"===i.status;return(0,l.jsx)("button",{type:"button",className:o()(z().chip,z()["chip--".concat(i.status)],{[z()["chip--selected"]]:a.has(d)}),disabled:!_,"aria-pressed":_?a.has(d):void 0,onClick:()=>_&&s(r,i),title:"".concat(n.name,", ").concat(i.start," on ").concat(t.label,". ").concat("booked"===i.status?"Booked.":"open"===i.status?"On offer and free. Select to remove it from every "+t.label.slice(0,3)+".":null!=(c=i.reason)?c:"Not bookable."),children:i.start},d)})}),(0,l.jsxs)("span",{className:z().weekCellMeta,children:[null!=(d=null==u?void 0:u.counts.open)?d:0," open"]})]})},t.date)})]},n.serviceid))]},e.id))})]})})},V=e=>{let{data:t,metric:a,onOpenDay:n}=e,s=t.days;if(0===s.length)return null;let i=(s[0].dayOfWeek+6)%7,c=Math.max(1,...s.map(e=>e.times.total));return(0,l.jsxs)("div",{className:z().month,children:[(0,l.jsx)("div",{className:z().monthHead,"aria-hidden":"true",children:[1,2,3,4,5,6,0].map(e=>(0,l.jsx)("span",{className:z().monthHeadCell,children:W[e]},e))}),(0,l.jsxs)("div",{className:z().monthGrid,role:"list",children:[Array.from({length:i},(e,t)=>(0,l.jsx)("span",{className:z().monthBlank,"aria-hidden":"true"},"lead-".concat(t))),s.map(e=>(0,l.jsxs)("button",{type:"button",role:"listitem",className:o()(z().monthCell,{[z()["monthCell--today"]]:e.isToday,[z()["monthCell--closed"]]:!!e.closureReason,[z()["monthCell--silent"]]:!e.closureReason&&0===e.counts.total}),onClick:()=>n(e.date),"aria-label":Q(e,a),title:Q(e,a),children:[(0,l.jsx)("span",{className:z().monthDate,children:$(e.date)}),e.closureReason?(0,l.jsx)("span",{className:z().monthClosed,children:"Closed"}):"coverage"===a?(0,l.jsx)(X,{day:e}):(0,l.jsx)(Z,{day:e,busiest:c})]},e.date))]})]})},X=e=>{let{day:t}=e,a=new Map;for(let e of t.resources)for(let t of e.services){var n;0!==t.counts.total&&a.set(t.name,(null!=(n=a.get(t.name))?n:0)+t.counts.total)}let s=Array.from(a.entries()).sort((e,t)=>
1t[1]-e[1]||e[0].localeCompare(t[0]));if(0===s.length)return(0,l.jsx)("span",{className:z().monthNone,children:"Nothing scheduled"});let i=s.slice(0,3),o=s.length-i.length;return(0,l.jsxs)("span",{className:z().monthServices,children:[i.map(e=>{let[t,a]=e;return(0,l.jsxs)("span",{className:z().monthService,children:[(0,l.jsx)("span",{className:z().monthServiceName,children:t}),(0,l.jsx)("span",{className:z().monthServiceCount,children:a})]},t)}),o>0?(0,l.jsx)("span",{className:z().monthMore,children:"+".concat(o," more")}):null]})},Z=e=>{let{day:t,busiest:a}=e,{total:n,booked:s}=t.times;return 0===n?(0,l.jsx)("span",{className:z().monthNone,children:"Nothing scheduled"}):(0,l.jsxs)("span",{className:z().monthLoad,children:[(0,l.jsx)("span",{className:z().monthBar,style:{width:"".concat(Math.round(n/a*100),"%")},children:(0,l.jsx)("span",{className:z().monthBarFill,style:{width:"".concat(Math.round(s/n*100),"%")}})}),(0,l.jsxs)("span",{className:z().monthLoadText,children:[s," of ",n," times taken"]})]})};function Q(e,t){let a=e.label;if(e.closureReason)return"".concat(a,": the site is closed.");if(0===e.counts.total)return"".concat(a,": nothing is scheduled. Select to open the day.");if("load"===t)return"".concat(a,": ").concat(B(e.times.total,"start time")," on offer, ").concat(e.times.booked," taken, ").concat(e.times.open," with nothing booked. Select to open the day.");let l=new Set;for(let t of e.resources)for(let e of t.services)e.counts.total>0&&l.add(e.name);return"".concat(a,": ").concat(B(l.size,"service")," on offer, over ").concat(B(e.times.total,"start time"),". Select to open the day.")}let $=e=>Number(e.split("-")[2]);var ee=a(15941),et=a(80490);let ea="09:00",el="12:00",en=e=>{var t,a,s;let{isOpen:i,onClose:c,resources:r,services:d,initial:_,busy:u,error:m,onSubmit:h}=e,[p,y]=n.useState(0),[b,f]=n.useState(0),[v,x]=n.useState([]),[k,S]=n.useState(ea),[j,g]=n.useState(el),[N,w]=n.useState("");n.useEffect(()=>{var e,t,a,l,n;i&&_&&(y(_.resourceId),f(null!=(a=_.serviceid)?a:0),x([_.dayOfWeek]),S(null!=(l=null==(e=_.range)?void 0:e.from)?l:ea),g(null!=(n=null==(t=_.range)?void 0:t.to)?n:el),w(""))},[i,_]);let C=null!=(t=d.find(e=>e.serviceid===b))?t:null,T=Number(N)>0?Number(N):null!=(a=null==C?void 0:C.durationMinutes)?a:0,M=n.useMemo(()=>{var e;return function(e,t,a,l){let n=es(e),s=es(t),i=Math.round(a),o=Math.max(1,Math.round(l||a));if(null===n||null===s||i<=0||s<=n)return[];let c=[];for(let e=n;e+o<=s&&c.length<200;e+=i){var r;c.push((r=e,"".concat(String(Math.floor(r/60)).padStart(2,"0"),":").concat(String(r%60).padStart(2,"0"))))}return c}(k,j,T,null!=(e=null==C?void 0:C.durationMinutes)?e:T)},[k,j,T,C]),A=p>0&&b>0&&v.length>0&&M.length>0&&!u;return(0,l.jsx)(ee._,{isOpen:i,onClose:c,eyebrow:"Scheduled slots",title:(null==_?void 0:_.range)?"Add the slots you drew":"Add slots",footer:(0,l.jsxs)("div",{className:z().drawerFooter,children:[(0,l.jsx)("button",{type:"button",className:z().drawerCancel,onClick:c,disabled:u,children:"Cancel"}),(0,l.jsx)(et.d,{label:M.length&&v.length?"Add ".concat(M.length*v.length," slots"):"Add slots",isLoading:u,disabled:!A,onClick:()=>h({resourceId:p,serviceid:b,weekdays:v,times:M})})]}),children:(0,l.jsxs)("div",{className:z().form,children:[m?(0,l.jsx)(F.Y,{tone:"error",message:m}):null,(0,l.jsxs)("div",{className:z().field,children:[(0,l.jsx)("label",{className:z().label,htmlFor:"add-slots-room",children:"Room or clinician"}),(0,l.jsxs)("select",{id:"add-slots-room",className:z().select,value:p||"",onChange:e=>y(Number(e.target.value)),children:[(0,l.jsx)("option",{value:"",children:"Choose one"}),r.map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,l.jsxs)("div",{className:z().field,children:[(0,l.jsx)("label",{className:z().label,htmlFor:"add-slots-service",children:"Service"}),(0,l.jsxs)("select",{id:"add-slots-service",className:z().select,value:b||"",onChange:e=>f(Number(e.target.value)),children:[(0,l.jsx)("option",{value:"",children:"Choose one"}),d.map(e=>(0,l.jsxs)("option",{value:e.serviceid,children:[e.name,e.durationMinutes?" (".concat(e.durationMinutes," min)"):""]},e.serviceid))]}),C&&!C.durationMinutes?(0,l.jsx)("p",{className:z().help,children:"This service has no appointment length set, so a spacing has to be given below."}):null]}),(0,l.jsxs)("fieldset",{className:z().field,children:[(0,l.jsx)("legend",{className:z().label,children:"Every"}),(0,l.jsx)("div",{className:z().weekdays,role:"group",children:[1,2,3,4,5,6,0].map(e=>(0,l.jsx)("button",{type:"button",className:o()(z().weekday,{[z()["weekday--on"]]:v.includes(e)}),"aria-pressed":v.includes(e),onClick:()=>(e=>x(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e].sort()))(e),children:W[e]},e))}),(0,l.jsx)("p",{className:z().help,children:0===v.length?"Choose at least one day.":"These slots will run every ".concat(v.map(e=>L[e]).join(", "),", from now on.")}
1)]}),(0,l.jsxs)("div",{className:z().fieldRow,children:[(0,l.jsxs)("div",{className:z().field,children:[(0,l.jsx)("label",{className:z().label,htmlFor:"add-slots-from",children:"First slot"}),(0,l.jsx)("input",{id:"add-slots-from",type:"time",className:z().input,value:k,onChange:e=>S(e.target.value)})]}),(0,l.jsxs)("div",{className:z().field,children:[(0,l.jsx)("label",{className:z().label,htmlFor:"add-slots-to",children:"Ends by"}),(0,l.jsx)("input",{id:"add-slots-to",type:"time",className:z().input,value:j,onChange:e=>g(e.target.value)})]}),(0,l.jsxs)("div",{className:z().field,children:[(0,l.jsx)("label",{className:z().label,htmlFor:"add-slots-step",children:"Every"}),(0,l.jsx)("input",{id:"add-slots-step",type:"number",min:5,max:240,step:5,className:z().input,value:N,placeholder:(null==C?void 0:C.durationMinutes)?String(C.durationMinutes):"20",onChange:e=>w(e.target.value)}),(0,l.jsx)("p",{className:z().help,children:"minutes"})]})]}),(0,l.jsxs)("div",{className:z().preview,children:[(0,l.jsx)("p",{className:z().previewHead,children:0===M.length?"No slots yet":"".concat(B(M.length,"slot")," on each day chosen")}),0===M.length?(0,l.jsx)("p",{className:z().help,children:T<=0?"Set a spacing in minutes.":"The last slot has to finish by the end time. Try a later end or a shorter spacing."}):(0,l.jsx)("p",{className:z().previewTimes,children:M.join("   ")}),1===M.length&&(null!=(s=null==_?void 0:_.roomSlotCount)?s:0)<2?(0,l.jsx)(F.Y,{tone:"warning",message:"A single slot is not bookable here yet",detail:"This room has no other slots for this service on this day, so the booking system has no spacing to work from and one slot on its own would never be offered. Widen the range to add at least two."}):null]}),(0,l.jsx)(F.Y,{tone:"warning",message:"This changes the public booking page",detail:"Slots here recur: they appear on every future occurrence of the days chosen, and patients can book them straight away. There is no way to add a slot to one date only from this screen."})]})})};function es(e){let t=/^([01]\d|2[0-3]):([0-5]\d)$/.exec(null!=e?e:"");return t?60*Number(t[1])+Number(t[2]):null}let ei=e=>{var t,a;let{data:s,monthMetric:i,onMonthMetricChange:o,onOpenDay:d,onRefresh:_}=e,[u,m]=n.useState(new Map),[h,p]=n.useState(!1),[y,b]=n.useState(null),[f,v]=n.useState(null),[x,k]=n.useState(null);n.useEffect(()=>{m(new Map)},[s.from,s.to,s.mode]);let S=(e,t)=>{let a=I(e);m(t=>{let l=new Map(t);return l.has(a)?l.delete(a):l.set(a,e),l})},j=n.useMemo(()=>{let e=new Map;for(let a of Array.from(u.values())){var t;let l="".concat(a.resourceId,":").concat(a.serviceid,":").concat(a.dayOfWeek),n=null!=(t=e.get(l))?t:{resourceId:a.resourceId,resourceName:a.resourceName,serviceid:a.serviceid,serviceName:a.serviceName,dayOfWeek:a.dayOfWeek,times:[]};n.times.includes(a.time)||n.times.push(a.time),e.set(l,n)}return Array.from(e.values()).map(e=>({...e,times:[...e.times].sort()}))},[u]),g=async(e,t)=>{var a,l;let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s=await n.json().catch(()=>null);return n.ok?{ok:!0}:{ok:!1,code:null==s?void 0:s.code,message:null!=(l=null!=(a=null==s?void 0:s.message)?a:null==s?void 0:s.error)?l:"That did not work.",detail:null==s?void 0:s.detail}},N=async(e,t)=>{let a=null!=t?t:j;p(!0);let n=[],i=new Set,o=[],c=0;for(let t of a){let a=await g("/api/admin/capacity/scheduled-slots/delete",{resource_id:t.resourceId,serviceid:t.serviceid,day_of_week:t.dayOfWeek,times:t.times,from_date:s.anchor,confirm_shared:e});if(a.ok){c+=t.times.length;continue}if("SHARED_SERVICE"===a.code){var d,u;for(let e of(n.push(t),null!=(u=null==(d=a.detail)?void 0:d.rooms)?u:[]))(null==e?void 0:e.name)&&i.add(String(e.name));continue}o.push("".concat(t.serviceName,": ").concat(a.message))}for(let e of(p(!1),k(null),c>0&&(m(new Map),await _(),r.oR.success("".concat(B(c,"slot")," removed from every future week."))),o))r.oR.error(e,{autoClose:12e3});if(n.length>0){let e=Array.from(i),t=Array.from(new Set(n.map(e=>e.serviceName)));k({title:1===t.length?"".concat(t[0]," also runs in another room"):"Some of these services also run in another room",detail:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{children:[e.length?"".concat(e.join(" and ")," ").concat(1===e.length?"runs":"run"," the same service on the same day."):"Another room runs the same service on the same day."," ","A service publishes one set of start times across every room it runs in, so removing these here removes them there as well."]}),(0,l.jsx)("p",{children:"Nothing has been changed yet."})]}),confirmLabel:"Remove from every room",run:()=>void N(!0,n)})}},w=async e=>{p(!0),v(null);let t=0,a=[];for(let l of e.weekdays){let n=await g("/api/admin/capacity/scheduled-slots/create",{resource_id:e.resourceId,serviceid:e.serviceid,day_of_week:l,times:e.times,from_date:s.anch
1or});if(n.ok){t+=e.times.length;continue}a.push("".concat(L[l],": ").concat(n.message))}if(p(!1),t>0&&(await _(),r.oR.success("".concat(B(t,"slot")," added, recurring every week."))),a.length>0)return void v(a.join(" "));b(null)},C=u.size;return(0,l.jsxs)("div",{className:z().root,children:[C>0?(0,l.jsxs)("div",{className:z().selection,role:"status",children:[(0,l.jsxs)("p",{className:z().selectionText,children:[B(C,"slot")," selected"]}),(0,l.jsx)("button",{type:"button",className:z().selectionRemove,onClick:()=>{let e=j.reduce((e,t)=>e+t.times.length,0),t=Array.from(new Set(j.map(e=>e.dayOfWeek))).sort().map(e=>"".concat(L[e],"s"));k({title:"Remove ".concat(B(e,"slot")," from every ").concat(t.join(" and "),"?"),detail:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{children:[j.map(e=>"".concat(e.serviceName," in ").concat(e.resourceName,": ").concat(e.times.join(", "))).join(". "),"."]}),(0,l.jsxs)("p",{children:["These are recurring, so they stop being offered on every future"," ",t.join(" and "),", on the public booking page as well as here. Appointments already booked are never removed: if any exist, this will refuse and name them."]})]}),confirmLabel:"Remove ".concat(e),run:()=>void N(!1)})},disabled:h,children:"Remove from every week"}),(0,l.jsx)("button",{type:"button",className:z().selectionClear,onClick:()=>m(new Map),"aria-label":"Clear the selection",children:(0,l.jsx)(c.yGN,{"aria-hidden":"true"})})]}):null,0===s.days.length?(0,l.jsx)(F.Y,{message:"There is nothing to show for this range."}):"day"===s.mode?(0,l.jsx)(U,{day:s.days[0],axis:s.axis,selected:new Set(Array.from(u.keys())),onToggleSlot:S,onAdd:(e,t,a,l)=>b({resourceId:e,serviceid:t,dayOfWeek:a,range:(null==l?void 0:l.from)?{from:l.from,to:l.to}:void 0,roomSlotCount:null==l?void 0:l.roomSlotCount})}):"week"===s.mode?(0,l.jsx)(Y,{data:s,selected:new Set(Array.from(u.keys())),onToggleSlot:S,onAdd:(e,t,a)=>b({resourceId:e,serviceid:t,dayOfWeek:a}),onOpenDay:d}):(0,l.jsx)(V,{data:s,metric:i,onOpenDay:d}),(0,l.jsx)(en,{isOpen:null!==y,onClose:()=>{b(null),v(null)},resources:function(e){let t=new Map;for(let a of e.days)for(let e of a.resources)t.set(e.resource.id,e.resource.name);return Array.from(t.entries()).map(e=>{let[t,a]=e;return{id:t,name:a}})}(s),services:s.services,initial:y,busy:h,error:f,onSubmit:e=>void w(e)}),(0,l.jsx)(D.T,{isOpen:null!==x,title:null!=(t=null==x?void 0:x.title)?t:"",detail:null==x?void 0:x.detail,confirmLabel:null!=(a=null==x?void 0:x.confirmLabel)?a:"Confirm",busy:h,busyLabel:"Removing",tone:"danger",onConfirm:()=>null==x?void 0:x.run(),onCancel:()=>k(null)})]})};function eo(e,t){return!Number.isFinite(t)||t<=0?e:Math.ceil(e/t)*t}var ec=a(91690),er=a(53566),ed=a.n(er);let e_=e=>{var t,a,s,i;let{gap:c,services:r,saving:d,error:_,onCancel:u,onCreate:m}=e,[h,p]=n.useState(""),[y,b]=n.useState(null),[f,v]=n.useState("equal"),[x,k]=n.useState(null),[S,j]=n.useState(10),[g,N]=n.useState(0),[w,C]=n.useState([]),[T,M]=n.useState({start:"",end:""}),[A,O]=n.useState(null),[E,I]=n.useState(!1),L=n.useRef(null),W=n.useMemo(()=>c?{start:P(c.start),end:P(c.end)}:null,[c]);n.useEffect(()=>{var e;if(!c||!W)return;p(""),b(null),v("equal"),j(null!=(e=c.searchedMinutes)?e:10),N(0),C([]),O(null),I(!1),M({start:H(W.start),end:H(Math.min(W.end,W.start+20))});let t=window.setTimeout(()=>{var e;return null==(e=L.current)?void 0:e.focus()},50);return()=>window.clearTimeout(t)},[c,W]);let B=n.useMemo(()=>W?null===A?W:{start:A,end:W.end}:null,[W,A]),G=n.useMemo(()=>B?function(e){var t;let a=null==e?void 0:e.gap,l=null==e?void 0:e.slotMinutes,n=null!=(t=null==e?void 0:e.snapMinutes)?t:0,s={slots:[],leftoverMinutes:R(null!=a?a:{start:0,end:0}),snapLossMinutes:0,suggestion:null};if(!a||!Number.isFinite(l)||l<=0)return s;if(0>=R(a))return{...s,leftoverMinutes:0};let i=n>0?eo(a.start,n):a.start,o=Math.max(0,i-a.start),c=a.end-i;if(c<=0)return{slots:[],leftoverMinutes:0,snapLossMinutes:o,suggestion:null};let r=Math.floor(c/l);if(0===r)return{slots:[],leftoverMinutes:c,snapLossMinutes:o,suggestion:null};let d=[];for(let e=0;e<r;e+=1)d.push({start:i+e*l,end:i+(e+1)*l});let _=c-r*l;return{slots:d,leftoverMinutes:_,snapLossMinutes:o,suggestion:function(e,t,a,l,n){if(0===n)return null;let s=a>0?a:1;for(let n=e.start+s;n<e.end;n+=s){let s=a>0?eo(n,a):n,i=e.end-s;if(i<=0)break;let o=Math.floor(i/t),c=i-o*t;if(o>l||o===l&&0===c)return{start:s,slots:o,leftoverMinutes:c};if(o<l)break}return null}(a,l,n,r,_)}}({gap:B,slotMinutes:S,snapMinutes:g}):null,[B,S,g]),z=n.useMemo(()=>W&&T.start&&T.end?function(e,t,a){return a&&Number.isFinite(a.start)&&Number.isFinite(a.end)?a.end===a.start?"ZERO_LENGTH":a.end<a.start?"INVERTED":e&&e&&a&&a.start>=e.start&&a.end<=e.end?(null!=t?t:[]).some(e=>!!e&&!!a&&e.start<a.end&&a.start<e.end)?"OVERLAPS_EXISTING":null:"OUTSIDE_GAP":"INVERTED"}(W,w,{start:P(T.start),end:P(T.end)}):null,[W,w,T]),U="equal"===f?null!=(t=null==G?void 0:G.slots)?t:[]:w,q=U.length;h.trim().length>0||w.length;let J=()=>{if(w.length>0)return void k({title:"Discard the blocks you have added?",confirmLabel:"Discard",run:u});u()},K=!!(c&&W);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(D.T,{isOpen:null!==x,title:null!=(a=null==x?void 0:x.title)?a:"",confirmLabel:null!=(s=null==x?void 0:x.confirmLabel)?s:"Confirm",onCancel:()=>k(null),onConfirm:()=>{k(null),null==x||x.run()}}),(0,l.jsx)(ee._,{isOpen:K,onClose:J,eyebrow:null!=(i=null==c?void 0:c.resourceName)?i:"",title:"New service in this gap",ariaLabel:c?"New service in the ".concat(eh(c.start)," to ").concat(eh(c.end)," gap in ").concat(c.resourceName):"New service in this gap",footer
1:c&&W?(0,l.jsxs)("div",{className:ed().adhoc__footer,children:[0!==q&&h.trim()?(0,l.jsxs)("p",{className:ed().adhoc__blocked,children:[ep(U.reduce((e,t)=>e+(t.end-t.start),0))," ","of the gap used"]}):(0,l.jsx)("p",{className:ed().adhoc__blocked,children:h.trim()?"That length does not fit in this gap.":"Name the service to create it."}),(0,l.jsxs)("div",{className:ed().adhoc__actions,children:[(0,l.jsx)(et.d,{label:"Cancel",modifier:"secondary",icon:!1,onClick:J}),(0,l.jsx)(et.d,{label:0===q?"Create slots":"Create ".concat(q," slot").concat(1===q?"":"s"),onClick:()=>{c&&B&&0!==q&&m({resource_id:c.resourceId,date:c.date,name:h.trim(),serviceid:y,publish_online:E,mode:f,..."equal"===f?{slotMinutes:S,snapMinutes:g}:{blocks:w.map(e=>({start:H(e.start),end:H(e.end)}))},gap:{start:H(B.start),end:H(B.end)}})},isLoading:d,disabled:d||0===q||!h.trim()})]})]}):null,children:c&&W?(0,l.jsxs)("div",{className:ed().adhoc,children:[(0,l.jsxs)("p",{className:ed().adhoc__context,children:[c.dateLabel," \xb7 ",eh(c.start),"–",eh(c.end)," ","\xb7 ",ep(W.end-W.start)," available"]}),_?(0,l.jsx)(F.Y,{tone:"error",message:_}):null,c.shortOfSearch?(0,l.jsx)(F.Y,{message:"This gap is ".concat(ep(W.end-W.start),", shorter than the ").concat(c.shortOfSearch," min you searched for.")}):null,(0,l.jsxs)("div",{className:ed().adhoc__field,children:[(0,l.jsx)(ec.J,{id:"adhoc-name",label:"Service name",required:!0}),(0,l.jsx)("input",{id:"adhoc-name",ref:L,className:ed().adhoc__input,value:h,list:"adhoc-service-names",placeholder:"NHS Men B Vaccine",onChange:e=>{let t=e.target.value;p(t);let a=r.find(e=>e.name.trim().toLowerCase()===t.trim().toLowerCase());b(a?a.serviceid:null)}}),(0,l.jsx)("datalist",{id:"adhoc-service-names",children:r.map(e=>(0,l.jsx)("option",{value:e.name},e.serviceid))})]}),(0,l.jsx)("div",{className:ed().adhoc__modes,role:"group","aria-label":"How to fill the gap",children:["equal","custom"].map(e=>(0,l.jsx)("button",{type:"button",className:o()(ed().adhoc__mode,{[ed()["adhoc__mode--on"]]:f===e}),"aria-pressed":f===e,onClick:()=>(e=>{if(e!==f){if("equal"===e&&w.length>0)return void k({title:"Switch to equal slots?",confirmLabel:"Switch",run:()=>{C([]),v("equal")}});"equal"===e&&C([]),v(e)}})(e),children:"equal"===e?"Equal slots":"Custom time blocks"},e))}),"equal"===f?(0,l.jsx)(eu,{slotMinutes:S,setSlotMinutes:j,snapMinutes:g,setSnapMinutes:N,slice:G,gapStart:W.start,startOverride:A,setStartOverride:O}):(0,l.jsx)(em,{bounds:W,blocks:w,candidate:T,candidateError:z,setCandidate:M,addBlock:()=>{if(!W||z)return;let e=[...w,{start:P(T.start),end:P(T.end)}].sort((e,t)=>e.start-t.start);C(e);let t=e[e.length-1].end;t<W.end&&M({start:H(t),end:H(Math.min(W.end,t+20))})},removeBlock:e=>C(w.filter((t,a)=>a!==e))}),(0,l.jsxs)("label",{className:ed().adhoc__publish,children:[(0,l.jsx)("input",{type:"checkbox",checked:E,onChange:e=>I(e.target.checked)}),(0,l.jsxs)("span",{children:[(0,l.jsx)("strong",{children:"Show on the website"}),(0,l.jsx)("span",{className:ed()["adhoc__publish-note"],children:null===y?"Patients can find and book it from the services and booking pages. It disappears on its own once the day passes or every slot is taken.":"Adds these slots to an existing service, so they appear wherever that service already does."})]})]})]}):null})]})},eu=e=>{var t,a;let{slotMinutes:n,setSlotMinutes:s,snapMinutes:i,setSnapMinutes:o,slice:c,gapStart:r,startOverride:d,setStartOverride:_}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:ed().adhoc__row,children:[(0,l.jsxs)("div",{className:ed().adhoc__field,children:[(0,l.jsx)(ec.J,{id:"adhoc-length",label:"Appointment length"}),(0,l.jsxs)("div",{className:ed()["adhoc__with-unit"],children:[(0,l.jsx)("input",{id:"adhoc-length",type:"number",min:5,max:480,step:5,className:ed().adhoc__input,value:n,onChange:e=>s(Number(e.target.value))}),(0,l.jsx)("span",{className:ed().adhoc__unit,children:"min"})]})]}),(0,l.jsxs)("div",{className:ed().adhoc__field,children:[(0,l.jsx)(ec.J,{id:"adhoc-snap",label:"Start on"}),(0,l.jsxs)("select",{id:"adhoc-snap",className:ed().adhoc__input,value:i,onChange:e=>o(Number(e.target.value)),children:[(0,l.jsx)("option",{value:0,children:"Exactly when the gap starts"}),(0,l.jsx)("option",{value:5,children:"The next 5 minutes"}),(0,l.jsx)("option",{value:15,children:"The next quarter hour"})]})]})]}),c?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{className:ed().adhoc__summary,children:[(0,l.jsxs)("strong",{children:[c.slots.length," slot",1===c.slots.length?"":"s"," of"," ",n," min"]})," ","\xb7 ",c.leftoverMinutes,"m left over"]}),c.snapLossMinutes>0?(0,l.jsxs)("p",{className:ed().adhoc__note,children:["Free time starts ",eh(H(r)),"; first slot rounded to ",eh(H(null!=(a=null==(t=c.slots[0])?void 0:t.start)?a:r)),"."]}):null,c.suggestion?(0,l.jsxs)("p",{className:ed().adhoc__note,children:["Start at ",eh(H(c.suggestion.start))," instead to fit ",c.suggestion.slots," slots with"," ",c.suggestion.leftoverMinutes,"m left over."," ",(0,l.jsx)("button",{type:"button",className:ed().adhoc__link,onClick:()=>_(c.suggestion.start),children:"Use this"})]}):null,null!==d?(0,l.jsxs)("p",{className:ed().adhoc__note,children:["Starting at ",eh(H(d)),"."," ",(0,l.jsx)("button",{type:"button",className:ed().adhoc__link,onClick:()=>_(null),children:"Use the whole gap"})]}):null,(0,l.jsx)("ul",{className:ed().adhoc__chips,children:c.slots.map(e=>(0,l.jsx)("li",{className:ed().adhoc__chip,children:eh(H(e.start))},e.start))})]}):null]})},em=e=>{let{bounds:t,blocks:a,candidate:n,candidateError:s,setCandidate:i,addBlock:o,removeBlock:r}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:ed().adhoc__row,children:[(0,l.jsxs)("div",{className:ed().adhoc__field,children:[(0,l.jsx)(ec.J,{id:"adhoc-from",label:"From"}),(0,l.jsx)("input",{id:"adhoc-from",type:"time",className:ed().adhoc__input,value:n.start,onCh
1ange:e=>i({...n,start:e.target.value})})]}),(0,l.jsxs)("div",{className:ed().adhoc__field,children:[(0,l.jsx)(ec.J,{id:"adhoc-to",label:"To"}),(0,l.jsx)("input",{id:"adhoc-to",type:"time",className:ed().adhoc__input,value:n.end,onChange:e=>i({...n,end:e.target.value})})]}),(0,l.jsx)(et.d,{label:"Add block",modifier:"secondary",onClick:o,disabled:!!s||!n.start||!n.end})]}),s?(0,l.jsx)("p",{className:ed().adhoc__error,children:function(e,t){return"OUTSIDE_GAP"===e?"That block is outside ".concat(eh(H(t.start)),"–").concat(eh(H(t.end)),"."):"OVERLAPS_EXISTING"===e?"That overlaps a block you have already added.":"The end time needs to be after the start time."}(s,t)}):null,a.length?(0,l.jsx)("ul",{className:ed().adhoc__blocks,children:a.map((e,t)=>(0,l.jsxs)("li",{className:ed().adhoc__block,children:[(0,l.jsxs)("span",{children:[eh(H(e.start)),"–",eh(H(e.end))]}),(0,l.jsx)("span",{className:ed()["adhoc__block-length"],children:ep(e.end-e.start)}),(0,l.jsx)("button",{type:"button",className:ed().adhoc__remove,onClick:()=>r(t),"aria-label":"Remove the ".concat(eh(H(e.start))," block"),children:(0,l.jsx)(c.IXo,{})})]},"".concat(e.start,"-").concat(e.end)))}):(0,l.jsx)("p",{className:ed().adhoc__note,children:"No blocks yet. Add the first one above."})]})};function eh(e){let[t,a]=e.split(":").map(Number),l=t>=12?"pm":"am",n=t%12==0?12:t%12;return 0===a?"".concat(n).concat(l):"".concat(n,":").concat(String(a).padStart(2,"0")).concat(l)}function ep(e){let t=Math.floor(e/60),a=e%60;return t&&a?"".concat(t,"h ").concat(a,"m"):t?"".concat(t,"h"):"".concat(a,"m")}var ey=a(40091);let eb="chatham.capacity.filters",ef=[{minutes:15,label:"15m"},{minutes:30,label:"30m"},{minutes:60,label:"1h"},{minutes:120,label:"2h"}];function ev(e){return null===e?"closed":e>=75?"high":e>=45?"mid":"low"}function ex(e){if(e<=0)return"0h";let t=Math.floor(e/60),a=e%60;return t&&a?"".concat(t,"h ").concat(a,"m"):t?"".concat(t,"h"):"".concat(a,"m")}function ek(e){let t=new Set,a=0,l=0,n=0,s=0,i={total:0,open:0,booked:0};for(let o of e.days){for(let e of o.resources){for(let a of e.services)a.counts.total>0&&t.add(a.serviceid);a+=e.counts.total,l+=e.counts.open,n+=e.counts.booked,s+=e.counts.unavailable}i.total+=o.times.total,i.open+=o.times.open,i.booked+=o.times.booked}return{total:a,open:l,booked:n,unavailable:s,times:i,services:t.size}}function eS(e){let t=new Set,a=new Set;for(let l of e.days)for(let e of l.resources)for(let l of e.services){for(let a of l.unreachable)t.add("".concat(e.resource.id,":").concat(l.serviceid,":").concat(a));for(let t of l.inertStarts)a.add("".concat(e.resource.id,":").concat(l.serviceid,":").concat(t))}let l=[];return t.size>0&&l.push("".concat(t.size," scheduled ").concat(1===t.size?"slot is":"slots are"," not bookable: the service publishes the time but the room does not take it.")),a.size>0&&l.push("".concat(a.size," ").concat(1===a.size?"slot sits":"slots sit"," on their own in a room's schedule. A single slot never opens a bookable window, so nobody can book it.")),l}function ej(e,t){return"scheduled"!==e?"day":t}var eg=!0;let eN=e=>{var t,a,i,m,h;let{login:p,day:b,services:f,demand:v,week:x,bpChecks:k,scheduled:S,view:j,mode:g,error:N}=e,w=(0,s.useRouter)(),[C,T]=n.useState(new Set),[M,A]=n.useState(b),[O,E]=n.useState(S),[R,P]=n.useState("coverage"),[H,I]=n.useState(null),[L,W]=n.useState(!1),[B,G]=n.useState(null),[z,U]=n.useState(null),[q,J]=n.useState(0),[K,Y]=n.useState(null);n.useEffect(()=>A(b),[b]),n.useEffect(()=>E(S),[S]),n.useEffect(()=>{try{let e=window.localStorage.getItem(eb);e&&T(new Set(JSON.parse(e)))}catch(e){}},[]);let V="scheduled"===j?null!=(t=null==O?void 0:O.anchor)?t:_():null!=(a=null==M?void 0:M.date)?a:_(),X=e=>{let t={date:V,view:j,mode:g,...e},a={date:t.date};return"scheduled"===t.view&&(a.view="scheduled","day"!==t.mode&&(a.mode=t.mode)),w.push({pathname:"/admin/capacity",query:a})},Z=e=>X({date:e}),Q=e=>{let[t,a,l]=V.split("-").map(Number),n="scheduled"===j?g:"day";Z(new Date("month"===n?Date.UTC(t,a-1+e,1):Date.UTC(t,a-1,l+e*("week"===n?7:1))).toISOString().slice(0,10))},$=async()=>{let e=await fetch("/api/admin/capacity/scheduled?date=".concat(V,"&mode=").concat(g));if(!e.ok)return;let t=await e.json();(null==t?void 0:t.results)&&E(t.results)},ee=n.useMemo(()=>(function(e){let t={};if(!e)return t;for(let l of e.resources)for(let e of l.blocks){var a;"free"!==e.kind&&"closed"!==e.kind&&(t[e.category]=(null!=(a=t[e.category])?a:0)+1)}return t})(M),[M]),et=n.useMemo(()=>!M||q<=0?0:M.resources.reduce((e,t)=>
1e+t.blocks.filter(e=>"free"===e.kind&&e.endMinutes-e.startMinutes>=q).length,0),[M,q]),ea=n.useMemo(()=>{var e,t;return null!=(t=null==(e=x.find(e=>e.date===(null==M?void 0:M.date)))?void 0:e.utilisation)?t:null},[x,M]),el=V===_(),en=async e=>{let t=await fetch("/api/admin/capacity/day?date=".concat(e));if(!t.ok)return;let a=await t.json();(null==a?void 0:a.results)&&A(a.results)},es=async(e,t)=>{let a=await fetch("/api/admin/capacity/adhoc-clinic/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clinic_id:e})}),l=await a.json().catch(()=>null);if(!a.ok){var n;r.oR.error(null!=(n=null==l?void 0:l.message)?n:"That clinic could not be removed.");return}await en(t),r.oR.success("Clinic removed.")},eo=async e=>{var t;if(!M||!e.clinicId)return;let a=null!=(t=e.bookedSlotCount)?t:0,n=Math.max(0,e.slotCount-a),s=n*(e.slotMinutes||0);Y({title:"Release ".concat(n," unbooked slot").concat(1===n?"":"s"," from ").concat(e.name,"?"),detail:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{children:["This returns ",ex(s)," to free time."]}),(0,l.jsx)("p",{children:a>0?"The ".concat(a," booked appointment").concat(1===a?"":"s"," ").concat(1===a?"is":"are"," not affected."):"Nothing is booked, so the clinic is removed."})]}),confirmLabel:"Release ".concat(n),tone:"danger",run:()=>void ec(e)})},ec=async e=>{var t,a,l;if(!M||!e.clinicId)return;let n=null!=(t=e.bookedSlotCount)?t:0,s=Math.max(0,e.slotCount-n)*(e.slotMinutes||0),i=await fetch("/api/admin/capacity/adhoc-clinic/release",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clinic_id:e.clinicId})}),o=await i.json().catch(()=>null);if(!i.ok)return void r.oR.error(null!=(a=null==o?void 0:o.message)?a:"Those slots could not be released.");await en(M.date);let c=null==o?void 0:o.result;r.oR.success("".concat(ex(null!=(l=null==c?void 0:c.minutes)?l:s)," returned to free time")+((null==c?void 0:c.clinicRemoved)?". ".concat(e.name," removed."):""))},er=async e=>{var t;if(M&&e.clinicId){if((null!=(t=e.bookedSlotCount)?t:0)>0)return void await ed(e);Y({title:"Cancel ".concat(e.name,"?"),detail:(0,l.jsxs)("p",{children:["Its ",e.slotCount," slot",1===e.slotCount?"":"s"," ","return to free time."]}),confirmLabel:"Cancel clinic",tone:"danger",run:()=>void ed(e)})}},ed=async e=>{if(!M||!e.clinicId)return;let t=await fetch("/api/admin/capacity/adhoc-clinic/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clinic_id:e.clinicId})}),a=await t.json().catch(()=>null);if(!t.ok){var n;return(null==a?void 0:a.code)==="HAS_BOOKINGS"?void r.oR.error((0,l.jsxs)("span",{children:[a.message," ",(0,l.jsx)("a",{className:"capacity__toast-undo",href:"/admin/bookings?date=".concat(M.date),children:"Open the calendar"})]}),{autoClose:12e3}):void r.oR.error(null!=(n=null==a?void 0:a.message)?n:"That clinic could not be cancelled.")}await en(M.date),r.oR.success("".concat(e.name," cancelled."))},eu=async e=>{W(!0),G(null);try{var t,a,n;let s=await fetch("/api/admin/capacity/adhoc-clinic/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),i=await s.json().catch(()=>null);if(!s.ok){((null==i?void 0:i.code)==="GAP_TAKEN"||(null==i?void 0:i.code)==="OVERLAP")&&await en(e.date),G(null!=(a=null==i?void 0:i.message)?a:"That clinic could not be created.");return}let o=null==i?void 0:i.clinic;await en(e.date),I(null),U(e.resource_id);let c=null!=(n=null==o||null==(t=o.slots)?void 0:t.length)?n:0;r.oR.success((0,l.jsxs)("span",{children:[null==o?void 0:o.name," created \xb7 ",c," slot",1===c?"":"s"," ",(0,l.jsx)("button",{type:"button",className:"capacity__toast-undo",onClick:()=>es(o.id,e.date),children:"Undo"})]}),{autoClose:1e4})}catch(e){G("That clinic could not be created. Check your connection and try again.")}finally{W(!1)}};return(0,l.jsx)(u.t,{role:p.role,className:"admin-panel--calendar-page admin-panel--capacity",title:"Room & Clinician Availability",actions:(0,l.jsxs)("div",{className:"capacity__header-actions",children:[(0,l.jsx)("div",{className:"capacity__segments",role:"group","aria-label":"What to show",children:["booked","scheduled"].map(e=>(0,l.jsx)("button",{type:"button",className:o()("capacity__segment",{"capacity__segment--on":j===e}),"aria-pressed":j===e,onClick:()=>X({view:e}),title:"booked"===e?"Free and booked time, from the working hours":"The slots each service offers, from the recurring schedule",children:"booked"===e?"Booked":"Scheduled"},e))}
1),"scheduled"===j?(0,l.jsx)("div",{className:"capacity__segments",role:"group","aria-label":"Range",children:["day","week","month"].map(e=>(0,l.jsx)("button",{type:"button",className:o()("capacity__segment",{"capacity__segment--on":g===e}),"aria-pressed":g===e,onClick:()=>X({mode:e}),children:"day"===e?"Day":"week"===e?"Week":"Month"},e))}):null,(0,l.jsxs)("div",{className:"capacity__pager",children:[(0,l.jsx)("button",{type:"button",className:"capacity__pager-step","aria-label":"Previous ".concat(ej(j,g)),onClick:()=>Q(-1),children:(0,l.jsx)(c.irw,{"aria-hidden":"true"})}),(0,l.jsx)("span",{className:"capacity__pager-label",children:"scheduled"===j&&O&&"day"!==g?O.rangeLabel:function(e){let[t,a,l]=e.split("-").map(Number),n=new Date(Date.UTC(t,a-1,l)),s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][n.getUTCDay()],i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n.getUTCMonth()];return"".concat(s," ").concat(l," ").concat(i)}(V)}),(0,l.jsx)("button",{type:"button",className:"capacity__pager-step","aria-label":"Next ".concat(ej(j,g)),onClick:()=>Q(1),children:(0,l.jsx)(c.fOo,{"aria-hidden":"true"})})]}),(0,l.jsx)("button",{type:"button",className:"capacity__today",disabled:el,onClick:()=>Z(_()),children:"Today"})]}),bodyChildren:(0,l.jsxs)("div",{className:"capacity",children:[N?(0,l.jsx)(F.Y,{tone:"error",message:N,action:{label:"Try again",onClick:()=>w.reload()}}):null,"scheduled"===j&&O?(0,l.jsxs)(l.Fragment,{children:[eS(O).length>0?(0,l.jsx)(F.Y,{tone:"warning",message:eS(O)[0],detail:eS(O).slice(1).join(" ")||void 0}):null,(0,l.jsxs)("section",{className:"capacity__strip","aria-label":"Scheduled slots at a glance",children:[(0,l.jsxs)("div",{className:"capacity__stat",children:[(0,l.jsxs)("p",{className:"capacity__stat-value",children:[ek(O).times.total," ",(0,l.jsx)("span",{className:"capacity__stat-unit",children:"start times"})]}),(0,l.jsx)("p",{className:"capacity__stat-sub",children:"distinct times a patient could be offered"})]}),(0,l.jsx)("span",{className:"capacity__stat-divider","aria-hidden":"true"}),(0,l.jsxs)("div",{className:"capacity__stat",children:[(0,l.jsxs)("p",{className:"capacity__stat-value",children:[ek(O).times.booked," ",(0,l.jsx)("span",{className:"capacity__stat-unit",children:"taken"})]}),(0,l.jsxs)("p",{className:"capacity__stat-sub",children:[ek(O).times.open," start times with nothing booked"]})]}),(0,l.jsx)("span",{className:"capacity__stat-divider","aria-hidden":"true"}),(0,l.jsxs)("div",{className:"capacity__stat",children:[(0,l.jsxs)("p",{className:"capacity__stat-value",children:[ek(O).services," ",(0,l.jsxs)("span",{className:"capacity__stat-unit",children:["of ",O.services.length," services"]})]}),(0,l.jsxs)("p",{className:"capacity__stat-sub",children:["offering anything, over ",ek(O).total," ","slot offers in total"]})]})]}),"day"===g&&x.length?(0,l.jsx)("section",{className:"capacity__week","aria-label":"Utilisation this week. Select a day to jump to it.",children:x.map(e=>{var t;return(0,l.jsxs)("button",{type:"button",className:o()("capacity__week-day",{"capacity__week-day--today":e.isToday,"capacity__week-day--active":e.date===O.anchor,"capacity__week-day--closed":e.isClosed}),onClick:()=>Z(e.date),"aria-current":e.date===O.anchor?"date":void 0,children:[(0,l.jsxs)("span",{className:"capacity__week-top",children:[(0,l.jsx)("span",{className:"capacity__week-label",children:e.label}),(0,l.jsx)("span",{className:"capacity__week-value",children:null===e.utilisation?"–":"".concat(e.utilisation,"%")})]}),(0,l.jsx)("span",{className:"capacity__week-bar",children:(0,l.jsx)("span",{className:o()("capacity__week-bar-fill","capacity__week-bar-fill--".concat(ev(e.utilisation))),style:{width:"".concat(null!=(t=e.utilisation)?t:0,"%")}})})]},e.date)})}):null,(0,l.jsxs)("section",{className:"capacity__panel",id:"capacity-scheduled-view",children:[(0,l.jsxs)("div",{className:"capacity__panel-head",children:[(0,l.jsx)("span",{className:"capacity__panel-kicker",children:"day"===g?"Scheduled slots":"week"===g?"Scheduled slots, by weekday":"Scheduled slots, by date"}),"month"===g?(0,l.jsxs)("div",{className:"capacity__finder",children:[(0,l.jsx)("span",{className:"capacity__finder-label",id:"capacity-month-label",children:"Show"}),(0,l.jsx)("div",{className:"capacity__segments",role:"group","aria-labelledby":"
1capacity-month-label",children:[["coverage","Which services"],["load","Offered vs booked"]].map(e=>{let[t,a]=e;return(0,l.jsx)("button",{type:"button",className:o()("capacity__segment",{"capacity__segment--on":R===t}),"aria-pressed":R===t,onClick:()=>P(t),children:a},t)})})]}):null]}),(0,l.jsx)(ei,{data:O,monthMetric:R,onMonthMetricChange:P,onOpenDay:e=>X({date:e,mode:"day"}),onRefresh:$})]}),(0,l.jsxs)("p",{className:"capacity__hint",children:["Slots here recur every week."," ","day"===g?"Drag across a service row to draw a run of new slots, or select any open slot to remove it.":"Select any open slot to remove it, or use Add slots to create a run."," ","Either way the change applies to every future week."]})]}):null,"booked"===j&&M?(0,l.jsxs)(l.Fragment,{children:[M.totals.resourcesMissingHours>0?(0,l.jsx)(F.Y,{message:M.totals.resourcesMissingHours===M.totals.resourceCount?"No working hours are set at this site":"".concat(M.totals.resourcesMissingHours," of ").concat(M.totals.resourceCount," resources have no working hours"),detail:"Free capacity cannot be calculated without them, so those rows show nothing. Set hours on each room and clinician.",action:{label:"Rooms & clinicians",onClick:()=>{window.location.href="/admin/consultation-rooms"}}}):null,(0,l.jsxs)("section",{className:"capacity__strip","aria-label":"Today at a glance",children:[(0,l.jsxs)("div",{className:"capacity__stat",children:[(0,l.jsxs)("p",{className:"capacity__stat-value",children:[ex(M.totals.freeMinutes)," ",(0,l.jsx)("span",{className:"capacity__stat-unit",children:"free"})]}),(0,l.jsx)("p",{className:"capacity__stat-sub",children:"across all resources today"})]}),(0,l.jsx)("span",{className:"capacity__stat-divider","aria-hidden":"true"}),(0,l.jsxs)("div",{className:"capacity__stat",children:[(0,l.jsxs)("p",{className:"capacity__stat-value",children:[null===ea?"–":"".concat(ea,"%")," ",(0,l.jsx)("span",{className:"capacity__stat-unit",children:"utilised"})]}),null!==ea?(0,l.jsx)("span",{className:"capacity__meter",role:"img","aria-label":"".concat(ea," per cent of the day is booked"),children:(0,l.jsx)("span",{className:"capacity__meter-fill",style:{width:"".concat(ea,"%")}})}):null]}),(0,l.jsx)("span",{className:"capacity__stat-divider","aria-hidden":"true"}),(0,l.jsxs)("div",{className:"capacity__stat",children:[(0,l.jsxs)("p",{className:"capacity__stat-value",children:[M.totals.resourceCount," ",(0,l.jsx)("span",{className:"capacity__stat-unit",children:1===M.totals.resourceCount?"resource":"resources"})]}),(0,l.jsx)("p",{className:"capacity__stat-sub",children:function(e){let t=e.resources.filter(e=>"clinician"!==e.resource.kind).length,a=e.resources.length-t,l=[];return t>0&&l.push("".concat(t," ").concat(1===t?"room":"rooms")),a>0&&l.push("".concat(a," ").concat(1===a?"clinician":"clinicians")),l.length?l.join(" \xb7 "):"None set up yet"}(M)})]})]}),x.length?(0,l.jsx)("section",{className:"capacity__week","aria-label":"Utilisation this week. Select a day to jump to it.",children:x.map(e=>{var t;return(0,l.jsxs)("button",{type:"button",className:o()("capacity__week-day",{"capacity__week-day--today":e.isToday,"capacity__week-day--active":e.date===M.date,"capacity__week-day--closed":e.isClosed}),onClick:()=>Z(e.date),"aria-current":e.date===M.date?"date":void 0,title:e.isClosed?"Closed":"".concat(e.bookings," booking").concat(1===e.bookings?"":"s",", ").concat(e.utilisation,"% utilised. Select to jump to this day."),children:[(0,l.jsxs)("span",{className:"capacity__week-top",children:[(0,l.jsx)("span",{className:"capacity__week-label",children:e.label}),(0,l.jsx)("span",{className:"capacity__week-value",children:null===e.utilisation?"–":"".concat(e.utilisation,"%")})]}),(0,l.jsx)("span",{className:"capacity__week-bar",children:(0,l.jsx)("span",{className:o()("capacity__week-bar-fill","capacity__week-bar-fill--".concat(ev(e.utilisation))),style:{width:"".concat(null!=(t=e.utilisation)?t:0,"%")}})})]},e.date)})}):null,(0,l.jsxs)("section",{className:"capacity__panel",id:"capacity-day-view",children:[(0,l.jsxs)("div",{className:"capacity__panel-head",children:[(0,l.jsx)("span",{className:"capacity__panel-kicker",children:"Day view"}),(0,l.jsxs)("div",{className:"capacity__finder",children:[(0,l.jsx)("span",{className:"capacity__finder-label",id:"capacity-find-label",children:"Find a free slot lasting"}),(0,l.jsx)("div",{className:"capacity__segments",role:"group","aria-labelledby":"
1capacity-find-label",children:ef.map(e=>{let t=q===e.minutes;return(0,l.jsx)("button",{type:"button",className:o()("capacity__segment",{"capacity__segment--on":t}),"aria-pressed":t,onClick:()=>J(t?0:e.minutes),children:e.label},e.minutes)})})]})]}),(0,l.jsxs)("div",{className:"capacity__filter-row",children:[(0,l.jsx)("div",{className:"capacity__filters",role:"group","aria-label":"Filter by service type",children:(function(e){return[...d.sg.filter(t=>{var a;return(null!=(a=e[t])?a:0)>0}),...d.sg.filter(t=>{var a;return(null!=(a=e[t])?a:0)===0})]})(ee).map(e=>{var t;let a=null!=(t=ee[e])?t:0,n=C.has(e);return(0,l.jsxs)("button",{type:"button",className:o()("capacity__filter",{"capacity__filter--off":n}),"aria-pressed":!n,title:0===a?"No bookings today":n?"Hidden \xb7 click to show":"Showing \xb7 click to hide",onClick:()=>(e=>{T(t=>{let a=new Set(t);a.has(e)?a.delete(e):a.add(e);try{window.localStorage.setItem(eb,JSON.stringify(Array.from(a)))}catch(e){}return a})})(e),children:[(0,l.jsx)("span",{className:"capacity__swatch capacity__swatch--".concat(e),"aria-hidden":"true"}),d.Bi[e],(0,l.jsx)("span",{className:"capacity__filter-count",children:a})]},e)})}),q>0?(0,l.jsx)("span",{className:"capacity__match-note",role:"status",children:1===et?"1 matching gap":"".concat(et," matching gaps")}):null]}),(0,l.jsx)(y,{day:M,hiddenCategories:C,matchMinutes:q,expandResourceId:z,demand:v,onSetHours:e=>{window.location.href="/admin/consultation-rooms/".concat(e.resource.id)},onSelectFree:(e,t)=>
1{M&&(G(null),I({resourceId:e.resource.id,resourceName:e.resource.name,date:M.date,dateLabel:M.dateLabel,start:t.start,end:t.end}))},onReleaseClinic:eo,onCancelClinic:er})]}),(0,l.jsx)("p",{className:"capacity__hint",children:"Click any free (dashed) block to add a service into it."}),(0,l.jsx)(ey.z,{day:k,canSeeConfigNotice:"ADMIN"===p.role})]}):null,(0,l.jsx)(D.T,{isOpen:null!==K,title:null!=(i=null==K?void 0:K.title)?i:"",detail:null==K?void 0:K.detail,confirmLabel:null!=(m=null==K?void 0:K.confirmLabel)?m:"Confirm",tone:null!=(h=null==K?void 0:K.tone)?h:"default",onCancel:()=>Y(null),onConfirm:()=>{Y(null),null==K||K.run()}}),(0,l.jsx)(e_,{gap:H,services:f,saving:L,error:B,onCancel:()=>{I(null),G(null)},onCreate:eu})]})})}},15941:(e,t,a)=>{"use strict";a.d(t,{_:()=>u});var l=a(37876),n=a(14232),s=a(98477),i=a(15039),o=a.n(i),c=a(13497),r=a(90570),d=a.n(r);let _='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])',u=e=>{let{isOpen:t,onClose:a,eyebrow:i,title:r,ariaLabel:u,footer:m,wide:h=!1,children:p}=e,[y,b]=n.useState(!1),[f,v]=n.useState(!1),x=n.useRef(null),k=n.useRef(null);return(n.useEffect(()=>b(!0),[]),n.useEffect(()=>{if(!t)return void v(!1);let e=requestAnimationFrame(()=>v(!0));return()=>cancelAnimationFrame(e)},[t]),n.useEffect(()=>{if(!t)return;k.current=document.activeElement;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{var t,a;document.body.style.overflow=e,null==(a=k.current)||null==(t=a.focus)||t.call(a)}},[t]),n.useEffect(()=>{var e,t;f&&(null==(t=x.current)||null==(e=t.querySelector(_))||e.focus())},[f]),y)?(0,s.createPortal)((0,l.jsxs)("div",{className:o()(d().root,{[d().rootOpen]:f}),"aria-hidden":!t,children:[(0,l.jsx)("div",{className:d().scrim,onClick:a}),(0,l.jsxs)("div",{ref:x,role:"dialog","aria-modal":"true","aria-label":null!=u?u:r,className:o()(d().panel,{[d().panelWide]:h}),onKeyDown:e=>{var t,l;if("Escape"===e.key){e.stopPropagation(),a();return}if("Tab"!==e.key)return;let n=Array.from(null!=(l=null==(t=x.current)?void 0:t.querySelectorAll(_))?l:[]).filter(e=>null!==e.offsetParent);if(0===n.length)return;let s=n[0],i=n[n.length-1];e.shiftKey&&document.activeElement===s?(e.preventDefault(),i.focus()):e.shiftKey||document.activeElement!==i||(e.preventDefault(),s.focus())},children:[(0,l.jsxs)("header",{className:d().header,children:[(0,l.jsxs)("div",{children:[i?(0,l.jsx)("p",{className:d().eyebrow,children:i}):null,(0,l.jsx)("h2",{className:d().title,children:r})]}),(0,l.jsx)("button",{type:"button",className:d().close,onClick:a,"aria-label":"Close ".concat(r.toLowerCase()),children:(0,l.jsx)(c.$8F,{})})]}),(0,l.jsx)("div",{className:d().body,children:p}),m?(0,l.jsx)("footer",{className:d().footer,children:m}):null]})]}),document.body):null}},29454:(e,t,a)=>{"use strict";function l(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var l in a)e[l]=a[l]}return e}a.d(t,{A:()=>n});var n=function e(t,a){function n(e,n,s){if("undefined"!=typeof document){"number"==typeof(s=l({},a,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var o in s)s[o]&&(i+="; "+o,!0!==s[o]&&(i+="="+s[o].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+i}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var a=document.cookie?document.cookie.split("; "):[],l={},n=0;n<a.length;n++){var s=a[n].split("="),i=s.slice(1).join("=");try{var o=decodeURIComponent(s[0]);if(l[o]=t.read(i,o),e===o)break}catch(e){}}return e?l[e]:l}},remove:function(e,t){n(e,"",l({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,l({},this.attributes,t))},withConverter:function(t){return e(l({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(a)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decode
1URIComponent)}},{path:"/"})},53566:e=>{e.exports={adhoc__context:"AdhocClinicPanel_adhoc__context__1QlrH",adhoc__field:"AdhocClinicPanel_adhoc__field__VVjJ6",adhoc__row:"AdhocClinicPanel_adhoc__row__vbdMa",adhoc__input:"AdhocClinicPanel_adhoc__input__7kQ0z","adhoc__with-unit":"AdhocClinicPanel_adhoc__with-unit__IaBfQ",adhoc__unit:"AdhocClinicPanel_adhoc__unit__KELVP",adhoc__modes:"AdhocClinicPanel_adhoc__modes__86FhG",adhoc__mode:"AdhocClinicPanel_adhoc__mode__ZbEXO","adhoc__mode--on":"AdhocClinicPanel_adhoc__mode--on__hw96n",adhoc__summary:"AdhocClinicPanel_adhoc__summary__hYXP_",adhoc__note:"AdhocClinicPanel_adhoc__note__ddF04",adhoc__error:"AdhocClinicPanel_adhoc__error__L8Fk5",adhoc__link:"AdhocClinicPanel_adhoc__link__K12ya",adhoc__chips:"AdhocClinicPanel_adhoc__chips__fUT1W",adhoc__chip:"AdhocClinicPanel_adhoc__chip__xgivw",adhoc__blocks:"AdhocClinicPanel_adhoc__blocks__w949H",adhoc__block:"AdhocClinicPanel_adhoc__block__bp8rz","adhoc__block-length":"AdhocClinicPanel_adhoc__block-length__AEkCW",adhoc__remove:"AdhocClinicPanel_adhoc__remove__9CrGE",adhoc__publish:"AdhocClinicPanel_adhoc__publish__8jOVb","adhoc__publish-note":"AdhocClinicPanel_adhoc__publish-note__eKgIR",adhoc__footer:"AdhocClinicPanel_adhoc__footer__q9mPJ",adhoc__actions:"AdhocClinicPanel_adhoc__actions__cQ1D0",adhoc__blocked:"AdhocClinicPanel_adhoc__blocked__wmc7C"}},57945:(e,t,a)=>{"use strict";a.d(t,{Bi:()=>s,C5:()=>n,mi:()=>l,sg:()=>i});let l="Limited Time Service",n={travel:"Travel",nhs:"NHS",pharmacyfirst:"Ph. First",bloods:"Blood test",private:"Private",adhoc:"Ad-hoc",other:"Other"},s={travel:"Travel clinic",nhs:"NHS service",pharmacyfirst:"Pharmacy First",bloods:"Blood test",private:"Private service",adhoc:"Ad-hoc clinic",other:"Other"},i=["travel","nhs","pharmacyfirst","bloods","private","adhoc","other"]},58982:e=>{e.exports={notice:"NoticeBar_notice__a6kNY",notice__icon:"NoticeBar_notice__icon__7Q2O0",notice__text:"NoticeBar_notice__text__ICQ2u",notice__message:"NoticeBar_notice__message__Xia2O",notice__detail:"NoticeBar_notice__detail__FK9LF",notice__action:"NoticeBar_notice__action__AaAnh","notice--warning":"NoticeBar_notice--warning__5OYWP","notice--error":"NoticeBar_notice--error__rvjod","notice--success":"NoticeBar_notice--success__vudr0","notice--info":"NoticeBar_notice--info__UMttc"}},73119:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/capacity",function(){return a(3715)}])},74424:e=>{e.exports={srOnly:"ScheduledSlots_srOnly__7Jfai",root:"ScheduledSlots_root__x_Zxo",selection:"ScheduledSlots_selection__UX2rs",selectionText:"ScheduledSlots_selectionText__CZCVW",selectionRemove:"ScheduledSlots_selectionRemove__6Umen",selectionClear:"ScheduledSlots_selectionClear__sdL90",swatch:"ScheduledSlots_swatch__rCqvZ","swatch--travel":"ScheduledSlots_swatch--travel__uQnFG","swatch--nhs":"ScheduledSlots_swatch--nhs__tycqa","swatch--pharmacyfirst":"ScheduledSlots_swatch--pharmacyfirst__9VMXK","swatch--bloods":"ScheduledSlots_swatch--bloods__wAho_","swatch--private":"ScheduledSlots_swatch--private__Of1_o","swatch--adhoc":"ScheduledSlots_swatch--adhoc__4FX6y","swatch--other":"ScheduledSlots_swatch--other__WYN8_",rowName:"ScheduledSlots_rowName__VIb_C",empty:"ScheduledSlots_empty__TpUsO",day:"ScheduledSlots_day__QxI76",resource:"ScheduledSlots_resource__nR_Pw",resourceHead:"ScheduledSlots_resourceHead__GEjTa",resourceName:"ScheduledSlots_resourceName__LSeRe",resourceSummary:"ScheduledSlots_resourceSummary__SeJNk",addService:"ScheduledSlots_addService__83HO_",grid:"ScheduledSlots_grid__xpV39",gridCorner:"ScheduledSlots_gridCorner__5ESFM",gridAxis:"ScheduledSlots_gridAxis__08Wn2",axis:"ScheduledSlots_axis__BVF2Z",axisTick:"ScheduledSlots_axisTick__i0ylP",row:"ScheduledSlots_row__tmUe5",rowHead:"ScheduledSlots_rowHead__1XtEz",track:"ScheduledSlots_track__hmIfs",rowMeta:"ScheduledSlots_rowMeta__dcXt3",rowAdd:"ScheduledSlots_rowAdd__ZDrs3","track--drawing":"ScheduledSlots_track--drawing__Kyhxh",gridlines:"ScheduledSlots_gridlines__j83uT",gridline:"ScheduledSlots_gridline__ohs5a",ghost:"ScheduledSlots_ghost__p5_64",ghostLabel:"ScheduledSlots_ghostLabel__h_KO_",trackEmpty:"ScheduledSlots_trackEmpty__jH9zw",slot:"ScheduledSlots_slot__mxzsV",slotTime:"ScheduledSlots_slotTime__lZrgy","slot--travel":"ScheduledSlots_slot--travel__y8o8f","slot--open":"ScheduledSlots_slot--open__Lbr5C","slot--nhs":"ScheduledSlots_slot--nhs__s2nYA","slot--pharmacyfirst":"ScheduledSlots_slot--pharmacyfirst__8aaUK","slot--bloods":"ScheduledSlots_slot--bloods__WgpOx","slot--private":"ScheduledSlots_slot--private__E0TpM","slot--adhoc":"ScheduledSlots_slot--adhoc__4JDzx","slot--other":"ScheduledSlots_slot--other__YWXwA","slot--booked":"ScheduledSlots_slot--booked__FRtPP","slot--blocked":"ScheduledSlots_slot--blocked__F_zUK","slot--closed":"ScheduledSlots_slot--closed__ILS6R","slot--selected":"ScheduledSlots_slot--selected__KsIWu","slot--outside":"ScheduledSlots_slot--outside___t7Wv",weekScroll:"ScheduledSlots_weekScroll__kESxI",week:"ScheduledSlots_week__640G_",weekCorner:"ScheduledSlots_weekCorner__L2Qw1",weekHead:"ScheduledSlots_weekHead__yiCmZ",weekHeadButton:"ScheduledSlots_weekHeadButton__8Dlb2",weekHeadDay:"ScheduledSlots_weekHeadDay__dymfS",weekHeadCount:"ScheduledSlots_weekHeadCount__RQn85","weekHead--today":"ScheduledSlots_weekHead--today__1wlD2",weekGroupHead:"ScheduledSlots_weekGroupHead__m9xWC",weekRow:"ScheduledSlots_weekRow__k3NJX",weekRowHead:"ScheduledSlots_weekRowHead__Jk_Sz",weekCell:"ScheduledSlots_weekCell__k6T_m",weekChips:"ScheduledSlots_weekChips__D7AuF",weekCellMeta:"ScheduledSlots_weekCellMeta__Lebfm","weekCell--empty":"ScheduledSlots_weekCell--empty__O5G2t",weekCellAdd:"ScheduledSlots_weekCellAdd__rDYbz",chip:"ScheduledSlots_chip__Et9Ar","chip--booked":"ScheduledSlots_chip--booked__LznHu","chip--blocked":"ScheduledSlots_chip--blocked__Immw3","chip--closed":"ScheduledSlots_chip--closed__d0upB","chip--selected":"ScheduledSlots_chip--selected__ITrHG",month:"ScheduledSlots_month__sYjmO",monthHead:"ScheduledSlots_monthHead__kg_Xm",monthHeadCell:"ScheduledSlots_monthHeadCell__bn_aB",monthGrid:"ScheduledSlots_monthGrid__Rz9NB",monthBlank:"ScheduledSlots_monthBlank__HHLaD",monthCell:"ScheduledSlots_monthCell__0ao
1Rt","monthCell--today":"ScheduledSlots_monthCell--today__Kihnm","monthCell--closed":"ScheduledSlots_monthCell--closed__zzSBQ","monthCell--silent":"ScheduledSlots_monthCell--silent__3oMfL",monthDate:"ScheduledSlots_monthDate__9CBPU",monthClosed:"ScheduledSlots_monthClosed__3cMr4",monthNone:"ScheduledSlots_monthNone__wYvzh",monthServices:"ScheduledSlots_monthServices__QzSUw",monthService:"ScheduledSlots_monthService__D7cSy",monthServiceName:"ScheduledSlots_monthServiceName__MLcwa",monthServiceCount:"ScheduledSlots_monthServiceCount__fxxDt",monthMore:"ScheduledSlots_monthMore__IMJHq",monthLoad:"ScheduledSlots_monthLoad__Lo3Lw",monthBar:"ScheduledSlots_monthBar__9_DlX",monthBarFill:"ScheduledSlots_monthBarFill__0nktA",monthLoadText:"ScheduledSlots_monthLoadText__JY2SL",form:"ScheduledSlots_form__uqS1m",field:"ScheduledSlots_field__6wlRF",fieldRow:"ScheduledSlots_fieldRow__CeKT0",label:"ScheduledSlots_label__qlpw_",select:"ScheduledSlots_select__zsYk5",input:"ScheduledSlots_input__5pdZY",help:"ScheduledSlots_help__uAdnH",weekdays:"ScheduledSlots_weekdays__cOcL4",weekday:"ScheduledSlots_weekday__3XOMt","weekday--on":"ScheduledSlots_weekday--on__eGcay",preview:"ScheduledSlots_preview__OvuWA",previewHead:"ScheduledSlots_previewHead__aRAld",previewTimes:"ScheduledSlots_previewTimes__UWIcR",drawerFooter:"ScheduledSlots_drawerFooter__er9bn",drawerCancel:"ScheduledSlots_drawerCancel__FKmQd"}},76426:e=>{e.exports={timeline:"CapacityTimeline_timeline__VV1Eh",timeline__caption:"CapacityTimeline_timeline__caption__fJQby","timeline__visually-hidden":"CapacityTimeline_timeline__visually-hidden__fxUM6",timeline__corner:"CapacityTimeline_timeline__corner__Vof5I","timeline__axis-cell":"CapacityTimeline_timeline__axis-cell__vksiJ",timeline__axis:"CapacityTimeline_timeline__axis__n1_lo",timeline__tick:"CapacityTimeline_timeline__tick___b_ai","timeline__demand-head":"CapacityTimeline_timeline__demand-head__IZ_Vz","timeline__demand-title":"CapacityTimeline_timeline__demand-title__NQ7_j","timeline__demand-sub":"CapacityTimeline_timeline__demand-sub__b5UUQ","timeline__demand-cell":"CapacityTimeline_timeline__demand-cell__kdeys","timeline__demand-track":"CapacityTimeline_timeline__demand-track__HHZhU","timeline__demand-bar":"CapacityTimeline_timeline__demand-bar__qYjN2","timeline__demand-bar--peak":"CapacityTimeline_timeline__demand-bar--peak__pG2YS","timeline__peak-tag":"CapacityTimeline_timeline__peak-tag__5GvKe","timeline__peak-tag-text":"CapacityTimeline_timeline__peak-tag-text__6l_YM",timeline__head:"CapacityTimeline_timeline__head__W6Qo_",timeline__toggle:"CapacityTimeline_timeline__toggle__00pAv",timeline__name:"CapacityTimeline_timeline__name__NGZPR",timeline__chevron:"CapacityTimeline_timeline__chevron__awqoO","timeline__chevron--open":"CapacityTimeline_timeline__chevron--open__Kz5iB",timeline__sub:"CapacityTimeline_timeline__sub__SF8b9","timeline__track-cell":"CapacityTimeline_timeline__track-cell__FmDyu","timeline__peak-band":"CapacityTimeline_timeline__peak-band__h8z1M",timeline__track:"CapacityTimeline_timeline__track__rI_Hh",timeline__gridline:"CapacityTimeline_timeline__gridline__bFQ6e",timeline__block:"CapacityTimeline_timeline__block__6_XI5","timeline__block--booked":"CapacityTimeline_timeline__block--booked__lz8iJ","timeline__block--cat-travel":"CapacityTimeline_timeline__block--cat-travel__ECl1T","timeline__block--cat-nhs":"CapacityTimeline_timeline__block--cat-nhs__bw8vj","timeline__block--cat-pharmacyfirst":"CapacityTimeline_timeline__block--cat-pharmacyfirst__nxjS_","timeline__block--cat-bloods":"CapacityTimeline_timeline__block--cat-bloods__FtsTA","timeline__block--cat-private":"CapacityTimeline_timeline__block--cat-private__8WdUn","timeline__block--cat-adhoc":"CapacityTimeline_timeline__block--cat-adhoc__G8Hcl","timeline__block--cat-other":"CapacityTimeline_timeline__block--cat-other__b9rrF","timeline__block-label":"CapacityTimeline_timeline__block-label__zzOHB","timeline__block--free":"CapacityTimeline_timeline__block--free__FhBmB","timeline__block--match":"CapacityTimeline_timeline__block--match__Gs08H","timeline__gap-label":"CapacityTimeline_timeline__gap-label__vZbuj","timeline__gap-plus":"CapacityTimeline_timeline__gap-plus__8sg1P","timeline__block--dimmed":"CapacityTimeline_timeline__block--dimmed__GvtWQ","timeline__block--closed":"CapacityTimeline_timeline__block--closed__Zuh1V","timeline__block--tur
1naround":"CapacityTimeline_timeline__block--turnaround__wgeIv","timeline__service-head":"CapacityTimeline_timeline__service-head__3rMPK","timeline__service-name":"CapacityTimeline_timeline__service-name__kNx4G",timeline__dot:"CapacityTimeline_timeline__dot__fxg4S","timeline__dot--travel":"CapacityTimeline_timeline__dot--travel__j_1hV","timeline__dot--nhs":"CapacityTimeline_timeline__dot--nhs__fpjPQ","timeline__dot--pharmacyfirst":"CapacityTimeline_timeline__dot--pharmacyfirst__SqjJN","timeline__dot--bloods":"CapacityTimeline_timeline__dot--bloods__CfJ_j","timeline__dot--private":"CapacityTimeline_timeline__dot--private__RtA5C","timeline__dot--adhoc":"CapacityTimeline_timeline__dot--adhoc__ZTOPv","timeline__dot--other":"CapacityTimeline_timeline__dot--other__V_Wzw","timeline__service-meta":"CapacityTimeline_timeline__service-meta__fPqQC","timeline__lane-cell":"CapacityTimeline_timeline__lane-cell__9sT0F",timeline__lane:"CapacityTimeline_timeline__lane__3PNKp","timeline__lane-gridline":"CapacityTimeline_timeline__lane-gridline__YJO8j","timeline__lane-block":"CapacityTimeline_timeline__lane-block__NmD7T","timeline__lane-block--travel":"CapacityTimeline_timeline__lane-block--travel__cpa32","timeline__lane-block--nhs":"CapacityTimeline_timeline__lane-block--nhs__VVema","timeline__lane-block--pharmacyfirst":"CapacityTimeline_timeline__lane-block--pharmacyfirst__BL2MZ","timeline__lane-block--bloods":"CapacityTimeline_timeline__lane-block--bloods__MMtOZ","timeline__lane-block--private":"CapacityTimeline_timeline__lane-block--private__ehGql","timeline__lane-block--adhoc":"CapacityTimeline_timeline__lane-block--adhoc__wH56n","timeline__lane-block--other":"CapacityTimeline_timeline__lane-block--other__YliSC",timeline__badge:"CapacityTimeline_timeline__badge__845Fy","timeline__clinic-actions":"CapacityTimeline_timeline__clinic-actions__Z30zA","timeline__clinic-action":"CapacityTimeline_timeline__clinic-action__3E5ps","timeline__more-cell":"CapacityTimeline_timeline__more-cell__Cm1GV",timeline__more:"CapacityTimeline_timeline__more__xPJdW",timeline__prompt:"CapacityTimeline_timeline__prompt__Xi9FF",timeline__warning:"CapacityTimeline_timeline__warning__4nnN2",timeline__empty:"CapacityTimeline_timeline__empty__mNSB0",stack:"CapacityTimeline_stack__sSwy3",stack__card:"CapacityTimeline_stack__card__IF__K",stack__name:"CapacityTimeline_stack__name__2eflM",stack__meta:"CapacityTimeline_stack__meta__lecGI",stack__blocks:"CapacityTimeline_stack__blocks__EoOzF",stack__block:"CapacityTimeline_stack__block__spzSf",stack__time:"CapacityTimeline_stack__time__seGEy",stack__length:"CapacityTimeline_stack__length__yzqP0"}},79054:e=>{e.exports={"label-wrapper":"Label_label-wrapper__xKbCL",label:"Label_label__eCZGj",label__required:"Label_label__required__fg5Eo",label__helper:"Label_label__helper__rY22j"}},80490:(e,t,a)=>{"use strict";a.d(t,{d:()=>d});var l=a(37876),n=a(15039),s=a.n(n),i=a(81635),o=a(46980),c=a(82264),r=a.n(c);let d=e=>{let{label:t="Save",onClick:a,isLoading:n,modifier:c,disabled:d,icon:_,loaderColor:u="light",type:m="button"}=e,h=!1===_?null:void 0!==_?_:((e,t)=>{if("delete"===t)return(0,l.jsx)(i.IXo,{});let a=e.toLowerCase();return a.startsWith("add")||a.startsWith("create")||a.startsWith("new")?(0,l.jsx)(i.GGD,{}):"save"===a||a.startsWith("save ")?(0,l.jsx)(i.YrT,{}):a.startsWith("print")?(0,l.jsx)(i.Mvz,{}):a.startsWith("setup")||a.startsWith("settings")?(0,l.jsx)(i.VSk,{}):a.startsWith("export")||a.startsWith("download")?(0,l.jsx)(i.a4x,{}):a.startsWith("send")?(0,l.jsx)(i.kGk,{}):a.startsWith("upload")||a.startsWith("import")?(0,l.jsx)(i.B88,{}):a.startsWith("copy")||a.startsWith("duplicate")?(0,l.jsx)(i.nxz,{}):a.startsWith("refresh")||a.startsWith("sync")?(0,l.jsx)(i.jTZ,{}):null})(t,c);return(0,l.jsx)("button",{type:m,className:s()(r()["simple-button"],r()["simple-button--".concat(c)],{[r()["simple-button--disabled"]]:d},"no-print"),onClick:d?void 0:a,disabled:d,children:n?(0,l.jsx)(o.a,{size:20,loaderColor:u,className:r()["simple-button__loader"]}):(0,l.jsxs)(l.Fragment,{children:[h&&(0,l.jsx)("span",{className:r()["simple-button__icon"],children:h}),t]})})}},82264:e=>{e.exports={"simple-button":"SimpleButton_simple-button__Fw9D_","simple-button__loader":"SimpleButton_simple-button__loader__vMOKb","simple-button__icon":"SimpleButton_simple-button__icon__iGT9O","simple-button--fixed-width":"SimpleButton_simple-button--fixed-width__n0LZP","simple-button--delete":"SimpleButton_simple-button--delete__N1KCP","simple-button--reject":"SimpleButton_simple-button--reject__OF5ei","simple-button--ship":"SimpleButton_simple-button--ship__xOZNl","simple-button--grey":"SimpleButton_simple-button--grey__Juhhc","simple-button--secondary":"SimpleButton_simple-button--secondary__i_klO","simple-button--outline":"SimpleButton_simple-button--outline__RY_IG","simple-button--disabled":"SimpleButton_simple-button--disabled__so91t"}},90570:e=>{e.exports={root:"Drawer_root__muqpU",rootOpen:"Drawer_rootOpen__WwlHE",scrim:"Drawer_scrim__CqmoI",panel:"Drawer_panel__HbeGP",panelWide:"Drawer_panelWide__K4LUC",header:"Drawer_header__irvEL",eyebrow:"Drawer_eyebrow__IRkmA",title:"Drawer_title__L8d0G",close:"Drawer_close__jHrLb",body:"Drawer_body__CwUuY",footer:"Drawer_footer___R_fS",hint:"Drawer_hint__DeASt",error:"Drawer_error__c5347",actions:"Drawer_actions__fITrU",cancel:"Drawer_cancel__x7BS9"}},91012:(e,t,a)=>{"use strict";a.d(t,{Y:()=>d});var l=a(37876);a(14232);var n=a(15039),s=a.n(n),i=a(81635),o=a(58982),c=a.n(o);let r={warning:(0,l.jsx)(i.eHT,{}),info:(0,l.jsx)(i.S8s,{}),success:(0,l.jsx)(i.A3x,{}),error:(0,l.jsx)(i.hwE,{})},d=e=>{let{tone:t="warning",message:a,detail:n,action:i}=e;return(0,l.jsxs)("div",{className:s()(c().notice,c()["notice--".concat(t)]),role:"error"===t?"alert":"status",children:[(0,l.jsx)("span",{className:c().notice__icon,"aria-hidden":"true",children:r[t]}),(0,l.jsxs)("div",{className:c().notice__text,children:[(0,l.jsx)("p",{className:c().notice__message,children:a}),n?(0,l.jsx)("p",{className:c().notice__detail,children:n}):null]}),i?(0,l.jsx)("button",{type:"button",className:c().notice__action,onClick:i.onClick,children:i.label}):null]})}},91690:(e,t,a)=>{"use strict";a.d(t,{J:()=>c});var l=a(37876),n=a(15039),s=a.n(n),i=a(79054),o=a.n(i);let c=e=>{let{label:t,id:a,required:n,helperText:i,className:c}=e;return(0,l.jsxs)("div",{className:s()(o()["label-wrapper"],c),children:[(0,l.jsxs)("label",{className:o().label,htmlFor:a,children:[t,n?(0,l.jsx)("span",{className:o().label__required,
1children:" *"}):null]}),i?(0,l.jsx)("span",{className:o().label__helper,children:i}):null]})}}},e=>{e.O(0,[3845,4188,1167,3371,9196,6695,4701,5749,5925,4386,1852,5695,4087,1619,9190,6261,91,636,6593,8792],()=>e(e.s=73119)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.